-
Notifications
You must be signed in to change notification settings - Fork 38
/
Extended_Steamgifts.user.js
1880 lines (1768 loc) · 82.7 KB
/
Extended_Steamgifts.user.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
// ==UserScript==
// @name Extended Steamgifts
// @description New features for Steamgifts.com
// @author Nandee
// @namespace esg
// @include *steamgifts.com*
// @version 2.4.6
// @downloadURL https://github.com/nandee95/Extended_Steamgifts/raw/master/Extended_Steamgifts.user.js
// @updateURL https://github.com/nandee95/Extended_Steamgifts/raw/master/Extended_Steamgifts.user.js
// @supportURL http://steamcommunity.com/groups/extendedsg/discussions/0/
// @icon https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/logo.png
// @homepage https://github.com/nandee95/Extended_Steamgifts
// @grant none
// @license MIT
// ==/UserScript==
/*
Changelog:
1.5.2[BETA] (2015. 03. 24.)
- First release
1.5.3[BETA] (2015. 03. 25.)
- Changed 'Miss' to 'Remove'
- Fixed enter button on profile page
- Blue line fixed behind the header
- Giveaway filter fix
- Dropdown menu fix
- Fixed Options (Scroll to top)
- Added description button
- Fixed problems with home page
- Changed some icons
1.5.4[BETA] (2015. 03. 28.)
- Fixed problems with description button
- Fixed wishlist hightlight
- Added support for SGv2 Dark Theme
- Added hide entered giveaway feaure (default disabled)
- Redesigned Recommended sales (sidebar)
- Redesigned Active discussions (sidebar)
- Small bugfixes
- Redesigned wishlist highlight
1.5.5 (2015. 07. 16.)
- Fixed font problem
- Fixed sidebar
- Fixed endless scrolling
- Fixed Wishlist - Featured giveaway problem
- Fixed chance problem with more than 1k copies giveaways
- Removed point refresh feature
- Removed recommended sales feature
- Changed icon
2.0 (2015. 11. 15.)
- Giveaway filter
- Optimized code(removed unneded parts)
- Community Voted sidebar
- Rewrited Infinite scrolling
- Added infinite scrolling everywhere
- Added [NEW] giveaway mark
- Removed Giveaway Highlighting feature(becouse of bad performance & new filter feature)
- Giveaway filtering
- Re-enabled bug reporting button
- Added Steamgifts dicussion's url & GitHub url to the menu
- Re-added refreshing points (every 60 seconds, optional, turned off by default)
2.0.1 (2015. 11. 17.)
- Fixed point updater in options
- Colored menu icons
- Fixed auto scrolling in table based pages
- Added auto scrolling to comment based pages
2.0.2 (2015. 11. 19.)
- fixed multiple pages problem
- fixed comment reply
- [FREE] giveaway mark
2.0.3 (2016. 01. 11.)
- Hide giveaway fix (no page refreshing)
2.1 (2016. 04. 17.)
- Fixed JSHint errors & warnings
- Updated auto scrolling
- Fixed ga description
- Fixed auto scrolling on entered ga page
- Updated query protocol to https
- Added floating pagination
- Fixed auto scroll loading animation
- Added MIT license
- Added readme file
- Updated About page
2.1.1 (2016. 04. 17.)
- Updated Sgv2 Dark Support
- Fixed comment writing & replying
- Fixed broken enter giveaway button
- Fixed display chances in Options
- Fixed [FREE] tag on Invite Only giveaways
- Added giveaway train option to the discussions menu
2.1.2 (2016. 04. 17.)
- Small bugfixes
- Added option to hide Active Discussions from the sidebar
2.1.3 (2016. 04. 19.)
- Fixed giveaway hiding
- Fixed Filter button disappearing
- Fixed Fiter problems with autoscroll disabled
- Modified chance calculation (just a litte bit)
- Added chances to the entered giveaway page
- Auto scroll update: utomatically fill the window with pages no need to scroll
- Added 2 new menuitems to the Discussions menu: Quizzes
- Added 2 new menuitems to the Giveaways menu: Create Quiz
- Small ESG menu modification
2.1.4 (2016. 04. 20.)
- Fixed giveaway hiding
- Small ESG menu modification
- Added Search button (giveaway list)
- Added ESG logo to the begining of the title bar (+version info)
2.1.5 (2016. 04. 21.)
- Filter Local Storage Self-Fix
- Added Giveaway Signature Generator
- Added Search urls to the Community Wishlist Titles
- Fixed broken links in ESG menu
2.1.6 (2016. 04. 24.)
- Added lever bar (included Dark Theme support)
- Added giveaway signature generator to options
- Fixed giveaway signature generator
- Fixed chances on entered page
- Fixed giveaway search url
- Fixed hide entered giveaways (/giveaways/won page)
2.2 (2016. 05. 07.)
- Sightly brighter level bar
- Added auto display images option (disabled by default)
- Added Enter all button on Wishlist page
- Added animation to the Filter menu
- Added container for giveaway signature generator (SGv2 Dark support)
- Added giveaway marks to options
- Added non-linear slider for chance filter
- Fixed click event on Entered page (Remove button)
- Fixed broken titles in the discussions sidebar
- Removed Trains from Discussions menu
- Removed Quizzes from Discussions menu
- Removed Enter button from invite only giveaways on profile page
- Remade About page
- Code cleanup
2.2.1 (2016. 05. 07.)
- Fixed copies filter
2.2.2 (2016. 05. 13.)
- Fixed giveaway search button
2.2.3 (2016. 05. 18.)
- Auto scroll rules applied if the viewed page has no pagination
- Active discussions in sidebar appears in every giveaway page
- Advanced Search
- Removed border from filter menu
- Fixed wrong dates in the changelog
2.2.4 (2016. 05. 18.)
- Removed uncompleted features
2.2.5 (2016. 05. 19.)
- Fixed broken chances on entered page
- Fixed problem with header errors
2.2.6 (2016. 05. 20.)
- Syntax fixes
- Removed Enter all button (because it's against the ToS, still available here: )
2.3 (2016. 05. 28.)
- Added advanced comment editing
- Added featured giveaway hiding option(disabled by default)
- Added embedded youtube and vimeo videos
- Added embedded gleam.io giveaways
- Added re collapsable pinned giveaways
- Added odds to chances
- Added Bundle Games to Trades menu
- Removed entered giveaway hiding from featured giveaways and user profiles
- Redesigned chances
- Redesgined level bar
- Redesigned floating pagination
- Fixed comment cancel button
- Fixed auto scroll headers
- Fixed auto scroll on Bundle Games page
- Fixed auto scroll on messages page
- Code cleanup (multiple spaces replaced with tabs, multiline strings)
2.3.1 (2016. 05. 29.)
- Fixed vimeo embedded videos
- Fixed advanced comment editor
- Added headings and horizontal reference to the comment editor
- Added comment formatting for giveaway descriptions
- Added comment editor to the new discussion and new trade pages
- Modified About page
2.3.2 (2016. 05. 29.)
- Quick fix
2.3.3 (2016. 05. 29.)
- Added chances on giveaway's page to opitions
- Added an alert when you try to remove an entry and lose points
- The urls with embedded videos not hidden anymore.
2.3.4 (2016. 12. 03.)
- Re-collapsable pinned giveaway feature has been rewritten and now works under Firefox
- Added "Write a comment" button to the floating pagination
- Removed the search button from the giveaway explorer
- Added parsedown code to the giveaway signatures
- Fixed some issues with text highlighting in the comment formatter
- Added emoticons to comment formatter
2.3.6 (2016. 12. 03.)
- Quick fix
2.3.7 (2016. 12. 04.)
- Fixed level bar with SgV2 dark theme
- Added new design to the emoticons
2.3.8 (2017. 01. 19.)
- Fixed level bar
2.3.9 (2017. 06. 29.)
- Changed classes (sg update)
2.3.10 (2017. 07. 11.)
- Fixed re-collapsable pinned giveaways after class update
2.3.11 (2017. 07. 23.)
- Fixed broken elements in sidebar (sg update)
2.3.12 (2017. 07. 30.)
- Bundled games moved to the Help menu
- Fixed z-index for the floating pagination
2.3.13 (2017. 10. 17.)
- Updated some values after sg's point system update
2.4 (2017. 10. 28.)
- Popup box to set precise copies for the filter (just click on the numbers to reach it)
- Added steam store widgets
- Removed notification about loosing points by removing entry.
- Added hidded giveaway notification on giveaway page
2.4.1 (2017. 11. 01.)
- Comment features disabled inside of tables
- Comment features performance improved
2.4.2 (2017. 11. 06.)
- Added steam activator link to the won giveaways list
2.4.3 (2018. 02. 22.)
- Removed Pledgie links
2.4.4 (2018. 05. 29.)
- Merged pull request from alpe12: Don't show enter button if level too high for you #28
2.4.5 (2019. 08. 01.)
- Removed some commented code
- Added deals to the sidebar
- Handled timeout for the enter/remove button
- Fixed some code errors
2.4.6 (2022. 12. 26)
- Fixed sidebar
*/
/* jshint multistr: true */
this.GM_getValue = function(key, def) {
return localStorage[key] || def;
};
this.GM_setValue = function(key, value) {
localStorage[key] = value;
};
var path = window.location.pathname;
//Styles
$("body").prepend(" \
<style> \
.sidebar__entry-custom \
{ \
display: inline-block; \
margin: 0 -10px 0 -10px !important; \
padding: 0 8px 0 8px !important; \
min-width: 50px; \
font-family: 'Arial',sans-serif; \
font-size: 11px; \
line-height: 26px; \
} \
.sidebar__navigation__itemz:hover .sidebar__navigation__item__underline \
{ \
border-bottom:2px solid transparent !important; \
} \
.sidebar__navigation__item__title \
{ \
font-weight:bold; \
font-size: 15px; \
} \
.sidebar__navigation__itemz \
{ \
font-size: 13px; \
} \
.filter_table \
{ \
width:100%; \
} \
.filter_table td \
{ \
padding:0; \
vertical-align: middle; \
} \
.scroll-top \
{ \
cursor: pointer; \
position: fixed; \
bottom: 10px; \
right: 40px; \
transform: rotate(-90deg); \
opacity: 0.75; \
z-index: 50; \
padding: 10px !important; \
display: block; \
} \
.page-loading \
{ \
width: 160px; \
height:24px; \
margin: 5px auto 5px auto; \
display:block; \
} \
.floating-pagination \
{ \
position:fixed; \
bottom:45px; \
width:" + $(".sidebar").width() + "px; \
text-align:center; \
z-index:99999; \
} \
.filter-content \
{ \
margin-top:10px; \
padding:5px; \
} \
.filter_table td \
{ \
padding: 2px; \
} \
.advsearch_number \
{ \
width:100px; \
} \
.e-embed-frame,.e-widget-preloader \
{ \
margin:5px 0 5px 0 !important; \
.global__image-outer-wrap; \
} \
.comment__tools \
{ \
margin-bottom:3px; \
} \
.comment__tools div \
{ \
display:inline; \
padding:5px 5px 7px 5px; \
margin:0; \
} \
.comment__tools * \
{ \
-webkit-user-select: none; \
-moz-user-select: none; \
} \
.no-user-select \
{ \
-webkit-user-select: none; \
-moz-user-select: none; \
} \
.serperator \
{ \
margin-left: 10px !important; \
} \
.advanced_search \
{ \
padding:5px 20px 5px 20px; \
} \
.filter__slider \
{ \
width:80%; \
} \
.search__slider \
{ \
margin:2px 0 2px 0; \
width:100%; \
} \
.sidebar__navigation__itemz,.sidebar__navigation__item__link,.sidebar__navigation__item__underline \
{ \
max-width:9999px !important; \
} \
</style>");
//Read some values
var xsrf = $('input[type=hidden][name=xsrf_token]').val();
var loggedin = ($('.nav__sits').length > 0) ? false : true;
var lastpage = ($(".pagination__navigation:contains('Next')").length === 0);
var currentpage = Number($('.pagination__navigation').find('.is-selected').attr('data-page-number')?$('.pagination__navigation').find('.is-selected').attr('data-page-number'):1);
var hash = $(location).attr('hash');
var ver = GM_info.script.version;
var username = $(".nav__avatar-outer-wrap").attr("href").replace("/user/", "");
var pagename = $('.page__heading__breadcrumbs:first').html();
var pagination_url = "https://" + window.location.hostname + $(".pagination__navigation").find("a:last").attr("href");
var regex_pagination_results = /Displaying <strong>([0-9]{1,10})<\/strong> to <strong>([0-9]{1,10})<\/strong>/;
var rx = (regex_pagination_results).exec($(".pagination__results").html());
var pagination_min = 0,
pagination_max = 0;
if (rx) {
pagination_min = rx[1];
pagination_max = rx[2];
}
//Funcs
function getPos(str, m, i) {
return str.split(m, i).join(m).length;
}
function updateURLParameter(url, param, paramVal) {
var newAdditionalURL = "";
var tempArray = url.split("?");
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = "";
if (additionalURL) {
tempArray = additionalURL.split("&");
for (var i = 0; i < tempArray.length; i++) {
if (tempArray[i].split('=')[0] != param) {
newAdditionalURL += temp + tempArray[i];
temp = "&";
}
}
}
var rows_txt = temp + "" + param + "=" + paramVal;
return baseURL + "?" + newAdditionalURL + rows_txt;
}
function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
}
//Custom menu elements
$(".nav__button:contains('Giveaways')").closest(".nav__button-container").find(".nav__absolute-dropdown").append(' \
<a class="nav__row" href="http://www.itstoohard.com/create" target="_blank"><i class="icon-green fa fa-fw fa-question"></i> \
<div class="nav__row__summary"><p class="nav__row__summary__name">Create quiz</p><p class="nav__row__summary__description">It\'s too hard</p></div></a> \
');
$(".nav__button:contains('Help')").closest(".nav__button-container").find(".nav__absolute-dropdown").append(' \
<a class="nav__row" href="/bundle-games"><i class="icon-red fa fa-fw fa-delicious"></i> \
<div class="nav__row__summary"><p class="nav__row__summary__name">Bundle games</p><p class="nav__row__summary__description">Full list of bundle games.</p></div></a> \
');
//Level bar
var account=$(".nav__button:contains('Account')");
var account_lv=Number($(account).find("span:nth-child(2)").attr("title"));
$(account).css("box-shadow","inset "+$(account).outerWidth()*(account_lv-Math.floor(account_lv))+"px 0 5px rgba(0,255,50,0.15)");
//ESG icon
$("header .nav__left-container").prepend('<img src="https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/logo_trans.png" height="32px" width="32px" title="Extended Steamgifts '+ver+'
By: Nandee">');
//Giveaway Signature Generator
if (path.match('^/giveaway/')&&Number(GM_getValue("esg_gsg", 1))) {
var gacode=/\/(?:.*?)\/(.*?)\/(?:.*)/.exec(path)[1];
$(".sidebar:first").append('<h3 class="sidebar__heading">Signature</h3><div class="sidebar__navigation"><div style="text-align:center"><img src="https://steamgifts.com/giveaway/'+gacode+'/signature.png" width="280px" height="53px"><br>HTML code (Websites & Blogs):<input width="280px" onclick="this.select();" value=\'<a href="https://steamgifts.com/giveaway/'+gacode+'/"><img src="https://steamgifts.com/giveaway/'+gacode+'/signature.png"></a>\'><br>BB code (Forums):<br><input width="280px" onclick="this.select();" value=\'[url=https://steamgifts.com/giveaway/'+gacode+'/][img]https://steamgifts.com/giveaway/'+gacode+'/signature.png[/img][/url]\'>Parsedown code (SteamGifts):<br><input width="280px" onclick="this.select();" value=\'![https://steamgifts.com/giveaway/'+gacode+'/](https://steamgifts.com/giveaway/'+gacode+'/signature.png)\'><br>Direct link:<br><input width="280px" onclick="this.select();" value=\'https://steamgifts.com/giveaway/'+gacode+'/signature.png\'></div></div>');
}
//Options
if (path.match('^/account/')) {
var options_selected = false,
about_selected = false;
$(".sidebar__navigation:last").after(" \
<h3 class=\"sidebar__heading\">Extended Steamgifts</h3> \
<ul class=\"sidebar__navigation\"> \
<li class=\"sidebar__navigation__item esg__options\"> \
<a class=\"sidebar__navigation__item__link\" href=\"/account/profile/sync#esg_options\"> \
<div class=\"sidebar__navigation__item__name\">Options</div> \
<div class=\"sidebar__navigation__item__underline\"></div> \
</a> \
</li> \
<li class=\"sidebar__navigation__item esg__about\"> \
<a class=\"sidebar__navigation__item__link\" href=\"/account/profile/sync#esg_about\"> \
<div class=\"sidebar__navigation__item__name\">About</div> \
<div class=\"sidebar__navigation__item__underline\"></div> \
</a> \
</li> \
</ul>");
$(".esg__options").click(display_options);
$(".esg__about").click(display_about);
if (hash == "#esg_options")
display_options();
if (hash == "#esg_about")
display_about();
}
window.onhashchange = function() {
hash = $(location).attr('hash');
if (hash == "#esg_options")
display_options();
if (hash == "#esg_about")
display_about();
};
function display_options() {
document.title = "Account - Extended Steamgifts - Options";
var page = $(".widget-container").children("div:last");
page.empty();
$(".sidebar__navigation__item").removeClass("is-selected");
$(".fa-caret-right:first").remove();
$(".esg__options").find(".sidebar__navigation__item__link").prepend("<i class=\"fa fa-caret-right\"></i>");
$(".esg__options").addClass("is-selected");
var content = "";
var count = 0;
function addToOptions(name, save, def) {
count++;
var val = Number(GM_getValue(save, def));
content += " \
<div class=\"form__row\" value=\"" + val + "\" key=" + save + "> \
<div class=\"form__heading\"><div class=\"form__heading__number\">" + count + ".</div><div class=\"form__heading__text\">" + name + "</div></div><div class=\"form__row__indent\"> \
<div class=\"form__checkbox cb__yes" + (val ? " is-selected" : "") + "\"> \
<i class=\"form__checkbox__default fa fa-circle-o\"></i><i class=\"form__checkbox__hover fa fa-circle\"></i><i class=\"form__checkbox__selected fa fa-check-circle\"></i> Enabled \
</div> \
<div class=\"form__checkbox cb__no" + (val ? "" : " is-selected") + "\"> \
<i class=\"form__checkbox__default fa fa-circle-o\"></i><i class=\"form__checkbox__hover fa fa-circle\"></i><i class=\"form__checkbox__selected fa fa-check-circle\"></i> Disabled \
</div> \
</div> \
</div> \
";
}
addToOptions("Enter/Remove button", "esg_enterremove", 1);
addToOptions("Endless scrolling", "esg_autoscroll", 1);
addToOptions("Display chances", "esg_chances", 1);
addToOptions("Fixed header", "esg_fixedheader", 1);
addToOptions("Refresh points (60sec)", "esg_refresh", 0);
addToOptions("Scroll to top button", "esg_scrolltop", 1);
addToOptions("Hide entered giveaways", "esg_hideentered", 0);
addToOptions("Active discussions in sidebar", "esg_discussions", 1);
addToOptions("Giveaway Signature Generator", "esg_gsg", 1);
addToOptions("Giveaway marks", "esg_gamark", 1);
addToOptions("Hide featured giveaway", "esg_hidefeatured", 0);
addToOptions("Comment editor", "esg_commenteditor", 1);
addToOptions("Comment features (embedded youtube & vimeo videos, gleam.io giveaways, auto load images)", "esg_comment", 1);
page.html(" \
<div class=\"page__heading\"> \
<div class=\"page__heading__breadcrumbs\"> \
<a>Extended Steamgifts</a> \
<i class=\"fa fa-angle-right\"> \
</i><a href=\"/account/profile/sync#esg_options\">Options</a> \
</div></div> \
<form> \ \
<div class=\"form__rows\">" + content + " \
<div value=\"\" class=\"form__submit-button\"><i class=\"fa fa-arrow-circle-right\"></i> Save Changes</div> \
</div> \
</div>");
$(".cb__yes").click(function() {
$(this).addClass("is-selected").removeClass("is-disabled");
$(this).parent().find(".cb__no").removeClass("is-selected").addClass("is-disabled");
$(this).closest(".form__row").attr("value", "1");
});
$(".cb__no").click(function() {
$(this).addClass("is-selected").removeClass("is-disabled");
$(this).parent().find(".cb__yes").removeClass("is-selected").addClass("is-disabled");
$(this).closest(".form__row").attr("value", "0");
});
$(".form__submit-button").click(function() {
$(".form__row").each(function() {
var val = $(this).attr("value");
var key = $(this).attr("key");
GM_setValue($(this).attr("key"), $(this).attr("value"));
});
alert("Settings are saved successfully!");
});
}
function display_about() {
document.title = "Account - Extended Steamgifts - About";
var page = $(".widget-container").children("div:last");
page.empty();
$(".sidebar__navigation__item").removeClass("is-selected");
$(".fa-caret-right:first").remove();
$(".esg__about").find(".sidebar__navigation__item__link").prepend("<i class=\"fa fa-caret-right\"></i>");
$(".esg__about").addClass("is-selected");
page.html(" \
<div class=\"page__heading\"> \
<div class=\"page__heading__breadcrumbs\"> \
<a href=\"https://www.steamgifts.com/discussion/qbPEr/\">Extended Steamgifts</a> \
<i class=\"fa fa-angle-right\"> \
</i><a href=\"/account/profile/sync#esg_about\">About</a> \
</div></div> \
<div class=\"form__rows\"><div class=\"form__row\"> \
<div class=\"form__heading\"><div class=\"form__heading__number\">1.</div><div class=\"form__heading__text\">Extended Steamgifts " + ver + "</div></div> \
<div class=\"form__row__indent markdown\">Author: Nandee<br>Copyright: © 2014-2016<br>Licensed under the <a href=\"https://github.com/nandee95/Extended_Steamgifts/blob/master/LICENSE.md\" target=\_blank\">MIT license</a><br><br>Steam group:<a href=\"http://steamcommunity.com/groups/extendedsg\">steamcommunity.com/groups/extendedsg</a> \
<br>GitHub: <a href=\"https://github.com/nandee95/Extended_Steamgifts\">github.com/nandee95/Extended_Steamgifts</a></div></div>\
<div class=\"form__row\"> \
<div class=\"form__heading\"><div class=\"form__heading__number\">2.</div><div class=\"form__heading__text\">About me:</div></div> \
<div class=\"form__row__indent\">I'm usually working on this addon in my freetime.<br>It take me a lot of time to keep it working.<br>If you like this addon please think about a donation!<br>Enjoy! :D</div></div>\
<div class=\"form__row\"> \
<div class=\"form__heading\"><div class=\"form__heading__number\">3.</div><div class=\"form__heading__text\">Donation:</div></div> \
<div class=\"form__row__indent\"> \
Thank you all for your donations! I really appreciate them! <br>\
Steam donate (tradeoffer):<br> \
<a href='https://steamcommunity.com/tradeoffer/new/?partner=95793561&token=HxnczDWg'><img src='https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/steam_donate.png' style='max-width:100%;'></a><br> \
Whitelist: \
<a href=\"https://www.steamgifts.com/user/Nandee\" target=\"_blank\"><div class=\"giveaway__columns\"><div style=\"width:130px !important\" class=\"giveaway__column--whitelist\" title=\"Whitelist\"><i class=\"fa fa-fw fa-heart\"></i> Whitelist</div></div></div> \
<div class=\"form__row\"> \
<div class=\"form__heading\"><div class=\"form__heading__number\">4.</div><div class=\"form__heading__text\">Contact:</div></div> \
<div class=\"form__row__indent markdown\"><a href=\"http://steamcommunity.com/id/nandee95\" target=\"_blank\">Steam profile</a><br><a href=\"https://www.steamgifts.com/user/Nandee\" target=\"_blank\">SteamGifts profile</a></div></div>\
</div> \
");
}
//Steam activator link
$(".icon_to_clipboard").each(function () {
if($(this).attr("data-clipboard-text").indexOf("http")!=-1) return; //Skip links
$(this).before('<a href="https://store.steampowered.com/account/registerkey?key='+$(this).attr("data-clipboard-text")+'" title="Activate key on steam"><i class="fa fa-fw fa-steam-square"></i></a>');
});
//Active Discussions
if($(".block_header_text:contains('Discussions')").length>0 && Number(GM_getValue("esg_autoscroll", 1))) {
if ($(".block_header_text:contains('Discussions')").length && Number(GM_getValue("esg_discussions", 1))) {
var c1 = "";
$(".block_header_text:contains('Discussions')").parent().parent().find(".table").find(".table__rows").find(".table__row-outer-wrap").each(function() {
var img = $(this).find(".table_image_avatar").css('background-image');
img = img.replace('url(', '').replace(')', '').replace('"', '').replace('"', '');
var otitle = $(this).find(".homepage_table_column_heading").text();
var url = $(this).find(".homepage_table_column_heading").attr("href");
var comments = $(this).find(".table__column__secondary-link").eq(0).text();
var owner = $(this).find(".table__column__secondary-link").eq(1).text();
var elapsed = $(this).find(".table__column__secondary-link").eq(0).closest("p").find("span").text();
var title = otitle;
c1 += '<li class="sidebar__navigation__itemz"> \
<a class="sidebar__navigation__item__link" href="' + url + '" title="' + otitle.replace(/\"/g,"'") + '" > \
<i class="global__image-outer-wrap global__image-outer-wrap--avatar-small"> \
<div class="global__image-inner-wrap" style="background-image:url(' + img + ');"></div></i> \
</div> \
<div class="sidebar__navigation__item__underline"> \
<div class="sidebar__navigation__item__title" style="max-width:270px;white-space: nowrap;overflow:hidden">' + title + '</div> \
<i class="fa fa-comment" style="color:white;text-shadow:0px 1px #AAB5C6, 0px -1px #AAB5C6, 1px 0px #AAB5C6, -1px 0px #AAB5C6"></i> ' + comments + '<br>\
<span style="float:right" class="sidebar__navigation__item__name"></span> \
Last post: ' + elapsed + ' ago by <span class="sidebar__navigation__item__name">' + owner + '</span> \
</div> \
</a> \
</li>';
});
$(".sidebar__navigation:last").after(' \
<h3 class="sidebar__heading">Discussions</h3> \
<ul class="sidebar__navigation"> \
' + c1 + '\
<li class="sidebar__navigation__item"> \
<a class="sidebar__navigation__item__link" href="/discussions"> \
<div class="sidebar__navigation__item__name">More discussions</div> \
<div class="sidebar__navigation__item__underline"></div> \
</a> \
</li> \
</ul> \
');
}
if ($(".block_header_text:contains('Deals')").length && Number(GM_getValue("esg_discussions", 1))) {
var c3 = "";
$(".block_header_text:contains('Deals')").parent().parent().find(".table").find(".table__rows").find(".table__row-outer-wrap").each(function() {
var img = $(this).find(".table_image_avatar").css('background-image');
img = img.replace('url(', '').replace(')', '').replace('"', '').replace('"', '');
var otitle = $(this).find(".homepage_table_column_heading").text();
var url = $(this).find(".homepage_table_column_heading").attr("href");
var comments = $(this).find(".table__column__secondary-link").eq(0).text();
var owner = $(this).find(".table__column__secondary-link").eq(1).text();
var elapsed = $(this).find(".table__column__secondary-link").eq(0).closest("p").find("span").text();
var title = otitle;
c3 += '<li class="sidebar__navigation__itemz"> \
<a class="sidebar__navigation__item__link" href="' + url + '" title="' + otitle.replace(/\"/g,"'") + '" > \
<i class="global__image-outer-wrap global__image-outer-wrap--avatar-small"> \
<div class="global__image-inner-wrap" style="background-image:url(' + img + ');"></div></i> \
</div> \
<div class="sidebar__navigation__item__underline"> \
<div class="sidebar__navigation__item__title" style="max-width:270px;white-space: nowrap;overflow:hidden">' + title + '</div> \
<i class="fa fa-comment" style="color:white;text-shadow:0px 1px #AAB5C6, 0px -1px #AAB5C6, 1px 0px #AAB5C6, -1px 0px #AAB5C6"></i> ' + comments + '<br>\
<span style="float:right" class="sidebar__navigation__item__name"></span> \
Last post: ' + elapsed + ' ago by <span class="sidebar__navigation__item__name">' + owner + '</span> \
</div> \
</a> \
</li>';
});
$(".sidebar__navigation:last").after(' \
<h3 class="sidebar__heading">Deals</h3> \
<ul class="sidebar__navigation"> \
' + c3 + '\
<li class="sidebar__navigation__item"> \
<a class="sidebar__navigation__item__link" href="/discussions/deals"> \
<div class="sidebar__navigation__item__name">More deals</div> \
<div class="sidebar__navigation__item__underline"></div> \
</a> \
</li> \
</ul> \
');
}
if ($(".block_header_text:contains('Community Poll')").length) {
var c2 = "";
var total_votes = 0;
$(".block_header_text:contains('Community Poll')").parent().parent().find(".poll")
.find(".table__rows").find(".table__row-outer-wrap").each(function() {
total_votes += Number($(this).attr("data-votes"));
});
$(".block_header_text:contains('Community Poll')").parent().parent().find(".poll")
.find(".table__rows").find(".table__row-outer-wrap").each(function() {
var img = $(this).find(".global__image-inner-wrap").css('background-image');
if(img)
img = img.replace('url(', '').replace(')', '').replace('"', '').replace('"', '');
var title = $(this).find(".table__column__heading").text();
var votes = Number($(this).attr("data-votes"));
var id = $(this).attr("data-id");
var url = $(this).find('a').attr('href');
var form = $(this).find("form");
$(form).find('.poll__vote-button').css("padding", 0).addClass('poll__vote-button-sidebar');
form = $(form).html().replace("Voted", "").replace("Vote", "");
var percent = Math.round(votes / (total_votes > 0 ? total_votes : 1) * 10000) / 100;
c2 += '<li class="sidebar__navigation__itemz table__row-outer-wrap' + ($(this).hasClass("is-selected") ? ' is-selected' : ' not-selected') + '" data-id=' + $(this).attr("data-id") + ' data-votes=' + votes + '> \
<div class="sidebar__navigation__item__link" title="' + title + '"> \
'+ (img ?'<i class="global__image-outer-wrap global__image-outer-wrap--game-small"> \
<div class="global__image-inner-wrap" style="background-image:url(' + img + ');"></div></i>' : '')+' \
<div class="sidebar__navigation__item__underline"> \
<div class="sidebar__navigation__item__title" style="width:150px;white-space: nowrap;overflow:hidden"><a target="_blank" href="' + url + '">' + title + '</a></div> \
' + votes + ' votes <br>' + percent + '%</div> <form>' + form + '</form> \
</div></li>';
});
$(".sidebar__navigation:last").after(' \
<h3 class="sidebar__heading">Community Poll</h3> \
<ul class="sidebar__navigation"> \
' + c2 + '\
</ul> \
');
}
}
//Comment editor
if(Number(GM_getValue("esg_commenteditor",1)))
{
$(".comment__submit-button").prepend("<i class='fa fa-paper-plane'></i> ");
$(".comment__description,.form__row__indent").has("textarea").prepend('<div class="comment__tools"> \
<div class="comment__submit-button" title="Italic text" type="wrap" value="*"><i class="fa fa-italic fa-fw"></i></div> \
<div class="comment__submit-button" title="Bold text" type="wrap" value="**"><i class="fa fa-bold fa-fw"></i></div> \
<div class="comment__submit-button" title="Strikethrough" type="wrap" value="~~"><i class="fa fa-strikethrough fa-fw"></i></div> \
<div class="comment__submit-button" title="Emojis" type="emoticon">😀</div> \
<div class="comment__submit-button serperator" title="List" type="list" value="* "><i class="fa fa-list-ul fa-fw"></i></div> \
<div class="comment__submit-button" title="Spoiler" type="wrap" value="~"><i class="fa fa-stop fa-fw"></i></div> \
<div class="comment__submit-button" title="Code" type="wrap" value="```"><i class="fa fa-code fa-fw"></i></div> \
<div class="comment__submit-button" title="Block quote" type="list" value="> "><i class="fa fa-quote-left fa-fw"></i></div> \
<div class="comment__submit-button" title="Horizontal reference" type="insert" value="\n---\n"><i class="fa fa-minus fa-fw"></i></div> \
<div class="comment__submit-button serperator" title="Heading 1" type="list" value="# "><i class="fa fa-header fa-fw"></i>1</div> \
<div class="comment__submit-button" title="Heading 2" type="list" value="## "><i class="fa fa-header fa-fw"></i>2</div> \
<div class="comment__submit-button" title="Heading 3" type="list" value="### "><i class="fa fa-header fa-fw"></i>3</div> \
<div class="comment__submit-button serperator" title="Insert url" type="url"><i class="fa fa-globe fa-fw"></i></div> \
<div class="comment__submit-button" title="Insert image" type="image"><i class="fa fa-image fa-fw"></i></div> \
<a href="https://www.steamgifts.com/about/comment-formatting" target="_blank"><div class="comment__submit-button serperator" title="Comment Formatting"><i class="fa fa-info fa-fw"></i></div></a> \
</div>');
$(".comment__tools .comment__submit-button[type=emoticon]").after('<div class="emoticons giveaway__column--invite-only" style="width:330px;height:170px;position:absolute;padding:5px;display:none;z-index:9999"> \
<div class="comment__submit-button" title=":)" type="insert" value="😀">😀</div> \
<div class="comment__submit-button" title=":D" type="insert" value="😃">😃</div> \
<div class="comment__submit-button" title="xD" type="insert" value="😆">😆</div> \
<div class="comment__submit-button" title="Halo" type="insert" value="😇">😇</div> \
<div class="comment__submit-button" title="Tongue" type="insert" value="😜">😜</div> \
<div class="comment__submit-button" title="In love" type="insert" value="😍">😍</div> \
<div class="comment__submit-button" title="Cool" type="insert" value="😎">😎</div> \
<div class="comment__submit-button" title="Neutral" type="insert" value="😐">😐</div> \
<div class="comment__submit-button" title="Fear" type="insert" value="😨">😨</div> \
<div class="comment__submit-button" title="Crying" type="insert" value="😭">😭</div> \
<div class="comment__submit-button" title="Zipped mouth" type="insert" value="🤐">🤐</div> \
<div class="comment__submit-button" title="Rolling" type="insert" value="🤣">🤣</div> \
<div class="comment__submit-button" title="Devil" type="insert" value="😈">😈</div> \
<div class="comment__submit-button" title="Sleeping" type="insert" value="😴">😴</div> \
<div class="comment__submit-button" title="Dizzy" type="insert" value="😵">😵</div> \
<div class="comment__submit-button" title="Doc" type="insert" value="😷">😷</div> \
<div class="comment__submit-button" title="Nerd face" type="insert" value="🤓">🤓</div> \
<div class="comment__submit-button" title="Upside down" type="insert" value="🙃">🙃</div> \
<div class="comment__submit-button" title="Money mouth" type="insert" value="🤑">🤑</div> \
<div class="comment__submit-button" title="Angry" type="insert" value="😤">😤</div> \
<div class="comment__submit-button" title="Cowboy" type="insert" value="🤠">🤠</div> \
<div class="comment__submit-button" title="Clown" type="insert" value="🤡">🤡</div> \
<div class="comment__submit-button" title="Skull" type="insert" value="💀">💀</div> \
<div class="comment__submit-button" title="Ghost" type="insert" value="👻">👻</div> \
<div class="comment__submit-button" title="Alien" type="insert" value="👽">👽</div> \
<div class="comment__submit-button" title="Poop" type="insert" value="💩">💩</div> \
<div class="comment__submit-button" title="Bit-monster" type="insert" value="👾">👾</div> \
<div class="comment__submit-button" title="Robot" type="insert" value="🤖">🤖</div> \
<div class="comment__submit-button" title="Cat" type="insert" value="😸">😸</div> \
<div class="comment__submit-button" title="Happy Cat" type="insert" value="😺">😺</div> \
<div class="comment__submit-button" title="Cat in love" type="insert" value="😻">😻</div> \
<div class="comment__submit-button" title="Crying cat" type="insert" value="😿">😿</div> \
<div class="comment__submit-button" title="Weary cat" type="insert" value="🙀">🙀</div> \
<div class="comment__submit-button" title="Kitty face" type="insert" value="🐱">🐱</div> \
<div class="comment__submit-button" title="Kitty" type="insert" value="🐈">🐈</div> \
<div class="comment__submit-button" title="Eyes" type="insert" value="👀">👀</div> \
<div class="comment__submit-button" title="Kiss" type="insert" value="💋">💋</div> \
<div class="comment__submit-button" title="Mouth" type="insert" value="👄">👄</div> \
<div class="comment__submit-button" title="Bomb" type="insert" value="💣">💣</div> \
<div class="comment__submit-button" title="Unicorn" type="insert" value="🦄">🦄</div> \
<div class="comment__submit-button" title="Goat" type="insert" value="🐐">🐐</div> \
<div class="comment__submit-button" title="Pig" type="insert" value="🐷">🐷</div> \
<div class="comment__submit-button" title="Luck" type="insert" value="🍀">🍀</div> \
<div class="comment__submit-button" title="Controller" type="insert" value="🎮">🎮</div> \
<div class="comment__submit-button" title="Santa" type="insert" value="🎅">🎅</div> \
</div>');
$(".emoticons").find(".comment__submit-button").each(function () { $(this).css("display","inline-block").css("width","32px").css("height","32px").css("padding","0") } );
$(document).on('click', '.comment__tools .comment__submit-button', function() {
var type=$(this).attr("type");
var val=$(this).attr("value");
var textarea=$(this).parent().parent().parent().find("textarea");
var text=$(textarea).val();
var before=text.substr(0,$(textarea)[0].selectionStart);
var between=text.substr($(textarea)[0].selectionStart,$(textarea)[0].selectionEnd-$(textarea)[0].selectionStart);
var after=text.substr($(textarea)[0].selectionEnd,text.length-$(textarea)[0].selectionEnd);
if(type!="emoticon") $(textarea).focus();
if(type=="emoticon")
{
$(".emoticons").toggle();
}
if(type=="url")
{
var url=prompt("Url:","http://");
if(url===null) return;
var txt=prompt("Text:","");
if(txt===null) return;
var out="["+txt+"]("+url+")";
$(textarea).val(before+out+after);
$(textarea)[0].selectionStart=before.length;
$(textarea)[0].selectionEnd=before.length+out.length;
}
if(type=="image")
{
var url2=prompt("Image url:","http://");
if(url2===null) return;
var txt2=prompt("Text:","");
if(txt2===null) return;
var out2="!["+txt2+"]("+url2+")";
$(textarea).val(before+out2+after);
$(textarea)[0].selectionStart=before.length;
$(textarea)[0].selectionEnd=before.length+out2.length;
}
if(type=="wrap")
{
$(textarea).val(before+val+between+val+after);
$(textarea)[0].selectionStart=before.length+val.length;
$(textarea)[0].selectionEnd=$(textarea)[0].selectionStart+between.length;
}
if(type=="insert")
{
$(textarea).val(before+val+after);
$(textarea)[0].selectionStart=before.length+val.length;
$(textarea)[0].selectionEnd=before.length+val.length;
}
if(type=="list")
{
var start=0;
var begin=false;
for(var i=$(textarea)[0].selectionStart;i>0;i--)
{
if(i==1) begin=true;
if(text[i]=="\n")
{
start=i;
break;
}
}
before=text.substr(0,start);
between=text.substr(start,$(textarea)[0].selectionEnd-start);
if(begin) between=val+between;
between=between.replace(/\n/g, "\n"+val);
if(before[before.length-1]=="\n") between=val+between;
$(textarea).val(before+between+after);
$(textarea)[0].selectionStart=before.length+(between[0]=='\n'?1:0);
$(textarea)[0].selectionEnd=$(textarea)[0].selectionStart+between.length;
}
});
}
//Advanced Search - Coming soon
/*
if (path.match('^/giveaways/')|| path == '/')
{
$(".sidebar__search-container").css("margin-bottom","2px");
$(".sidebar__search-container").before('<h3 class="sidebar__heading">Advanced Search</h3>');
var s_lv_min=getUrlParameter("level_min")?Math.max(Math.min(getUrlParameter("level_min"),10),0):0;
var s_lv_max=getUrlParameter("level_max")?Math.max(Math.min(getUrlParameter("level_max"),10),0):10;
var s_e_min=getUrlParameter("entry_min")?Math.max(Math.min(getUrlParameter("entry_min"),5000),0):0;
var s_e_max=getUrlParameter("entry_max")?Math.max(Math.min(getUrlParameter("entry_max"),5000),0):5000;
$(".sidebar__search-container").after('<div class="advanced_search"><form method="GET"> \
Level <span class="s_lv">' + (s_lv_min == s_lv_max ? s_lv_min : s_lv_min + " - " + s_lv_max) + '</span> \
<div class="search__slider form__slider_search--level ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"> \
<div style="width: 0%;" class="ui-slider-range ui-widget-header ui-corner-all ui-slider-range-min"></div> \
<span style="left: 0%;" class="ui-slider-handle ui-state-default ui-corner-all" tabindex="1" width="100%"> \
</span></div> \
Entry <span class="s_entries">' + (s_e_min == s_e_max ? (s_e_max==5000?"∞":s_e_max) : s_e_min + " - " + (s_e_max==5000?"∞":s_e_max)) + '</span> \
<div class="search__slider form__slider_search--entry ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"> \
<div style="width: 0%;" class="ui-slider-range ui-widget-header ui-corner-all ui-slider-range-min"></div> \
<span style="left: 0%;" class="ui-slider-handle ui-state-default ui-corner-all" tabindex="1" width="100%"> \
</span></div> \
');
$('.form__slider_search--level').slider({
range: true,
values: [s_lv_min, s_lv_max],
min: 0,
max: 10,
slide: function(event, ui) {
$(".s_lv").text(ui.values[0] == ui.values[1] ? ui.values[0] : ui.values[0] + " - " + ui.values[1]);
}
});
$('.form__slider_search--entry').slider({
range: true,
values: [s_e_min, s_e_max],
min: 0,
max: 5000,
slide: function(event, ui) {
var min=ui.values[0];
var max=ui.values[1];
if(max==5000) max="∞";
if(min==5000) min="∞";
$(".s_entries").html(min == max ? max : min + " - " + max);
}
});
}
*/
//Remove the paddings if adblock enabled
if($(".sidebar__mpu").height()<10)
$(".sidebar__mpu").hide();
if($(".leaderboard").height()<10)
$(".leaderboard").hide();
//Auto scroll
if ($(".pagination").length > 0 && Number(GM_getValue("esg_autoscroll", 1))) {
var loading = false;
$('.widget-container--margin-top').remove();
$('.giveaway__row-outer-wrap:last').parent().after('<img src="https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/loading.gif" class="page-loading"></div>');
$('.table:last').after('<br><img src="https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/loading.gif" class="page-loading"></div>');
if($(".comments__entity").length === 0) $('.comments:last').after('<br><img src="https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/loading.gif" class="page-loading"></div>');
else $('.comments__entity:last').parent().after('<br><img src="https://raw.githubusercontent.com/nandee95/Extended_Steamgifts/master/img/loading.gif" class="page-loading"></div>');
$('.page-loading').hide();
var page = currentpage;
$('.page__heading__breadcrumbs:first').append('<i class="fa fa-angle-right"></i><a href="' + window.location.href + '"> Page ' + page + '</a>');
if ($('.comment--submit').length > 0) {
$('.comment--submit').insertAfter(".page__heading:contains('Comment')");
}
$(document).on("click",".js__comment-reply-cancel",function () {
$('.comment--submit').insertAfter(".page__heading:contains('Comment')");
});
$(".sidebar").append("<span class=\"fp-mark\" height=0></span><div class=\"floating-pagination global__image-outer-wrap\">"+($(".comment--submit").length >0? '<div class="sidebar__action-button jump_to_comment no-user-select">Write a comment</div>':'') + $('.pagination').html().replace("Previous", "").replace("...", "").replace("...", "").replace("Next", "").replace("First", "").replace("Last", "") + "</div>");
$('.pagination').remove();
if ($(".fp-mark").offset().top-$(window).height()+150<$(window).scrollTop()) $(".floating-pagination").show();
else $(".floating-pagination").hide();
$(window).scroll(function() {
if ($(".fp-mark").offset().top-$(window).height()+150<$(window).scrollTop()) $(".floating-pagination").show();
else $(".floating-pagination").hide();
if (!loading && $(window).scrollTop() + $(window).height() > $(document).height() - 1000 && !lastpage) {
loading = true;
$('.page-loading').show();
var pageurl = updateURLParameter(pagination_url, "page", page + 1);
$.ajax({
url: pageurl,
success: function(source) {
lastpage = (source.indexOf('<span>Next</span>') == -1);
var mainurl;
pageurl.substring(0, pageurl.indexOf('&'));
if ($('.table').length > 0) {
$('.table:last').after('<div class="page__heading"><div class="page__heading__breadcrumbs">' + pagename + ' <i class="fa fa-angle-right"></i> <a href="' + pageurl + '">Page ' + (page + 1) + '</a></div></div><div class="table">' + $(source).find('.table').html() + '</div>');
check_entered_chances();
if(path=="/giveaways/wishlist")
{
$(".table:last").find(".table__column__heading").each(function () {
var title=$(this).html();
$(this).html("<a href=\"/giveaways/search?q="+encodeURI(title)+"\">"+title+"</a>");
});
}
} else if ($(".giveaway__row-outer-wrap").length > 0) {
$('.giveaway__row-outer-wrap:last').parent().after('<div class="page__heading"><div class="page__heading__breadcrumbs"><a href="/">Giveaways</a> <i class="fa fa-angle-right"></i> <a href="' + pageurl + '">Page ' + (page + 1) + '</a></div></div>');
$(source).find(".giveaway__row-outer-wrap:last").parent().insertAfter(".page__heading:last");
$(".giveaway__row-outer-wrap:last").parent().find(".giveaway__row-outer-wrap").format_ga().filter_ga();
} else if ($('.comments__entity').length > 0) { //messages page
$(".comments__entity:last").parent().after('<div class="page__heading"><div class="page__heading__breadcrumbs">'+pagename+' <i class="fa fa-angle-right"></i> <a href="' + pageurl + '">Page ' + (page + 1) + '</a></div></div><div>' + $(source).find('.comments__entity:first').parent().html() + '</div>');
$(".comments__entity:last").parent().find(".comment").find("div[class='comment__description markdown markdown--resize-body']").format_comment();
} else if ($('.comments').length > 0) {
$('.comments:last').after('<div class="page__heading"><div class="page__heading__breadcrumbs"><a href="' + mainurl + '">Comments </a> <i class="fa fa-angle-right"></i> <a href="' + pageurl + '">Page ' + (page + 1) + '</a></div></div><div class="comments">' + $(source).find('.comments:last').html() + '</div>');
$(".comments:last").find(".comment").find("div[class='comment__description markdown markdown--resize-body']").format_comment();
}
page++;
rx = (regex_pagination_results).exec($(source).find(".pagination__results").html());
if (rx)
pagination_max = rx[2];
$(".floating-pagination").html(($(".comment--submit").length >0? '<div class="sidebar__action-button jump_to_comment">Write a comment</div>':'') + $(source).find('.pagination').html().replace("Previous", "").replace("...", "").replace("...", "").replace("Next", "").replace("First", "").replace("Last", ""));
$(".pagination__results strong:first").html(pagination_min);
$(".pagination__results strong:nth-child(2)").html(pagination_max);
},
complete: function() {
loading = false;
$('.page-loading').hide();
$(window).trigger('scroll');
}
});
}
});
}