-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgpme.js
4795 lines (4215 loc) · 175 KB
/
gpme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
# Filename: gpme.js
#
# Platforms: Google Chrome
# Depends:
# Web: http://huyz.us/google-plus-me/
# Source: https://github.com/huyz/google-plus-me
# Author: Huy Z http://huyz.us/
# Updated on: 2011-09-17
# Created on: 2011-07-11
#
# Installation:
# Like any other browser extension.
#
# Usage:
# See http://huyz.us/google-plus-me/
#
# TODO:
# This file is in bad need of refactoring for abstraction and architectural
# patterns, although there hasn't been a huge need for re-use yet.
# Since this project was initially a learning tool, I favored getting things done fast over
# thoughtful design.
# Still learning JavaScript, so pardon the cruft.
#
# Thanks:
# This extension initially took some ideas from
# https://github.com/mohamedmansour/google-plus-extension/
# http://code.google.com/p/buzz-plus/
# https://github.com/wittman/googleplusplus_hide_comments .
# Copyright (C) 2011 Huy Z
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
'use strict';
// If true, won't need the 'tabs' permission
// NOTE: Keep format the same as it is programmatically changed by package.sh
var PARANOID = false;
// If true, this turns on all sorts of debugging output in the JS console. This is appropriate
// to turn on for both development and beta.
// NOTE: Keep format the same as it is programmatically changed by package.sh
var DEBUG = true;
// If true, this will change the behavior of the app for development. This is only appropriate
// to turn on for development but not beta.
// NOTE: Keep format the same as it is programmatically changed by package.sh
var DEV = true;
/****************************************************************************
* Utility for constants
***************************************************************************/
// http://stackoverflow.com/questions/2593637/how-to-escape-regular-expression-in-javascript
RegExp.quote = function(str) {
return str.replace(/([.?*+^$[\]\\(){}-])/g, "\\$1");
};
/****************************************************************************
* Constants
***************************************************************************/
// Google+ API dev key
var plusApiDevKey = 'AIzaSyDueLroS1nPftNS3Ts5ik_GmLoYGuDkQaQ';
// FIXME: these will go away
var _ID_GB = '#gb';
var C_GBAR = 'c-Yd-V c-i-Yd-V'; // 'a-Rf-R a-f-Rf-R'; // Only for checking, sometimes people have extra class, e.g. 'a-rg-M a-e-rg-M a-rg-M-El'
var DISABLED_PAGES_URL_REGEXP = /\/(?:posts\/|notifications\/|sparks(:?\/|$)|up\/start\/)/;
function defineDomConstants(ns) {
// NOTE: only cache class names (CN_*) here if we're sure that they will be already mapped very early no
// matter what page the user first loads G+
ns.S_notificationsIframe = '#gbsf'; // FIXME: webx
ns.S_gbar = '%gbar'; // '#gb';
ns.S_gbarTop = '%gbarTop'; // '#gbw';
ns.S_gbarToolsNotificationA = '%gbarToolsNotificationA'; // '#gbg1';
ns.S_gbarToolsNotificationUnitBg = '%gbarToolsNotificationUnitBg'; // '#gbi1a';
ns.S_gbarToolsNotificationUnitFg = '%gbarToolsNotificationUnitFg'; // '#gbi1';
ns.CN_gbarToolsNotificationUnitBgZero = X.classNames('gbarToolsNotificationUnitBgZero'); // 'gbid';
ns.CN_gbarToolsNotificationUnitFgZero = X.classNames('gbarToolsNotificationUnitFgZero'); // 'gbids';
ns.S_gplusBar = '%gplusBar'; // '.c-i-cb-V';
ns.S_content = '%content'; // '#content';
ns.S_contentPane = '%contentPane'; // '#contentPane';
ns.S_copyrightRow = '%copyrightRow'; // '.a-f-kb-R';
ns.S_feedbackLink = '%feedbackLink'; // '.a-Vi-Eg';
// Icons
ns.CN_hangoutLiveIcon = X.classNames('hangoutLiveIcon'); // 'kC'
ns.CN_hangoutLiveInactiveIcon = X.classNames('hangoutLiveInactiveIcon'); // 'kC'
ns.S_hangoutLiveIcon = '%hangoutLiveIcon';
// We use backups for these icons because the first page load may have been on a page without share icons
// and we need these classes for our pre-created DOM elements
ns.CN_makeChildShareIconNonHoverable = X.classNames('makeChildShareIconNonHoverable') || X.classNames('makeChildShareIconNonHoverable2'); // Look at camera icon matched CSS rules, look for series of 3 pairs, use the last one (don't use the first one '.h-fc' otherwise hovers works)
ns.CN_shareIconsPhoto = X.classNames('shareIconsPhoto') || X.classNames('shareIconsPhoto2'); // 'i-wa-m-v';
ns.CN_shareIconsVideo = X.classNames('shareIconsVideo') || X.classNames('shareIconsVideo2'); // 'i-wa-m-Ha';
ns.CN_shareIconsLink = X.classNames('shareIconsLink') || X.classNames('shareIconsLink2'); // 'i-wa-m-j';
ns.CN_shareIconsLocation = X.classNames('shareIconsLocation') || X.classNames('shareIconsLocation2'); // 'i-wa-m-Te-D'; // Unlike the other ones, this has a single class for non-hover
ns.CN_gplusBarNavGamesIcon = X.classNames('gplusBarNavGamesIcon'); // 'Il';
// Pages and streams
ns.S_circleStream = '%circleStream'; // '.br'
ns.S_gamesActivitiesStream = '%gamesActivitiesStream'; // '.BI';
ns.S_circleStreamMoreButton = '%circleStreamMoreButton'; // '.Uk';
ns.S_gamesActivitiesStreamHeadingText = '%gamesActivitiesStreamHeadingText'; // '.Gt';
ns.S_circleStreamContentPaneHeadingText = '%circleStreamContentPaneHeadingText'; // '.vo';
ns.S_profileHeadingName = '%profileHeadingName'; // '.fn';
// Item
ns.S_postIsSelected = '%postIsSelected'; // '.ki';
ns.S_post = '%post'; // '.ke';
ns.S_postContainer = '%postContainer'; // '.Tf';
ns.S_postIsMutedOrDeleted = '%postIsMutedOrDeleted_d'; // '.En'
ns.S_postHead = '%postHead'; // '.Nw', div excluding the avatar and menu icon
ns.S_postBody = '%postBody'; // '.Kw'; // 2nd child of S_postContainer
ns.S_postUserAvatarA = '%postUserAvatarA'; // '.kr > a.Km'; // 1st child of C_ITEM_GUTS
ns.S_postUserName = '%postUserName'; // '.nC'; // span that contains the <a>
// S_postCategory:
// - checkin: https://plus.google.com/112543001180298325686/posts/1hJCin8mTaV
// - hangout: https://plus.google.com/100512649718649402368/posts/1u32KN5UzUR
// - mobile: https://plus.google.com/115404182941170857382/posts/ZUiCSs9Qteq
ns.S_postCategory = '%postCategory'; // '.Uv';
ns.S_postPermissions = '%postPermissions'; // '.Ii' from b-j Ii cp Gl
ns.S_postHeadInfoMuted = '%postHeadInfoMuted'; // '.Ox'; // "- Muted" text in profile page
ns.S_postTime = '%postTime'; // '.Hi'; // Hi vn. Span that contains the <a>
ns.S_postContentExpandButton = '%postContentExpandButton'; // '.ho'; // https://plus.google.com/111775942615006547057/posts/RaZvqBMadoH
//var _C_EMBEDDED_VIDEO = '.ea-S-Bb-jn > div';
// _C_QUOTED_PHOTO:
// - re-sharing your own post: https://plus.google.com/116805285176805120365/posts/3vKNMqMsYrc
ns._C_QUOTED_PHOTO = '.Ux > img';
// Various images:
// - [NO NEED] Web page image: O-F-Th-la
// - Posted image: B-u-zt-ja https://plus.google.com/107590607834908463472/posts/VfD8zwSq5yv
// - Posted album: B-u-xh-ja https://plus.google.com/100410400068186344529/posts/L4JRFFK2e87 [limited]
// - Main image in album: B-u-Nd-ja https://plus.google.com/103450266544747516806/posts/f8RKcEssKwL [limited]
// - Smaller image thumbnails in album: F-y-Mc-ea https://plus.google.com/103450266544747516806/posts/f8RKcEssKwL [limited]
ns.S_CONTENT_IMG = '.B-u-zt-ja > img, .B-u-xh-ja > img, .B-u-Nd-ja > img, .B-u-fc-ja > img';
// _C_CONTENT_VIDEO: https://plus.google.com/111775942615006547057/posts/YyeAxkSfjTD
ns._C_CONTENT_VIDEO = '.B-u-wa-Uj'; // Take the 4-part parent that looks like S_CONTENT_IMG
ns._C_CONTENT_ANY_LINK = ns.S_postBody + ' a.ot-anchor'; // This also includes links that are embedded in the text https://plus.google.com/112374836634096795698/posts/KryDaNYMQLF
ns._C_MAP_IMG = 'img.pv'; // https://plus.google.com/112543001180298325686/posts/1hJCin8mTaV
// poster text https://plus.google.com/111091089527727420853/posts/63tRxMQk7rV
ns._C_CONTENT_POSTER_TEXT = '.Ph';
// poster text #2 https://plus.google.com/110901814225194449440/posts/Nr651PmEM8d
ns._C_CONTENT_POSTER_TEXT2 = '.vg';
// or original poster text https://plus.google.com/111091089527727420853/posts/63tRxMQk7rV
ns._C_CONTENT_QUOTED_TEXT = '.Tx .vg'; // Look for gray border-left for 1st part, and then the text for 2nd
ns._C_CONTENT_EDIT = '.ko'; // Look for edit in content of any of your posts
ns.S_CONTENT_HANGOUT_TEXT = '.XD > .fe'; // https://plus.google.com/118328436599489401972/posts/d6pQ162zHZJ
ns.S_CONTENT_PHOTO_COMMENT = '.B-u-ja-ea'; // https://plus.google.com/107590607834908463472/posts/VfD8zwSq5yv
ns.S_CONTENT_PHOTO_CAPTION = '.N8 > a'; // https://plus.google.com/107590607834908463472/posts/VfD8zwSq5yv
ns.S_CONTENT_VIDEO_CAPTION = '.B-u-wa-ea'; // https://plus.google.com/115404182941170857382/posts/dnKJeydFiw5
// _C_CONTENT_LINK_TITLE:
// - photo album caption https://plus.google.com/103450266544747516806/posts/f8RKcEssKwL [limited]
// - title of shared link https://plus.google.com/103981247311324870509/posts/U1iNjkiKYrX
ns._C_CONTENT_LINK_TITLE = '.B-u-Y > a';
ns._C_CONTENT_LINK_TEXT = '.B-u-Y-j'; // Same post as _C_CONTENT_LINK_TITLE
ns._C_CONTENT_CHECKIN_LOCATION = '.Gm'; // Checkin location https://plus.google.com/111667704476323287430/posts/MBBwSZiy4nb
ns.S_CONTENT_PHOTO_TAGGED = '.xo > a.yn'; // Photo album with live updated tags https://plus.google.com/109342148209917802565/posts/6yXESEyCPtV XXX Do we need '> a' ?
// Comments
ns.S_postComments = '%postComments'; // '.zf'
ns.S_postCommentsToggler = '%postCommentsToggler'; // '.Vr';
ns.S_postCommentsTogglerCount = ns.S_postCommentsToggler + ':not([style*="none"]) ' + '%postCommentsButtonTextCountNumber'; // S_postCommentsToggler + ':not([style *= "none"]) .Fw';
ns.S_postCommentsButtonChevron_expand = '%postCommentsButtonChevron:not(%postCommentsButtonChevronWouldCollapse)'; // ns.S_postCommentsToggler + ':not(.pk) > :first-child'; // :not grayed out
ns.S_postCommentsButtonNames = '%postCommentsButtonTextNamesText'; // ns.S_postCommentsToggler + ' .xo';
ns.S_postCommentsList = '%postCommentsList'; // '.Gw'; // everything but button
ns.S_postCommentsOlderButton = '%postCommentsOlderButton'; // '.Kr';
ns.S_postCommentsOlderButton_count = ns.S_postCommentsOlderButton + ':not([style*="none"])';
ns.S_postCommentsStream = '%postCommentsStream'; // '.Xh'
ns.S_postComment = '%postComment'; // ns.S_postCommentsStream + '> div[id]'; // '.zh'; // Each comment item
ns.S_postCommentUserNames = '%postCommentUserNameA'; // ns.S_postComment + ' a[rel]'; // ns.S_postComment + ' a.Qn'; // Qn xw
ns.S_postCommentContentExpandButton = '%postCommentContentExpandButton'; // '.tg'
//ns.S_postActionBar = '%postActionBar'; // '.Bl';
ns.S_postCommentLink = '%postCommentLink'; // '.de'
ns.S_postCommentButton = '%postCommentButton'; // '.zo' // Fake box that says "Add a comment...
// Menu
ns.S_postMenuItemMute = '%postMenuItemMute'; // '.Zi'; // Zi cf. Look what's diff from other menuitems.
ns.S_postMenuItemUnmute = '%postMenuItemUnmute'; // '.Eo'; // Candidates: Eo cf; don't take inner div. Displayed on user's posts page.
ns.SL_COMMENT_CONTAINERS =
[ S_postCommentsToggler, S_postCommentsList, S_postCommentsStream ];
// G+me
ns.CN_gpmeCommentCountNoHilite = 'gpme-comment-count-nohilite';
// Usability Boost
ns._C_UBOOST_MUTELINK = '.mute_link';
ns.C_UBOOST_STAR = 'post_star';
// Circlestars
ns._C_CIRCLESTARS = '.circlestars';
// Start G+, a.k.a. SGPlus
ns.ID_SGP_POST_PREFIX = 'sgp-post-';
ns.C_SGP_UPDATE = 'sgp_update';
ns.C_SGP_UPDATE_FB = 'sgp_update_facebook';
ns.C_SGP_UPDATE_TWITTER = 'sgp_update_twitter';
ns._C_SGP_TITLE = ns.S_postHead; // Same as G+ now
ns._C_SGP_CONTENT = ns.S_postBody; // Same as G+ now (but doesn't matter coz not relevant to SGPlus posts
ns._C_SGP_TEXT1 = ns.S_postBody; // .Qy
ns._C_SGP_TEXT2 = '.ea-S-R';
//var S_SGP_ORIGPOST_LINK = 'span[style^="font-size"]';
ns._C_SGP_COMMENT = '.sgp_comments_wrapper';
ns._C_SGP_DATE = '.a-b-f-i-Ad-Ub';
// Google+ Tweaks
ns._C_TWEAK_EZMNTN = '.bcGTweakEzMntn';
}
// CSS values shared with our CSS file
var TRIANGLE_HEIGHT = 30;
var TRIANGLE_WIDTH = 17;
var RIGHT_BUTTON_AREA_OFFSET_LEFT = 20 + 4;
var POST_WRAPPER_PADDING_TOP = 6;
var POST_WRAPPER_PADDING_BOTTOM = 6;
var ITEM_LINE_HEIGHT = 22;
var ITEM_FONT_HEIGHT = 15; // Font size is 13, but height is 15
var FOLDED_ITEM_OUTER_HEIGHT_EXTRAS = 2 * (4 + 1);
var MUTED_ITEM_HEIGHT = 45;
// Other CSS values
var GBAR_HEIGHT = 30;
var GPLUSBAR_HEIGHT = 60; // This changes to 45 depending on Google+ Ultimate's options
var MAX_DIST_FROM_COPYRIGHT_TO_BOTTOM_OF_VIEWPORT = 30; // about the same as height as feedback button
var ROOM_FOR_COMMENT_AREA = 70;
// Independent CSS values that affect on this file
var GAP_ABOVE_ITEM_AT_TOP = 2;
var GAP_ABOVE_PREVIEW = 7;
var SLACK_BELOW_PREVIEW = 77; // Needed to prevent G+ from jumping page when user adds comment
var COMMENTS_TITLE_FOLDED_OUTERHEIGHT = 36;
var CARD_POSTS_CONTENT_HORIZ_PADDING = 5;
var NOTIFICATION_FRAME_WIDTH = 440;
var NOTIFICATION_FRAME_MAX_HOVERCARD_MAX_OFFSET_LEFT = 210;
// Duration of clickwall.
// NOTE: timeout must be less than jquery.hoverIntent's overTimeout, otherwise
// the preview will go away.
var clickWallTimeout = 300;
// lscache key prefixes
var LS_HISTORY_ = 'gpme_h_';
var LS_POST_ = LS_HISTORY_ + 'p';
var LS_READ = LS_POST_ + 'r_'; // Applies in list/expanded mode, but only useful in list
var LS_FOLDED = LS_POST_ + 'f_'; // Applies in expanded mode
var LS_COMMENTS_ = LS_POST_ + 'c';
var LS_COMMENTS_FOLDED = LS_COMMENTS_ + 'f_'; // Applies by default
var LS_COMMENTS_UNFOLDED = LS_COMMENTS_ + 'u_'; // Applies if comments are collapsed by default
var LS_COMMENTS_READ_COUNT = LS_COMMENTS_ + 'rc_';
var LS_COMMENTS_READ_COUNT_CHANGED = LS_COMMENTS_ + 'rcc_';
var LS_URL_LIST_LAST_UNFOLDED = LS_HISTORY_ + 'ullu_'; // Applies in list mode
var LS_CARD_POSTS = LS_CARD_POSTS + 'cp_';
// DEPRECATED: old localStorage keys
var OLD_KEYS = {
LS_FOLDED : 'gpme_post_folded_',
LS_COMMENTS_FOLDED : 'gpme_comments_folded_',
LS_COMMENTS_UNFOLDED : 'gpme_comments_unfolded_',
LS_COMMENTS_READ_COUNT : 'gpme_post_seen_comment_count_',
LS_COMMENTS_READ_COUNT_CHANGED : 'gpme_post_seen_comment_count_changed_',
LS_URL_LIST_LAST_UNFOLDED : 'gpme_post_last_open_'
};
// Animation
var JQUERY_DURATION = 400;
// How long does it take for an item to become read when looking at preview
var MARK_ITEM_AS_READ_WHEN_PREVIEW_SHOWN_DELAY = 3000;
var MARK_ITEM_AS_READ_WHEN_PREVIEW_HOVERED_DELAY = 1000;
/****************************************************************************
* Constant-like variables constructed later or over time
***************************************************************************/
var DATE_JUNK_REGEXP, DATE_LONG_REGEXP; // Due to Chrome bug, defined later, after response from background
var commentsHeightChangedClassList;
var commentsHeightChangedRegExp;
var commentsHeightChangedElementsRemaining = 0;
/****************************************************************************
* Init
***************************************************************************/
// Frame; either 'top' or 'notifications'
var frame;
// GPlusX SDK
var gpx;
// Settings, according to fancy-settings
var settings;
// Hold all the messages from background
// Workaround for http://code.google.com/p/chromium/issues/detail?id=53628
if (DEV)
var i18nMessages;
// chrome.app.getDetails() as returned from the background
var appDetails;
// list or expanded mode (like on GReader)
var displayMode;
// In list mode, an item that was opened but may need to be reclosed
// once the location.href is corrected
var $lastTentativeOpen = null;
// We track what's open so that we can close it
var $lastPreviewedItem = null;
// Timers to handle G+'s dynamic comment list reconstruction
var lastCommentCountUpdateTimers = {};
// Timer for setting an item as read within the popup preview
var markItemAsReadTimer = null;
// Cache the year
var yearRegexp = new RegExp('(,? *|[/-]?| de )' + new Date().getFullYear() + '[/-]?');
// SGPlus update timer
var sgpUpdateTimer = null;
// SGPlus cached DOM
var $sgpCachedItems = new Object();
/****************************************************************************
* Pre-created DOM elements
***************************************************************************/
function precreateElements(ns) {
//
// Inside both post and comment title
//
var $commentCountBgTpl = $('<span class="gpme-comment-count-bg"></span>');
var $commentCountFgTpl = $('<span class="gpme-comment-count-fg"></span>');
var $commentCountContainerTpl = $('<div class="gpme-comment-count-container ' + CN_gpmeCommentCountNoHilite + '"></div>').append($commentCountBgTpl).append($commentCountFgTpl).click(onCommentCountClick);
ns.$markReadButtonTpl = $('<div class="gpme-mark-read-button"></div>').click(onMarkReadClick);
ns.$muteButtonTpl = $('<div class="gpme-mute-button"></div>').click(onMuteClick);
// NOTE: order matters.
// - if commentCount comes before mutebutton, it takes precedence in clicking
// - actually, we put commentCount later, now that we have the markread button
ns.$buttonAreaTpl = $('<div class="gpme-button-area"></div>').
append($markReadButtonTpl).
append($muteButtonTpl).
append($commentCountContainerTpl);
//
// Inside item title
//
// C_TITLE is no longer necessary now that copied styles over from C_TITLE for SGPlus
//ns.$titleTpl = $('<div class="' + C_TITLE + '"></div>').click(onTitleClick);
ns.$titleTpl = $('<div class="gpme-title-clickarea"></div>').click(onTitleClick);
ns.$titleSenderTpl = $('<span class="gpme-title-sender"></span>');
ns.$titleDashTpl = $('<span class="gpme-sep"> - </span>');
ns.$titleQuoteTpl = $('<span class="gpme-sep"> + </span>');
ns.$hangoutLiveIconTpl = $('<span class="gpme-title-icons ' + CN_hangoutLiveIcon + '" style="margin-left: 5px"></span>'); //
ns.$hangoutLiveInactiveIconTpl = $('<span class="gpme-title-icons ' + CN_hangoutLiveInactiveIcon + '" style="margin-left: 5px; width: 21px"></span>'); //
// $cameraIconTpl: need container so it doesn't have the green of hover
ns.$cameraIconTpl = $('<span class="' + CN_makeChildShareIconNonHoverable + '"><span class="gpme-title-icons ' + CN_shareIconsPhoto + '" style="margin: 0 4px"></span></span>');
ns.$videoIconTpl = $('<span class="' + CN_makeChildShareIconNonHoverable + '"><span class="gpme-title-icons ' + CN_shareIconsVideo + '" style="margin: 0 4px"></span></span>');
ns.$linkIconTpl = $('<span class="' + CN_makeChildShareIconNonHoverable + '"><span class="gpme-title-icons ' + CN_shareIconsLink + '" style="margin: 0 4px"></span>');
ns.$checkinIconTpl = $('<span class="gpme-title-icons ' + CN_shareIconsLocation + '" style="margin-right: -5px;"></span>');
ns.$mobileIconTpl = $('<span class="gpme-title-icons ' + CN_shareIconsLocation + '" style="margin-left: 2px; margin-right: -3px; background-position: 0 -34px"></span>');
ns.$gameIconTpl = $('<span class="gpme-title-icons ' + CN_gplusBarNavGamesIcon + '" style="margin-left: 2px; margin-right: -3px; background-size: 80%; background-position: 0 -221px; height: 14px"></span>');
ns.$titleDateTpl = $('<span class="gpme-title-date"></span>');
ns.$titleThumbnailsTpl = $('<span class="gpme-title-thumbnails"></span>');
ns.$titleSnippetTpl = $('<span class="gpme-snippet"></span');
// ('<div class="gpme-title-folded"><div class="gpme-fold-icon">\u25cf</div></div>');
ns.$titlebarFolded = $('<div class="gpme-title-folded gpme-bar"><div class="gpme-button-area-left"><div class="gpme-circle-icon"></div></div></div>');
ns.$titlebarTpl = $('<div class="gpme-titlebar"></div>').append(
$('<div class="gpme-title-unfolded gpme-bar" style="opacity: 0">\
<div class="gpme-fold-icon gpme-fold-icon-unfolded-left">\u25bc</div>\
<div class="gpme-fold-icon gpme-fold-icon-unfolded-right">\u25bc</div>\
</div>').click(onTitleClick)).append($titlebarFolded);
//
// Inside item's guts
//
// NOTE: started using regular DOM, then switched to using jQuery; no grand master plan
// behind the dual usage.
var postWrapperTpl = document.createElement('div');
postWrapperTpl.className = 'gpme-post-wrapper';
var clickWall = document.createElement('div');
clickWall.className = 'gpme-disable-clicks';
clickWall.style.position = 'absolute';
clickWall.style.height = '100%';
clickWall.style.width = '100%';
clickWall.style.zIndex = '12'; // higher than .gpme-folded .a-f-i-Ia-D
clickWall.style.display = 'none';
var previewTriangleSpan = document.createElement('span');
previewTriangleSpan.className = 'gpme-preview-triangle';
postWrapperTpl.appendChild(clickWall);
postWrapperTpl.appendChild(previewTriangleSpan);
ns.$postWrapperTpl = $(postWrapperTpl);
/*
.hoverIntent({
handlerIn: showTopCollapseBar, // function = onMouseOver callback (REQUIRED)
delayIn: 0, // number = milliseconds delay before onMouseOver
handlerOut: hideTopCollapseBar, // function = onMouseOut callback (REQUIRED)
delayOut: 0 // number = milliseconds delay before onMouseOut
});
*/
//
// Inside item's comments title
//
var $commentSnippetTpl = $('<span class="gpme-comments-snippet"></span>');
ns.$commentTitleTpl = $('<div class="gpme-comments-title-clickarea"></div>').click(onCommentTitleClick).append($commentSnippetTpl);
ns.$commentbarTpl = $('<div class="gpme-commentbar"></div>').append(
$('<div class="gpme-comments-title-unfolded gpme-bar">\
<div class="gpme-fold-icon gpme-comments-fold-icon-unfolded gpme-comments-fold-icon-unfolded-top">\u25bc</div>\
<div class="gpme-fold-icon gpme-comments-fold-icon-unfolded gpme-comments-fold-icon-unfolded-bottom">\u25bc</div>\
</div>').click(onCommentTitleClick)).
append('<div class="gpme-comments-title-folded gpme-bar"></div>');
// append('<div class="gpme-comments-title-folded gpme-bar"><div class="gpme-fold-icon" style="visibility: hidden">\u25b6</div></div>');
//
// Inside item's comments guts
//
ns.$commentsWrapperTpl = $('<div class="gpme-comments-wrapper"></div>');
//
// Inside item bottombar
//
ns.$bottombarTpl = $('<div class="gpme-bottombar gpme-bar" style="opacity:0"></div>').append(
$('<div class="gpme-title-unfolded">\
<div class="gpme-fold-icon gpme-fold-icon-unfolded-left">\u25b2</div>\
<div class="gpme-fold-icon gpme-fold-icon-unfolded-right">\u25b2</div>\
</div>')).hoverIntent({
handlerIn: showBottomCollapseBar,
delayIn: 0,
handlerOut: hideBottomCollapseBar,
delayOut: 0
});
//
// Content Pane butotns
//
ns.$collapseAllButtonTpl = $('<span class="gpme-button-collapse-all gpme-content-button"></span>').click(foldAllItems);
ns.$expandAllButtonTpl = $('<span class="gpme-button-expand-all gpme-content-button"></span>').click(unfoldAllItems);
ns.$markAllReadButtonTpl = $('<span class="gpme-button-mark-all-read gpme-content-button"></span>').click(markAllItemsAsRead);
ns.$contentPaneButtonsTpl = $('<div class="gpme-content-buttons"></div>').
append($markAllReadButtonTpl).
append($('<div class="gpme-button-expand-or-collapse-all"></div>').
append($collapseAllButtonTpl).
append($expandAllButtonTpl));
//
// Hover cards
//
ns.$hoverCardPostsTpl = $('<tr id="gpme-card-posts" style="display:none"><td colspan=2><div id="gpme-card-posts-content" style="display:none"><div id="gpme-card-posts-recent"><div class="gpme-card-posts-loading"><div>Loading...</div></div></div><div id="gpme-card-posts-top" style="display:none"><div class="gpme-card-posts-loading"><div>Loading...</div></div></div><div id="gpme-card-posts-cloud" style="display:none"><div class="gpme-card-posts-loading"><div>Loading...</div></div></div></div></td></tr>');
}
/****************************************************************************
* Persistence
***************************************************************************/
// Memory cache of items shown by profiling to slow things down
var memcache = {
LS_COMMENTS_READ_COUNT: {},
LS_COMMENTS_READ_COUNT_CHANGED: {}
};
/**
* Gets the specified key from lscache.
* This helps in the transition period from the old scheme to the new scheme
*/
function lsGet(type, key) {
// NOTE: for efficiency, we don't strip the key in memory
if (memcache[type] && typeof memcache[type][key] != 'undefined')
return memcache[type][key];
var result = lscache.get(type + stripKey(type, key));
// Fallback to old data
if (result === null)
result = localStorage.getItem(OLD_KEYS[type] + key);
return result;
}
/**
* Sets the specified key into lscache
*/
function lsSet(type, key, value) {
// NOTE: for efficiency, we don't strip the key in memory
if (memcache[type])
memcache[type][key] = value;
lscache.set(type + stripKey(type, key), value);
//localStorage.setItem(OLD_KEYS[type] + key, value);
}
/**
* Removs the specified key from lscache
*/
function lsRemove(type, key) {
// NOTE: for efficiency, we don't strip the key in memory
if (memcache[type] && typeof memcache[type][key] != 'undefined')
delete memcache[type][key];
lscache.remove(type + stripKey(type, key));
localStorage.removeItem(OLD_KEYS[type] + key);
}
/**
* Strips key to essentials.
* 2 usages:
* - when called from ls*(), this takes a key and strips it based on the
* lscache types that we've created.
* - when called with the following special types:
* 'url': removes the scheme and domain names
* 'postId': removes the 'update-'
* This is meant to save space, but it's not useful yet as we don't write
* out many IDs.
*/
function stripKey(type, key) {
switch(type) {
case 'postId':
case LS_READ:
case LS_FOLDED:
case LS_COMMENTS_FOLDED:
case LS_COMMENTS_UNFOLDED:
case LS_COMMENTS_READ_COUNT:
case LS_COMMENTS_READ_COUNT_CHANGED:
return key.replace(/^update-/, '');
case 'url':
case LS_URL_LIST_LAST_UNFOLDED:
return key.replace(/^https:\/\/plus\.google\.com/, '');
default:
return key;
}
}
/**
* Resets persisted history
*/
function resetHistory() {
for (var i = 0; i < localStorage.length; i++) {
var storedKey = localStorage.key(i);
if (storedKey.indexOf(LS_HISTORY_) === 0) {
localStorage.removeItem(storedKey);
}
}
}
/****************************************************************************
* Utility
***************************************************************************/
/**
* Mod jQuery
*/
$.fn.reverse = [].reverse;
/**
* For debugging
*/
function info() {
if (DEBUG) {
var args = Array.prototype.slice.call(arguments);
args.unshift('g+me');
console.log.apply(console, args);
}
}
function debug() {
if (DEBUG) {
var args = Array.prototype.slice.call(arguments);
args.unshift('g+me');
console.debug.apply(console, args);
}
}
function warn() {
var args = Array.prototype.slice.call(arguments);
args.unshift('g+me');
console.warn.apply(console, args);
//console.trace();
}
function error() {
var args = Array.prototype.slice.call(arguments);
args.unshift('g+me');
console.error.apply(console, args);
console.trace();
}
/**
* Returns a function that catches exceptions to print them out to console.
* Useful for chrome event listeners and other chrome callbacks.
* Otherwise we get unhelpful messages like:
* Error in event handler for 'undefined': undefined
* @param {string=} Optional with name of function.
* @param {Function} Required function to be wrapped
* @return {Function}
*/
function wrapTryCatch(name, func) {
return function() {
if (typeof name == 'function') {
func = name;
name = undefined;
}
try {
return func.apply(undefined, arguments);
} catch (e) {
var fname = name || (func && func.name) || 'wrapTryCatch';
error(fname + ': exception bubbling up:', e, e.stack);
throw e;
}
};
}
/**
* Unescape HTML entities.
* WARNING: make sure that you add the result careful, e.g. with jQuery.text(),
* to avoid XSS security problems.
*/
function htmlDecode(str) {
return $("<div/>").html(str).text();
}
/**
* Escapes HTML entities
* http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery/374176#374176
**/
function htmlEncode(str) {
return $("<div/>").text(str).html();
}
/**
* Check if should enable on certain pages.
* @param $subtree: Optional, to force checking of DOM in cases when the
* href is not yet correct and the Ajax updates are pending
*/
function isEnabledOnThisPage($subtree) {
if (typeof $subtree == 'undefined')
return ! DISABLED_PAGES_URL_REGEXP.test(window.location.href);
return !
['%notificationsPageMarker', // gwa // Look for the notifications stream
'%sparkPageMarker', // wja // Look for 3rd div in blank one, ancestor of stream
//'%sparksPageMarker', FIXME: right now sparksPageMarker picks up sparksPageMarker as well, which is faster anyway.
'%singlePostPageMarker' // 'c-ng-L1-P'; // grandchild of #contentPane
].some(function(marker) {
if ($subtree.is(marker) || $subtree.find(marker).length) {
debug('isEnabledOnThisPage: disabling because match on page marker selector \'' + marker + '\'');
return true;
}
});
}
/**
* Shorten date text to give more room for snippet
* FIXME: English-specific
*/
function abbreviateDate(text) {
return text.replace(DATE_JUNK_REGEXP, '').replace(DATE_LONG_REGEXP, getMessage('gplus_dateLongSuffixReplacement')).replace(/ PM/, ' pm').replace(/ AM/, ' am').replace(yearRegexp, '');
}
/**
* Iterates through all the comment containers and calls the callback
*/
function foreachCommentContainer($subtree, callback) {
SL_COMMENT_CONTAINERS.forEach(function(i) {
var $container = $subtree.find(i);
if ($container.length)
callback($container);
});
}
/**
* Iterates through all the posts and calls the callback
*/
function foreachItem(callback) {
var $stream = $(S_circleStream).filter(':visible');
if (! $stream.length) {
$stream = $(S_gamesActivitiesStream).filter(':visible');
if (! $stream.length) {
error("forEachItem: Can't find stream");
return;
}
}
$stream.children(S_post).each(function(i, item) {
callback($(item));
});
}
/**
* Queries background page for options
*/
function getOptionsFromBackground(callback) {
chrome.extension.sendRequest({action: 'gpmeGetSettings'},
wrapTryCatch('getOptionsFromBackground', function(theSettings) {
settings = theSettings;
displayMode = settings.nav_global_postsDefaultMode;
// Override the built-in key with the options
var newKey = settings.apiKey;
if (newKey) {
newKey = newKey.replace(/\W/g, '');
if (newKey)
plusApiDevKey = newKey;
}
callback();
}));
}
/**
* Queries background page for extension ID
*/
function getAppDetailsFromBackground(callback) {
chrome.extension.sendRequest({action: 'gpmeGetAppDetails'},
wrapTryCatch('getAppDetailsFromBackground', function(appDetails) {
callback(appDetails);
}));
}
/**
* Returns the height of any fixed bars at the top, if
* applicable.
* This is for compatibility with other extensions.
*/
function fixedBarsHeight() {
return isGbarFixed() ? GBAR_HEIGHT + (isGplusBarFixed() ? getGplusBarHeight() : 0) : 0;
}
/**
* Returns the Gplus bar height, which changes according to Google+ Ultimate settings
* (Compatc or Ultra Compact navigation)
*/
function getGplusBarHeight() {
var $gplusbar = $(S_gplusBar);
return $gplusbar.length ? $gplusbar.height() : GPLUSBAR_HEIGHT;
}
/**
* Returns true if Gbar is fixed in place
*/
function isGbarFixed() {
var result = false;
// Detect fixed gbar for compatibility (with "Replies and more for Google+",
// Usability Boost, and Google+ Ultimate)
var $gbar = $(S_gbar);
var $gbarParent = $gbar.parent();
// Google+ now fixes the gbar using a CSS class
// XXX Temporary until Webx supports media queries
//if ($gbarParent.length && ($gbarParent.is('%gbarParentIsFixed') || $gbarParent.css('position') == 'fixed')) {
if ($gbarParent.length && (window.innerHeight >= 528 || $gbarParent.css('position') == 'fixed')) {
result = true;
} else {
// Detect for Google+ Tweaks
var styles = window.getComputedStyle($gbar.get(0));
if (styles.position == 'fixed')
result = true;
}
return result;
}
/**
* Returns true if gplus bar (the part below Gbar) is fixed in place
*/
function isGplusBarFixed() {
// Detect fixed gbar for compatibility (with "Google+ Ultimate" and "Google+ Tweaks")
var $gplusbar = $(S_gplusBar);
// XXX Temporary until Webx supports media queries
//return $gplusbar.length && ($gplusbar.is('%gplusBarIsFixed') || $gplusbar.css('position') == 'fixed');
return $gplusbar.length && (window.innerHeight >= 800 || $gplusbar.css('position') == 'fixed');
}
/**
* Returns the height of any bars at the top that would overlap
* our popup preview, i.e. anythings that's outside the #content area,
* which may overflow-hidden or have a high z-index
*/
function overlappingBarsHeight() {
var result = GBAR_HEIGHT;
// 2011-07-29 Usability Boost messes up the overflow of the content area
// to fix something that it breaks. So we have to adjust
var $content = $(S_content);
if ($content.length) {
var styles = window.getComputedStyle($content.get(0));
if (styles.overflowX == 'hidden')
result += getGplusBarHeight();
}
return result;
}
/**
* Returns the height of a folded item, i.e. gpme-title-folded
*/
function foldedItemHeight() {
return settings.nav_summaryLines * ITEM_LINE_HEIGHT + FOLDED_ITEM_OUTER_HEIGHT_EXTRAS;
}
/**
* Update the folding status maybe title of an SGP post in the cache
*/
function updateCachedSgpItem($item, $titleContent) {
var id = $item.attr('id');
if (settings.nav_compatSgp && settings.nav_compatSgpCache && id.substring(0,9) == ID_SGP_POST_PREFIX ) {
var $copy = $sgpCachedItems[id];
if (typeof $copy !== 'undefined') {
if (isItemFolded($item)) {
$copy.addClass('gpme-folded');
$copy.removeClass('gpme-unfolded');
$copy.children('gpme-post-wrapper').hide();
} else {
$copy.addClass('gpme-unfolded');
$copy.removeClass('gpme-folded');
$copy.children('gpme-post-wrapper').show();
}
if (settings.nav_compatSgpComments) {
if (areItemCommentsFolded($item)) {
$copy.addClass('gpme-comments-folded');
$copy.removeClass('gpme-comments-unfolded');
} else {
$copy.addClass('gpme-comments-unfolded');
$copy.removeClass('gpme-comments-folded');
}
}
// Preserve the popup settings
$copy.children('.gpme-post-wrapper').attr('style', $item.children('.gpme-post-wrapper').attr('style'));
if (typeof $titleContent != 'undefined') {
$copy.find('.gpme-title-folded').empty().append($titleContent.clone(true, true)).attr('gpme-has-content', 'true');
}
}
}
}
/**
* Returns height of scrollable element including hidden areas due to overflow
* From comments in http://api.jquery.com/outerHeight/
*/
jQuery.fn.outerScrollHeight = function(includeMargin) {
var element = this[0];
var jElement = $(element);
var totalHeight = element.scrollHeight; //includes padding
//totalHeight += parseInt(jElement.css("border-top-width"), 10) + parseInt(jElement.css("border-bottom-width"), 10);
//if(includeMargin) totalHeight += parseInt(jElement.css("margin-top"), 10) + parseInt(jElement.css("margin-bottom"), 10);
totalHeight += jElement.outerHeight(includeMargin) - jElement.innerHeight();
return totalHeight;
};
/*
jQuery.fn.outerScrollWidth = function(includeMargin) {
var element = this[0];
var jElement = $(element);
var totalWidth = element.scrollWidth; //includes padding
//totalWidth += parseInt(jElement.css("border-left-width"), 10) + parseInt(jElement.css("border-right-width"), 10);
//if(includeMargin) totalWidth += parseInt(jElement.css("margin-left"), 10) + parseInt(jElement.css("margin-right"), 10);
totalWidth += jElement.outerWidth(includeMargin) - jElement.innerWidth();
return totalWidth;
};
*/
function slideUpFromTop($elem, minHeight, duration, easing, callback) {
$elem.animate({height: minHeight, scrollTop: $elem.height() - minHeight}, duration, easing, function() {
$elem.css('height', '');
callback();
});
}
/* This is not symmetric with slideUpFromTop because we actually want to show users non-moving content asap
* so they can start reading while the animation is going on.
* Google+ animates the way they do because they want to show the last comment at all times.
*/
function slideDown($elem, minHeight, duration, easing, callback) {
// NOTE: actual() only works properly when element is hidden
var height = $elem.hide().actual('height');
$elem.css('display', '');
$elem.height(minHeight);
$elem.animate({height: height}, duration, easing, function() {
$elem.css('height', '');
callback();
});
}
// http://dansnetwork.com/javascript-iso8601rfc3339-date-parser/
Date.prototype.setISO8601 = function(dString) {
var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;
if (dString.toString().match(new RegExp(regexp))) {
var d = dString.match(new RegExp(regexp));
var offset = 0;
this.setUTCDate(1);
this.setUTCFullYear(parseInt(d[1],10));
this.setUTCMonth(parseInt(d[3],10) - 1);
this.setUTCDate(parseInt(d[5],10));
this.setUTCHours(parseInt(d[7],10));
this.setUTCMinutes(parseInt(d[9],10));
this.setUTCSeconds(parseInt(d[11],10));
if (d[12])
this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
else
this.setUTCMilliseconds(0);
if (d[13] != 'Z') {
offset = (d[15] * 60) + parseInt(d[17],10);
offset *= ((d[14] == '-') ? -1 : 1);
this.setTime(this.getTime() - offset * 60 * 1000);
}
} else {
this.setTime(Date.parse(dString));
}
return this;
};
/****************************************************************************
* Event Handlers
***************************************************************************/
/**
* Responds to DOM updates from G+ to handle change in status of new notifications shown to the user
*/
function onStatusUpdated(e) {
debug("onStatusUpdated");
// Since G+ animated the status count, for some reason innerHTML is set correctly whey innerText lags.
var statusCount = parseInt( e.target.innerHTML.replace(/<[^>]*?>/g, ''), 10 );
chrome.extension.sendRequest({action: 'gpmeStatusUpdate', count: statusCount});
}
/**
* Responds to user click on browser action icon
*/
function onBrowserActionClick() {
info("event: browser action icon was clicked");
click($(S_gbarToolsNotificationA));
}
/**
* Responds to changes in the history state.
* NOTE: Will not be called in PARANOID Edition
*/
function onTabUpdated() {
info("event: Chrome says that tab was updated");
// Restrict to non-single-post Google+ pages
if (!isEnabledOnThisPage())
return;
// If list mode, make sure the correct last opened entry is unfolded, now
// that we know that window.location.href is correct
if (displayMode == 'list')
unfoldLastOpenInListMode();
// If switching between Streams to Games, we need to inject the content pane buttons.
// At this time, one of the content panes will be hidden -- we need to pick out the correct
// subtree
var $contentPaneDiv = $(S_contentPane + ' > :not([style*="none"])');
updateContentPaneButtons($contentPaneDiv);
}
/**
* Responds to a reconstruction of the content pane, e.g.
* when the user clicks on the link that points to the same
* page we're already on, or when switching from About to Posts
* on a profile page.
*/
function onContentPaneUpdated(e) {
info("event: DOMNodeInserted within onContentPaneUpdated");