forked from leomoty/SGPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SGPP.user.js
19 lines (19 loc) · 67.7 KB
/
SGPP.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// ==UserScript==
// @name Steamgifts++
// @namespace https://github.com/leomoty/SGPP
// @version 0.4.9 beta
// @description SG++ for Steamgifts.com
// @author Leomoty
// @match *://www.steamgifts.com/*
// @run-at document-end
// @downloadURL https://raw.githubusercontent.com/leomoty/SGPP/master/SGPP.user.js
// @updateURL https://raw.githubusercontent.com/leomoty/SGPP/master/SGPP.meta.js
// @require https://code.jquery.com/jquery-2.1.3.min.js
// @require https://raw.githubusercontent.com/dinbror/bpopup/master/jquery.bpopup.min.js
// @resource head https://raw.githubusercontent.com/leomoty/SGPPSettings/0.4.0/head.html
// @resource settings https://raw.githubusercontent.com/leomoty/SGPPSettings/0.4.0/settings.html
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant GM_xmlhttpRequest
// ==/UserScript==
var __extends=(this&&this.__extends)||(function(){var a=Object.setPrototypeOf||({__proto__:[]} instanceof Array&&function(e,c){e.__proto__=c})||function(f,c){for(var e in c){if(c.hasOwnProperty(e)){f[e]=c[e]}}};return function(f,c){a(f,c);function e(){this.constructor=f}f.prototype=c===null?Object.create(c):(e.prototype=c.prototype,new e())}})();var ModuleDefinition;(function(b){var a=(function(){function c(){var d=this;this._LSPrefix="SGPP_";this.containsItem=function(e){return localStorage.getItem(d._LSPrefix+e)!=null};this.getItem=function(f,e){return JSON.parse(localStorage.getItem(d._LSPrefix+f)||null)||e};this.setItem=function(e,f){localStorage.setItem(d._LSPrefix+e,JSON.stringify(f))};this.clear=function(){SGPP.log("Removing all SGPP entries from LocalStorage.");Object.keys(localStorage).forEach(function(e){if(e.indexOf(d._LSPrefix)==0){localStorage.removeItem(e)}})}}return c}());b.LocalStorage=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(){function c(){var d=this;this._debug=true;this._settings=new a.Settings();this._storage=new a.LocalStorage();this.modules={};this.log=function(e){if(d._debug){console.log("["+new Date()+"] SGPP - "+e)}};this.appendCSS=function(e){d._styleSheet.append(e)};this.on=function(e,f,h){if(typeof e==="string"){d.addOnCallbackHelper(e,f,h)}else{for(var g in e){d.addOnCallbackHelper(e[g],f,h)}}};this.addGiveawayFilter=function(e){if("GiveawaysFilter" in SGPP.modules){SGPP.modules.GiveawaysFilter.addFilter(e);return true}return false};this.style="";this.init=function(){d.log("Steamgifts++ plugin started.");var e=$('.nav__button-container a[href^="/user/"]');if(e.length){d._currentUser=e.attr("href").substr("/user/".length)}d.resolvePath();d._settings.init(d._storage);d._styleSheet=$(document.createElement("style")).attr("id","SGPP_StyleSheet").appendTo("head");d.appendCSS("/* SGPP Stylesheet */ ");d.appendCSS(d._settings.style)};this.resolvePath=function(){var j="";var q="";var f="";var o="";var l="";var i=window.location;if(i.hash.length>1){j=i.hash.substring(1)}if(i.pathname=="/"){q="giveaways"}else{var n=i.pathname.split("/").filter(function(s,r,t){return Boolean(s)});q=n[0]||"";o=n[2]||"";if(n[0]=="giveaway"||n[0]=="trade"||n[0]=="discussion"||n[0]=="user"||n[0]=="group"){l=(n[3]=="search"?"":n[3])||"";f=n[1]||""}else{l=n[1]||""}}var k,h=/\+/g,p=/([^&=]+)=?([^&]*)/g,e=function(r){return decodeURIComponent(r.replace(h," "))},m=i.search.substring(1);var g={};while(k=p.exec(m)){g[e(k[1])]=e(k[2])}d._sgLocation={pageKind:q,code:f,description:o,subpage:l,hash:j,parameters:g}};this.init()}Object.defineProperty(c.prototype,"user",{get:function(){return this._currentUser},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"settings",{get:function(){return this._settings},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"location",{get:function(){return this._sgLocation},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"storage",{get:function(){return this._storage},enumerable:true,configurable:true});c.prototype.addOnCallbackHelper=function(d,e,f){if(d in SGPP.modules){SGPP.log("Handler attached on "+d+" ("+e+")");$(SGPP.modules[d]).on(e,f)}};c.prototype.name=function(){return"Core"};c.prototype.shouldRun=function(d){return true};c.prototype.render=function(){this._settings.render()};return c}());a.Core=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(c){var a=(function(){function d(){this.id="HideEntered";this.settings={hideEntered:false}}d.prototype.renderControl=function(f){var g=this;var e=$(f);this.element=$('<span><span class="fa fa-square-o"></span> <span class="filter-name">Hide Entered</span></span>');this.element.click(function(){g.settings.hideEntered=!g.settings.hideEntered;g.updateElement();$(g).trigger("filterChanged",[g.settings])});this.updateElement();e.append(this.element)};d.prototype.updateElement=function(){if(this.element){this.element.find("span.fa").toggleClass("fa-square-o",!this.settings.hideEntered).toggleClass("fa-check-square",this.settings.hideEntered)}};d.prototype.shouldHide=function(f){var e=$(f);return this.settings.hideEntered&&e.children(".giveaway__row-inner-wrap").hasClass("is-faded")};d.prototype.setState=function(e){this.settings=e;this.updateElement()};return d}());c.HideEnteredFilter=a;var b=(function(){function d(){this.style="#sidebar_sgpp_filters { color: #4B72D4; font-size: 11px; padding-bottom: 15px; }\n#sidebar_sgpp_filters .filter_row { cursor: pointer; padding: 2px; padding-left: 10px; }\n#sidebar_sgpp_filters .filter-name { font-weight: bold; } .giveaway-filtered { display:none; }";this.filters={}}d.prototype.shouldRun=function(){return SGPP.location.pageKind=="giveaways"};d.prototype.init=function(){this.addFilter(new a())};d.prototype.addFilter=function(e){var f=this;this.filters[e.id]=e;$(e).on("filterChanged",function(g,h){f.filterGames();SGPP.storage.setItem("giveaway_filter_"+e.id,h)});if(SGPP.storage.containsItem("giveaway_filter_"+e.id)){e.setState(SGPP.storage.getItem("giveaway_filter_"+e.id))}};d.prototype.render=function(){var f=this;$(".sidebar__search-container").after('<div id="sidebar_sgpp_filters"></div>');var e=$("#sidebar_sgpp_filters");e.append('<h3 class="sidebar__heading">Filter Giveaways</h3>');$.each(this.filters,function(g,j){var i=document.createElement("div");var h=$(i);h.addClass("filter_row");j.renderControl(i);e.append(i)});SGPP.on("EndlessScrollGiveaways","addItem",function(h,g){f.filterGame(g)});this.filterGames()};d.prototype.filterGames=function(){var g=this;$(".giveaway__row-outer-wrap").each(function(h,j){g.filterGame(j)});var f=$(".pinned-giveaways__outer-wrap .giveaway__row-outer-wrap").length;var e=$(".pinned-giveaways__outer-wrap .giveaway__row-outer-wrap.giveaway-filtered").length;if(f==e){$(".pinned-giveaways__outer-wrap").hide()}else{$(".pinned-giveaways__outer-wrap").show()}};d.prototype.filterGame=function(h){var f=false;var e=$(h);for(var i in this.filters){var g=this.filters[i];if(g.shouldHide(h)){f=true}}e.toggleClass("giveaway-filtered",f);$(this).trigger("gameFiltered",[h,f])};d.prototype.name=function(){return"Giveaways Filter"};return d}());c.GiveawaysFilter=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(){function c(){this.shouldRun=function(d){return d.pageKind=="giveaway"&&d.subpage==""};this.style="div.SGPP_CommAndEnter {margin: 0 0 0 5px}\n";this.init=function(){};this.render=function(){var i=$(".sidebar .sidebar__entry-insert");if(i.length===0){return}var k=$(".sidebar .sidebar__entry-delete");var e=$(".sidebar .sidebar__entry-loading");var d=$(".js__submit-form");var g=e.clone().addClass("SGPP_CommAndEnter").insertAfter(d);var h=i.clone().addClass("SGPP_CommAndEnter").text("Submit + Enter").insertAfter(d);var f=new MutationObserver(function(l){h.toggleClass("is-hidden",i.hasClass("is-hidden"));g.toggleClass("is-hidden",e.hasClass("is-hidden"))});var j={attributes:true,attributeFilter:["class"]};f.observe(i[0],j);f.observe(e[0],j);h.click(function(m){i.click();$("textarea.description").prop("disabled",true);var l=new MutationObserver(function(n){if(!k.hasClass("is-hidden")){d.closest("input[name=do]").val("comment_new");d.closest("form").submit()}});l.observe(k[0],j)})}}c.prototype.name=function(){return"Comment and Enter on Giveaways"};return c}());a.CommentAndEnter=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){var d=this;this.url="https://www.steamgifts.com/giveaway/";this.cacheCompleted=false;this.isLoading=false;this.commenters={};this.pageStart=1337;this.style=".SGPP_EntryComm {margin: 0 10px}\n.SGPP_EntryComm > i {margin: 0}\n.SGPP_EntryComm:not(.loading) > .fa-spin {display: none}\n.SGPP_EntryComm.loading > .fa-comments-o {display: none}\n.SGPP_EntryComm.active > .fa-comments-o {opacity: 0.7}\n.SGPP_EntryComm:hover > .fa-comments-o {opacity: 1}\nspan.SGPP_EntryComm_comment {vertical-align: inherit; text-shadow: none}\n.SGPP_EntryComm_disabled .SGPP_EntryComm_comment {visibility: hidden}\n.SGPP_EntryComm_comment > i.fa.fa-check, .SGPP_EntryComm_comment > i.fa.fa-times {font-size: 0.7em}\n.SGPP_EntryComm_comment > i.fa.fa-check {color: #719A47}\n.SGPP_EntryComm_comment > i.fa.fa-times {color: rgba(166, 93, 92, 0.85)}\n";this.render=function(){d.button.appendTo(".page__heading__breadcrumbs").one("click",d.firstRun)};this.firstRun=function(){if(!d.cacheCompleted){if(!d.isLoading){d.button.addClass("loading");d.isLoading=true;d.getCommenters()}setTimeout(d.firstRun,1000);return}d.button.removeClass("loading");$(".table__rows .table__column--width-fill > a").each(d.main);d.button.addClass("active");d.button.click(d.toggleState);var e=new MutationObserver(function(f){for(var g=0;g<f.length;g++){$(".table__rows").toggleClass("SGPP_EntryComm_disabled",!d.button.hasClass("active"));$(f[g].addedNodes).find(".table__column--width-fill > a").each(d.main)}});e.observe($(".table")[0],{childList:true,subtree:true})};this.toggleState=function(){d.button.toggleClass("active");$(".table__rows").toggleClass("SGPP_EntryComm_disabled",!d.button.hasClass("active"))};this.main=function(e,f){var g=$("p.table__column__heading",f);if(g.length>0){f=g[0]}if(d.commenters[f.textContent.trim()]){d.elements.pos.clone().appendTo(f)}else{d.elements.neg.clone().appendTo(f)}};this.getCommenters=function(){d.url+=SGPP.location.code+"/"+SGPP.location.description+"/search?page=";d.page=d.pageStart;d.getCommentPage()};this.getCommentPage=function(){$.ajax({type:"GET",url:d.url+d.page,success:d.handleCommentPage})};this.handleCommentPage=function(g){var e=$(g);$(".comments .comment__username",e).each(function(h,j){d.commenters[j.textContent.trim()]=true});if(d.page==d.pageStart){var f=$("a[data-page-number]",e);d.page=f.length!=0?f.last().data().pageNumber:1}if(--d.page>0){d.getCommentPage()}else{d.cacheCompleted=true}}}c.prototype.init=function(){var e=$(document.createElement("i")).addClass("giveaway__icon fa fa-comments-o").attr("title","Check who commented");var f=$(document.createElement("i")).addClass("giveaway__icon fa fa-refresh fa-spin").attr("title","Loading comments...").css("cursor","auto");this.button=$(document.createElement("span")).addClass("SGPP_EntryComm").append(e,f);var d=$(document.createElement("span")).addClass("SGPP_EntryComm_comment fa-stack").append($(document.createElement("i")).addClass("fa fa-comment-o fa-stack-1x"));var h=$(document.createElement("i")).addClass("fa fa-check fa-stack-1x");var g=$(document.createElement("i")).addClass("fa fa-times fa-stack-1x");this.elements={pos:d.clone().addClass("positive").attr("title","Commented").append(h),neg:d.clone().addClass("negative").attr("title","Did not comment").append(g)}};c.prototype.name=function(){return"Checks if entries/winners commented on Giveaways"};c.prototype.shouldRun=function(d){return d.pageKind=="giveaway"&&(d.subpage=="entries"||d.subpage=="winners")};return c}());b.EntryCommenters=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){this.style="body.SPGG_FixedNavbar {padding-top: 39px}\nheader.SPGG_FixedNavbar {position: fixed; top: 0px; width: 100%; z-index: 100}\n.comment__summary {margin-top: -44px !important; padding-top: 48px !important;}\n.comment__actions > div, .comment__actions__button {position: relative; z-index: 5;}\n.page__heading__breadcrumbs {z-index: 5;}";this.shouldRun=function(d){return true}}c.prototype.init=function(){};c.prototype.render=function(){$("body").addClass("SPGG_FixedNavbar");$("header").addClass("SPGG_FixedNavbar")};c.prototype.name=function(){return"Fixed Navbar on top"};return c}());b.FixedNavbar=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){this.style="body.SGPP_FixedFooter {padding-bottom: 45px}\n.footer__outer-wrap.SGPP_FixedFooter_outerWrap {padding: 15px 0px; z-index: 100; bottom: 0px; position: fixed; width: 100%; background: inherit}\n.footer__inner-wrap.SGPP_FixedFooter_innerWrap {margin: 0px 25px}\n";this.shouldRun=function(d){return true}}c.prototype.init=function(){};c.prototype.render=function(){$("body").addClass("SGPP_FixedFooter");$(".footer__outer-wrap").addClass("SGPP_FixedFooter_outerWrap");$(".footer__inner-wrap").addClass("SGPP_FixedFooter_innerWrap")};c.prototype.name=function(){return"Fixed Footer on bottom"};return c}());b.FixedFooter=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(){function c(){var d=this;this.shouldRun=function(e){return e.pageKind=="giveaways"&&["created","entered","won"].indexOf(e.subpage)==-1};this.style=".SGPP__gridView {display: flex; flex-wrap: wrap; justify-content: space-around; margin: 5px;}\n.tile_view_header {font-size: 12px; border-bottom: 1px solid #D2D6E0; box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.3); margin-bottom: 3px; text-align: center}\n.SGPP__gridAvatar_outer {float: right; display: inline-block; margin-left: 5px}\n.SGPP__gridAvatar {height: 27px; width: 27px}\n.SGPP__gridTile {margin: 5px}\n.SGPP__gridTile:not(:hover) .SGPP__gridTileTime {display: none}\n.SGPP__gridTile:hover {opacity: 1}\n.SGPP__gridTile:hover > .giveaway_image_thumbnail, .SGPP__gridTile:hover > .giveaway_image_thumbnail_missing {border-radius: 2px 2px 0 0}\n.SGPP__gridTile:hover > .SGPP__gridTileInfo {display: block; border-radius: 0 0 2px 2px}\n.SGPP__gridTileInfo {display: none; position:absolute; width:174px; border-width: 1px 0 0 0; border-top: 1px dotted #d2d6e0; z-index: 10}\n.SGPP__gridTileInfo .giveaway__icon {opacity: 0.7}\n.SGPP__gridTileTime {position: absolute; bottom: 0; left: 0; height: 16px; text-align: center; background-color: #FFF; border-radius: 0 3px 0 0; padding: 2px 4px}\n.SGPP__gridTileTime i {font-size: inherit; color:inherit}\n.SGPP__gridTileIcons {position: absolute; bottom: 0; right: 0}\n.SGPP__gridTileIcons > * {display: inline-block; width: 20px; height: 16px; text-align: center; padding: 2px; border-radius: 3px 0 0; vertical-align: middle}\n.SGPP__gridTileIcons > :not(:last-child) {padding-right: 4px; margin-right: -3px}\n.SGPP__gridTileIcons i {font-size: inherit; color: inherit}\n";this.init=function(){};this.render=function(){var e=$(".pagination").prev();SGPP.on("EndlessScrollGiveaways","afterAddItems",function(h,g,i,f){d.updateGridview(g)});SGPP.on("GiveawaysFilter","gameFiltered",function(h,g,i){var f=$("#"+$(g).data("gridview"));f.toggleClass("giveaway-filtered",i)});d.updateGridview(e);e.find(".giveaway__hide").click(function(){var f=$(this);setTimeout(function(){$(".popup--hide-games input[name=game_id]").val(f.parents("[data-game-id]").attr("data-game-id"));$(".popup--hide-games .popup__heading__bold").text(f.closest("h2").find(".giveaway__heading__name").text())},100)})};this.gridID=0;this.getNextGridID=function(){d.gridID++;return"sgpp_gridview_"+d.gridID};this.updateGridview=function(g){var f=g.children(".giveaway__row-outer-wrap");if(!f.length){return}$(f).hide();var e=d.generateGridview(f);g.append(e)};this.generateGridview=function(h){function k(p,n){var o=+(p/n)*100;return o<0.01?"<0.01":Math.min(o,100).toFixed(2)}var j=function(n){return"<strong>"+n+"</strong>"};var f=function(n){return $("<div>",{style:"float: left",append:n})};var g=function(n){return $("<div>",{style:"float: right",append:n})};var m=$("<div>",{"class":"SGPP__gridView"});var l=$("<div>",{"class":"SGPP__gridTile"});var e=$("<h2>",{"class":"SGPP__gridTileInfo global__image-outer-wrap"});var i=$("<div>",{"class":"SGPP__gridTileIcons"});h.find(".giveaway__row-inner-wrap").each(function(s,n){var E=$(n);if(E.parents(".pinned-giveaways").length!=0){return}var y=d.getNextGridID();E.parent().attr("data-gridview",y);var z=l.clone().toggleClass("is-faded",E.hasClass("is-faded")).toggleClass("giveaway-filtered",E.parent().hasClass("giveaway-filtered"));z.attr("id",y);z.attr("data-game-id",E.parent().attr("data-game-id"));var A=E.children(".giveaway_image_thumbnail, .giveaway_image_thumbnail_missing").appendTo(z).css("position","relative");var x=E.find(".giveaway__columns").children();var q=x.eq(0).addClass("SGPP__gridTileTime").appendTo(A);q.find("span").text(function(G,F){return F.match(/\d+(?:\s+)./)[0].replace(" ","")});var D=x.slice(2);if(D.length>0){D.filter(".giveaway__column--contributor-level").text(function(G,F){return F.replace("Level ","")});i.clone().append(D).appendTo(A)}var p=E.find(".giveaway__heading__name").text();var C=E.find(".giveaway_image_avatar").addClass("SGPP__gridAvatar");var o=E.find(".giveaway__heading__thin").toArray();var B=parseInt(o.pop().textContent.replace(/\D+/g,""));var r=o.length==0?1:parseInt(o.pop().textContent.replace(/\D+/g,""));var v=E.find(".giveaway__links").children();var u=parseInt(v.eq(0).text().replace(/\D+/g,""));var t=parseInt(v.eq(1).text().replace(/\D+/g,""));var w=k(r,u);e.clone().append($("<div>",{text:p,"class":"giveaway__heading__name tile_view_header"}),$("<div>",{"class":"SGPP__gridAvatar_outer",title:"Created "+x.eq(1).text(),append:C}),$("<div>",{style:"display: inline-block; width: 140px"}).append(f(j(r)+(r>1?" Copies":" Copy")),g(j(B+"P")),$("<div>",{style:"clear: both"}),f(j(w+"%")).attr("title","Probability to win"),g(E.find(".giveaway__icon"))),$("<div>",{style:"clear: both"}),f(j(u)+" Entries"),g(j(t)+" Comments")).appendTo(z);m.append(z)});return m}}c.prototype.name=function(){return"GridView"};return c}());a.GridView=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){this.style="";this.shouldRun=function(d){return false}}c.prototype.init=function(){};c.prototype.render=function(){};c.prototype.name=function(){return"LivePreview"};return c}());b.LivePreview=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){this.style="";this.shouldRun=function(d){return true}}c.prototype.init=function(){};c.prototype.render=function(){var j=$(".sidebar");var n=$(document.createElement("div")).addClass(j.attr("class"));var o=j.wrapInner(n).children().first().addClass("SGPP__scrollingSidebar");var m=j.find(".adsbygoogle");var h=(function(){var p;return function(q){clearTimeout(p);p=setTimeout(function(){if(q){m.stop().slideUp()}else{m.stop().slideDown()}},250)}})();var f=$(window);var l=$(".footer__outer-wrap").outerHeight();var k=$(".page__inner-wrap .widget-container");var g=$(".featured__container").height();var i=25;var e=0;if(SGPP.modules.FixedNavbar!==undefined){i+=$("header").outerHeight()}else{e+=$("header").outerHeight()}var d=function(){var p=f.scrollTop();if(p+o.height()>=k.position().top+k.height()){o.css({position:"fixed",top:"",bottom:l});h(true)}else{if(p<=g+e){o.css({position:"static",top:"",left:""});h(false)}else{o.css({position:"fixed",top:i,bottom:""}).show();h(true)}}};$(".featured__inner-wrap .global__image-outer-wrap img").on("load",function(){g=$(".featured__container").height();d()});d();$(document).scroll(d)};c.prototype.name=function(){return"Scrolling Sidebar"};return c}());b.ScrollingSidebar=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){var d=this;this._lsSettings={};this.style=".SGPP__settings { cursor: pointer; }\n";this.settingsNavIcon='<a class="nav__row SGPP__settings" href="/sgpp">\n<i class="icon-red fa fa-fw fa-bars"> </i>\n<div class="nav__row__summary">\n<p class="nav__row__summary__name" > SG++ Settings</p>\n<p class="nav__row__summary__description"> Steamgifts++ settings.</p>\n</div>\n</a>\n';this.init=function(e){d._lsSettings=e.getItem(b.Settings.SETTINGS_KEY,{});if(window.location.pathname=="/sgpp"){unsafeWindow.window["$"]=$;$("head").html(GM_getResourceText("head"));$("body").html(GM_getResourceText("settings"))}};this.render=function(){if(SGPP.location.pageKind!="sgpp"){$(".nav__absolute-dropdown div[data-form^='do=logout']").before(d.settingsNavIcon)}else{$(".SGPP__form__checkbox").each(function(e,h){var i=$(h);var g=i.attr("name");if(i.parent(".SGPP__Module").length){i.prop("checked",d.isModuleEnabled(g))}else{var f=i.closest(".form__row").find(".SGPP__Module input").attr("name");i.prop("checked",d.getSettingForModule(f,g)||false)}});$(".SGPP__form__checkbox").on("click",function(j){var i=$(j.target);var g=i.prop("checked");if(i.parent(".SGPP__Module").length){var f=i.attr("name");if(d._lsSettings.hasOwnProperty(f)){d._lsSettings[f].enabled=g}else{d._lsSettings[f]={enabled:g}}}else{var f=i.closest(".form__row").find(".SGPP__Module input").attr("name");var h=i.attr("name");if(!d._lsSettings.hasOwnProperty(f)){d._lsSettings[f]={enabled:false}}d._lsSettings[f][h]=g}d.persistSettings()})}};this.shouldRun=function(e){return true};this.isModuleEnabled=function(e){return d._lsSettings.hasOwnProperty(e)&&d._lsSettings[e].enabled};this.getSettingForModule=function(e,f){return !d._lsSettings.hasOwnProperty(e)?null:d._lsSettings[e][f]};this.persistSettings=function(){SGPP.storage.setItem(b.Settings.SETTINGS_KEY,d._lsSettings)}}c.prototype.name=function(){return"Settings"};return c}());a.SETTINGS_KEY="Settings";b.Settings=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(){function c(){this.style='.SGPP_UserInfo_balloon {position: absolute; border: solid 2px black; z-index: 99; min-width: 200px; border-radius: 3px; min-height: 100px; background-color: inherit}\n.SGPP_UserInfo_balloon:after {position: absolute; right: 100%; top: 5px; content: ""; height: 0; width: 0; border-style: solid; border-color: transparent black; border-width: 15px 20px 15px 0px}\n.SGPP_UserInfo_balloon.right:after {right: -20px; border-width: 15px 0 15px 20px}\n.SGPP_UserInfo_balloon .featured__outer-wrap.featured__outer-wrap--user {width: auto; padding: 15px 0}\n.SGPP_UserInfo_balloon .featured__heading i {font-size: inherit}\n.SGPP_UserInfo_balloon .featured__table__column {width: 175px}\n.SGPP_UserInfo_balloon .featured__table .featured__table__row {padding: 5px 0px}\n.SGPP_UserInfo_balloon .featured__table__column:not(:first-child) {margin-left: 15px}\n.SGPP_UserInfo_balloon .featured__outer-wrap .global__image-outer-wrap {float: left; margin: 7px 7px 0px 0px; padding: 2px}\n.SGPP_UserInfo_balloon .SGPP_UserOnline {background: linear-gradient(to bottom, #8FB93B 5%, #6E8C31 95%) repeat scroll 0% 0% transparent}\n.SGPP_UserInfo_balloon .SGPP_UserOffline {background: linear-gradient(to bottom, rgba(106, 106, 106, 0.45) 5%, rgba(85, 85, 85, 1) 95%) repeat scroll 0% 0% transparent}\n.SGPP_UserInfo_balloon .sidebar__shortcut-inner-wrap {width: 130px; color: rgba(255, 255, 255, 0.4)}\n.SGPP_UserInfo_balloon .sidebar__shortcut-inner-wrap > * {line-height: 10px; text-shadow: none; background: none; border: none}\n.SGPP_UserInfo_balloon .sidebar__shortcut-inner-wrap > .is-selected, .SGPP_UserInfo_balloon .sidebar__shortcut-inner-wrap > :hover, .SGPP_UserInfo_balloon .sidebar__shortcut-inner-wrap > :active {background: none; text-shadow: none; box-shadow: none}\n';this.shouldRun=function(d){return true}}c.prototype.init=function(){};c.prototype.render=function(){function f(o){var j=$(".featured__outer-wrap.featured__outer-wrap--user",o);var k=$(".featured__table__row",j);var m=$(".featured__heading",j).css("display","block");var p=$(".global__image-outer-wrap",j).prependTo(m).css({width:"48px",height:"48px","box-sizing":"content-box"});p.children().css("background-size","cover");var l=k.eq(1).children().last().text().trim();if(l.toLowerCase().indexOf("online")>-1){p.attr("title",l).addClass("SGPP_UserOnline")}else{p.attr("title","Online "+l).addClass("SGPP_UserOffline")}k.eq(1).remove();var n=k.last().children().last();n[0].title="Contributor Value: "+$("span",n)[0].title;$("span",n).removeAttr("title");n.appendTo(m);k.last().remove();var i=$(".sidebar__shortcut-inner-wrap",o).insertAfter(n);i.children().eq(2).click(function(){$(this).find("form").submit()});var q=$(".sidebar__suspension",o);if(q.length>0){$("<span>",{style:"color: #B16C86",text:" ("+q.text().trim()+")",title:$(".sidebar__suspension-time",o).text()}).appendTo(k.eq(0).children().last())}return j}var e=$("<div>",{id:"SGPP_UserInfo_balloon","class":"SGPP_UserInfo_balloon"}).appendTo("body").hide();var d={};var h=$("<div>",{style:"color: black"}).append($("<i>",{"class":"fa fa-refresh fa-spin fa-4x",style:"margin: 30px 80px; font-size: 4em; color: #6B7A8C"}));e.append(h);e.hover(function(){e.stop(true).fadeIn("fast")},function(){g.close()});var g={timeout:null,run:function(i,k,j){clearTimeout(this.timeout);this.timeout=setTimeout(function(){e.css(k);e.children().remove();if(j){e.addClass("right")}else{e.removeClass("right")}var l=i.match(/\/user\/(.+?)(?:\/|$)/)[1];if(l!==undefined&&l in d){e.append(d[l]).stop(true).show()}else{e.append(h).stop(true).show();$.ajax({url:i,type:"GET",dataType:"html",success:function(m){var n=f(m).data("user",l);d[l]=n;e.children().remove();e.append(n)}})}},1500)},close:function(){clearTimeout(this.timeout);e.stop(true).delay(500).fadeOut("slow")}};$(document).on({mouseenter:function(m){var k=$(m.target);if(k.attr("href").split("/").length>3||k.prop("href")==document.URL){return}var n=k.offset();var l;var i=$(window).width();var j=m.target.getBoundingClientRect().left>i/2;if(j){l={top:n.top+(k.height()/2)-25,right:i-n.left+20,left:""}}else{l={top:n.top+(k.height()/2)-25,right:"",left:n.left+k.width()+20}}g.run(k.attr("href"),l,j)},mouseleave:function(){g.close()}},'a[href^="/user/"]:not(.nav__avatar-outer-wrap)')};c.prototype.name=function(){return"Show User Profile on Hover"};return c}());a.UserHoverInfo=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function d(k){var j=this;this.background=$("<div>",{"class":"SGPP__tagModal_background"}).appendTo("body");this.content=$("<div>",{"class":"SGPP__tagModal popup"}).appendTo("body");this.config=[];this.update=function(m,l){j.$name.text(m);for(var n=0;n<j.config.length;n++){j.config[n].val(l[n])}return j};this.show=function(){j.background.show();j.content.show();return j};this.hide=function(){j.background.hide();j.content.hide();return j};this.save=function(){var l=[];for(var m=0;m<j.config.length;m++){l.push(j.config[m].val())}j.callback(j.$name.text(),l);return j.hide()};this.callback=k;$("<i>",{"class":"popup__icon fa fa-tag"}).appendTo(this.content);$("<p>",{"class":"popup__heading",append:["Edit custom tag for ",this.$name=$("<span>",{"class":"popup__heading__bold"}),":"]}).appendTo(this.content);var e=$("<div>",{"class":"SGPP__tagOptions"}).appendTo(this.content);var h=function(l,m){var i=$("<input>",{type:m});j.config.push(i);return $("<div>").append($("<span>",{"class":"form__heading__text",text:l}),i)};var f=[["Tag text","text"],["Background color","color"],["Text color","color"]];for(var g=0;g<f.length;g++){e.append(h(f[g][0],f[g][1]))}$("<div>",{"class":"popup__actions"}).appendTo(this.content).append($("<span>",{text:"save",click:this.save}),$("<span>",{text:"cancel",click:this.hide}));this.background.click(this.hide);this.hide()}return d}());var c=(function(){function d(){var e=this;this.style='.SGPP__tagIcon {margin-left: 5px; transform: rotate(-45deg); opacity: 0.35; cursor: pointer; text-shadow: none}\n.SGPP__tagIcon:hover {opacity: 0.7}\n.comment__username--op .SGPP__tagIcon {color: #FFF}\n.SGPP__userTag {display: inline-block; color: #465670; background-color: #FFF; font-weight: initial; text-shadow: none; padding: 0 4px; border-radius: 3px; border: 1px solid #D2D6E0; line-height: normal; margin-left: 5px; cursor: pointer}\n.SGPP__tagModal_background {position: fixed; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(60, 66, 77, 0.85); cursor: pointer; z-index: 9998}\n.SGPP__tagModal {display: block; position: fixed; top: 50px; left: 50%; width: 300px; margin-left: -250px; z-index: 9999}\n.SGPP__tagModal .popup__icon {width: 48px; text-indent: 5px}\n.SGPP__tagOptions {margin-bottom: 15px}\n.SGPP__tagOptions > div {display: flex; justify-content: space-between}\n.SGPP__tagOptions > div > input {width: 125px; height: 30px;}\n.SGPP__tagOptions > div :not(:first-child) { margin-top: 5px;}\n.SGPP__tagOptions .popup__actions {margin-top: 15px}\n.SGPP__tagOptions > div > span { line-height: 35px;}\n.SGPP__tagOptions > div > input[type="color"] { padding: 3px 6px;}\n';this.render=function(){e.tagConfigModal=new a(e.updateTags);var f=$('a[href^="/user/"]:not(.global__image-outer-wrap, .nav__avatar-outer-wrap)');e.usertagsCache=SGPP.storage.getItem("createdTags",{});f.each(function(h,j){var g=$(j).prop("pathname").split("/");var k=j.textContent.trim();if(g.length!=3||g[2]!=k){return}else{e.createTag(k).insertAfter(j)}});$("body").on("click",".SGPP__tagIcon, .SGPP__userTag",function(i){var h=$(i.target).siblings('a[href^="/user/"]').text();if(h in e.usertagsCache){var g=e.usertagsCache[h]}else{var g=["","#FFFFFF","#465670"]}e.tagConfigModal.update(h,g).show()})};this.shouldRun=function(f){return["about","sales","legal","roles"].indexOf(f.pageKind)<0};this.createTag=function(g){if(g in e.usertagsCache){var f=e.usertagsCache[g];return $("<div>",{text:f[0],"class":"SGPP__userTag",css:{backgroundColor:f[1],color:f[2]}})}else{return $("<i>",{"class":"fa fa-tag SGPP__tagIcon"})}};this.updateTags=function(f,g){if(g[0]===""){delete e.usertagsCache[f]}else{e.usertagsCache[f]=g}SGPP.storage.setItem("createdTags",e.usertagsCache);console.log(1,f);$('a[href="/user/'+f+'"]').each(function(j,k){var h=$(k).siblings(".SGPP__userTag, .SGPP__tagIcon");if(h.length===0){return}else{h.remove();e.createTag(f).insertAfter(k)}})}}d.prototype.init=function(){};d.prototype.name=function(){return"Custom Tags to Users"};return d}());b.UserTags=c})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var c=(function(){function d(e){this._isDataStored=false;this.localStorageKey="endless_scroll_"+e;if(this.localStorageKey in localStorage){this._obj=JSON.parse(localStorage[this.localStorageKey]);if(!("numberOfComments" in this._obj)){this._obj.numberOfComments=0}if(!("lastSeenPage" in this._obj)){this._obj.lastSeenPage=0}if(!("collapsed" in this._obj)){this._obj.collapsed={}}this._isDataStored=true}else{this._obj={lastVisit:Date.now(),lastCommentIDPages:{},collapsed:{},numberOfComments:0}}}Object.defineProperty(d.prototype,"isDataStored",{get:function(){return this._isDataStored},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"lastVisit",{get:function(){return this._obj.lastVisit},enumerable:true,configurable:true});d.prototype.getNumComments=function(){return this._obj.numberOfComments};d.prototype.setCommentState=function(f,e){if(!e){delete this._obj.collapsed[f]}else{this._obj.collapsed[f]=1}this.save()};d.prototype.getCommentState=function(e){return e in this._obj.collapsed};d.prototype.setLastVisit=function(){this._obj.lastVisit=Date.now();this.save()};d.prototype.setLastSeenPage=function(e){this._obj.lastSeenPage=e;this.save()};d.prototype.setLastCommentID=function(g,f,e){this._obj.lastCommentIDPages[g]=f;this._obj.numberOfComments=e;this.save()};d.prototype.isNewComment=function(f,e){if(f in this._obj.lastCommentIDPages){return(e>this._obj.lastCommentIDPages[f])}else{return true}};d.prototype.forget=function(){if(this.localStorageKey in localStorage){localStorage.removeItem(this.localStorageKey)}};d.prototype.save=function(){localStorage[this.localStorageKey]=JSON.stringify(this._obj)};return d}());var b=(function(){function d(){this.style=".endless_new .comment__parent .comment__summary, .endless_new > .comment__child{}.endless_not_new .comment__parent .comment__summary, .endless_not_new > .comment__child{}.endless_not_new:hover .comment__parent .comment__summary, .endless_not_new:hover > .comment__child{}.endless_badge_new, .endless_badge_new_child {border-radius: 4px; margin-left:5px; padding: 3px 5px; background-color: #C50000;text-shadow: none;color: white; font-weight: bold;}.endless_badge_new_child { display: none; }.comment--collapsed .endless_badge_new_child { display: block; }\n.table__row-outer-wrap .markcomments_controls { display: none; }\n.table__row-outer-wrap:hover .markcomments_controls { display: inline; }.markcomments_controls i { opacity: 0.5; cursor: pointer; }\n.markcomments_controls i:hover { opacity: 1; }"}Object.defineProperty(d.prototype,"topic",{get:function(){return this.topicInfo},enumerable:true,configurable:true});d.prototype.getDiscussionId=function(f){var e=/(discussion|trade)\/([^/]+)(\/|$)/.exec(f);if(!e){throw"No Discussion ID"}return e[1]+"_"+e[2]};d.prototype.getLatestCommentID=function(e){var f=0;$(e).find(".comment[data-comment-id]").each(function(g,h){var j=parseInt($(h).data("comment-id"));if(j>f){f=j}});return f};d.prototype.shouldRun=function(){return true};d.prototype.init=function(){};d.prototype.render=function(){var h=this;if(SGPP.location.pageKind=="discussion"||SGPP.location.pageKind=="trade"){this.topicInfo=new c(this.getDiscussionId(location.pathname));var f=1;var g=$("div.pagination__navigation a.is-selected");if(g.length!=0){f=g.first().data("page-number")}this.markComments($(document),f,true);this.topicInfo.setLastVisit();var e=this;$("body").on("click",".comment__collapse-button",function(){var k=$(this);var j=k.parents(".comment");var i=parseInt(j.data("comment-id"));e.topicInfo.setCommentState(i,true)});$("body").on("click",".comment__expand-button",function(){var k=$(this);var j=k.parents(".comment");var i=parseInt(j.data("comment-id"));e.topicInfo.setCommentState(i,false)});SGPP.on("EndlessScrollDiscussionReplies","beforeAddItems",function(j,l,k,i){h.markComments(l,k,true,i)})}else{if(SGPP.location.pageKind=="discussions"||SGPP.location.pageKind=="trades"){this.markTopics($(document));var e=this;$("body").on("click",".markcomments_forget",function(){var l=$(this);var i=l.parents("h3");var j=i.children("a");var k=new c(e.getDiscussionId(j.attr("href")));k.forget();i.find(".endless_badge_new").remove();l.remove()});SGPP.on("EndlessScrollDiscussion","beforeAddItems",function(j,l,k,i){h.markTopics(l)})}else{if(SGPP.location.pageKind=="giveaways"&&SGPP.location.subpage==""){this.markTopics($(".widget-container").last().prev().prev())}}}};d.prototype.checkNewComments=function(g,f){var h=this;var e=false;$(g).find(".comment[data-comment-id]").each(function(j,k){var l=parseInt($(k).data("comment-id"));if(h.topicInfo.isNewComment(f,l)){e=true}});return e};d.prototype.markComments=function(i,g,h,e){var j=this;if(h===void 0){h=false}if(e===void 0){e=false}if(this.topicInfo.isDataStored||e){i.find(".comment[data-comment-id]").each(function(k,l){var o=parseInt($(l).data("comment-id"));var n=j.topicInfo.isNewComment(g,o);var m=j.topicInfo.getCommentState(o);if(m){$(l).addClass("comment--collapsed")}if(n){$(l).addClass("endless_new");$(l).find(".comment__username").first().after($("<span>").addClass("endless_badge_new").text("New").attr("title","New since last visit"))}else{$(l).addClass("endless_not_new")}if(j.checkNewComments(l,g)){if(!n){$(l).find(".comment__username").first().after($("<span>").addClass("endless_badge_new_child").text("New replies").attr("title","New since last visit"))}$(l).addClass("endless_new_children")}else{$(l).addClass("endless_no_new_children")}})}if(h){var f=parseInt($(".comments:eq(1)").prev().find("a").text().split(" ")[0].replace(",",""));this.topicInfo.setLastCommentID(g,this.getLatestCommentID(i),f)}};d.prototype.markTopics=function(e){var f=this;e.find(".table__row-outer-wrap").each(function(k,l){try{var n=$(l).find("h3 a").first();var o=new c(f.getDiscussionId(n.attr("href")));if(SGPP.settings.getSettingForModule("EndlessScrollDiscussionReplies","reversedDiscussionReplies")||false){n.attr("href",n.attr("href")+"/search?page=31337")}if(o.isDataStored){var h=parseInt($(l).find(".table__column--width-small a.table__column__secondary-link").text().replace(",",""));var g=o.getNumComments();var j=h-g;if(j>0){$(l).addClass("endless_new_comments");if(true){n.after($("<span>").addClass("endless_badge_new").text(j).attr("title",j+" new comments since last visit"))}else{$(l).find(".table__column--width-fill > p").first().append(" - <strong>"+j+" new comments</strong>")}}else{$(l).addClass("endless_no_new_comments");$(l).find(".table__column--width-fill > p").first().append(" - no new comments</strong>")}$(l).find("h3").first().append('<span class="markcomments_controls pull-right"><i class="fa fa-remove markcomments_forget" title="Forget this topic"></i></span>')}}catch(m){}})};d.prototype.name=function(){return"Mark Comments"};return d}());a.MarkComments=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(d){var e=(function(){function f(g){this.id="HideIgnored";this.settings={hide:false};this.module=g}f.prototype.renderControl=function(h){var i=this;var g=$(h);this.element=$('<span><span class="fa fa-square-o"></span> <span class="filter-name">Hide Not Interested</span></span>');this.element.click(function(){i.settings.hide=!i.settings.hide;i.updateElement();$(i).trigger("filterChanged",[i.settings])});this.updateElement();g.append(this.element)};f.prototype.updateElement=function(){if(this.element){this.element.find("span.fa").toggleClass("fa-square-o",!this.settings.hide).toggleClass("fa-check-square",this.settings.hide)}};f.prototype.shouldHide=function(i){var h=$(i);var j=h.find("a.giveaway__icon").attr("href");var g=this.module.parseAppLink(j);return this.settings.hide&&this.module.ignores(j)};f.prototype.setState=function(g){this.settings=g;this.updateElement()};return f}());d.HideIgnored=e;var b=(function(){function f(g){this.id="HideOwned";this.settings={hide:false};this.module=g}f.prototype.renderControl=function(h){var i=this;var g=$(h);this.element=$('<span><span class="fa fa-square-o"></span> <span class="filter-name">Hide Owned</span></span>');this.element.click(function(){i.settings.hide=!i.settings.hide;i.updateElement();$(i).trigger("filterChanged",[i.settings])});this.updateElement();g.append(this.element)};f.prototype.updateElement=function(){if(this.element){this.element.find("span.fa").toggleClass("fa-square-o",!this.settings.hide).toggleClass("fa-check-square",this.settings.hide)}};f.prototype.shouldHide=function(i){var h=$(i);var j=h.find("a.giveaway__icon").attr("href");var g=this.module.parseAppLink(j);return this.settings.hide&&this.module.owns(j)};f.prototype.setState=function(g){this.settings=g;this.updateElement()};return f}());d.HideOwned=b;var c=(function(){function f(g){this.id="HighlightWishlist";this.settings={highlight:false};this.module=g}f.prototype.renderControl=function(h){var i=this;var g=$(h);this.element=$('<span><span class="fa fa-square-o"></span> <span class="filter-name">Show only wishlisted</span></span>');this.element.click(function(){i.settings.highlight=!i.settings.highlight;i.updateElement();$(i).trigger("filterChanged",[i.settings])});this.updateElement();g.append(this.element)};f.prototype.updateElement=function(){if(this.element){this.element.find("span.fa").toggleClass("fa-square-o",!this.settings.highlight).toggleClass("fa-check-square",this.settings.highlight)}};f.prototype.shouldHide=function(h){var g=$(h);var i=g.find("a.giveaway__icon").attr("href");return this.settings.highlight&&!this.module.wishlisted(i,false)};f.prototype.setState=function(g){this.settings=g;this.updateElement()};return f}());d.HighlightWishlist=c;var a=(function(){function f(){this.style='.wishlisted-giveaway .giveaway__heading__name, .wishlisted-giveaway .featured__heading__medium { background: url("data: image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAABi8KSDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/ IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8 + IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QTM3OEVDNTUyMUM0MTFFNDgxN0ZEN0MzNjYzNzcxOTYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTM3OEVDNTYyMUM0MTFFNDgxN0ZEN0MzNjYzNzcxOTYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBMzc4RUM1MzIxQzQxMUU0ODE3RkQ3QzM2NjM3NzE5NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBMzc4RUM1NDIxQzQxMUU0ODE3RkQ3QzM2NjM3NzE5NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI / Ps9jzFQAAACPSURBVHjaYvz//z+DkJDQdQYGhpsMCMAKxMZAHPXu3bt9cFGQYkFBwQ0gGoaBfAEgzgfibUDsBxNnYsAOfgKxJBBvAeIZMEEWZBVA52xA5gOdUAEUc8NQDBTkBEoGMOAByCYLAjUsRzM5AKtioMQzIEW0ydjcHIBTMSE3M0Ij5RKQfQ6HGiOgIXogBkCAAQDGVT+0v+n6EQAAAABJRU5ErkJggg==") no-repeat scroll 2px center; padding-left: 15px; }';this.userdata={rgWishlist:[],rgOwnedPackages:[],rgOwnedApps:[],rgPackagesInCart:[],rgAppsInCart:[],rgRecommendedTags:[],rgIgnoredApps:[],rgIgnoredPackages:[]};this.blacklistData={apps:[],subs:[]}}f.prototype.shouldRun=function(){return true};f.prototype.init=function(){SGPP.addGiveawayFilter(new e(this));SGPP.addGiveawayFilter(new b(this));SGPP.addGiveawayFilter(new c(this));if(!SGPP.storage.containsItem("steam_userdata")||!SGPP.storage.containsItem("steam_userdata_date")||SGPP.storage.getItem("steam_userdata_date")<(Date.now()-12*60*60*1000)){this.refreshGamesFromSteam()}if(!SGPP.storage.containsItem("blacklist_data")||!SGPP.storage.containsItem("blacklist_date")||SGPP.storage.getItem("blacklist_date")<(Date.now()-12*60*60*1000)){this.refreshBlacklistFromSG()}if(SGPP.storage.containsItem("steam_userdata")){this.userdata=SGPP.storage.getItem("steam_userdata")}if(SGPP.storage.containsItem("steam_userdata")){this.blacklistData=SGPP.storage.getItem("blacklist_data")}};f.prototype.owns=function(h){var g=this.parseAppLink(h);if(!g){return null}if(g[0]=="app"){return this.ownsApp(g[1])}else{if(g[0]=="sub"){return this.ownsApp(g[1])}}};f.prototype.ownsApp=function(g){return this.userdata.rgOwnedApps.indexOf(g)!==-1};f.prototype.ownsPackage=function(g){return this.userdata.rgOwnedPackages.indexOf(g)!==-1};f.prototype.ignores=function(h){var g=this.parseAppLink(h);if(!g){return false}if(g[0]=="app"){return this.ignoresApp(g[1])}else{if(g[0]=="sub"){return this.ignoresPackage(g[1])}}};f.prototype.blacklisted=function(h){var g=this.parseAppLink(h);if(!g){return false}if(g[0]=="app"){return this.blacklistedApp(g[1])}else{if(g[0]=="sub"){return this.blacklistedSub(g[1])}}};f.prototype.blacklistedApp=function(g){return this.blacklistData.apps.indexOf(g)!==-1};f.prototype.blacklistedSub=function(g){return this.blacklistData.subs.indexOf(g)!==-1};f.prototype.ignoresApp=function(g){return this.userdata.rgIgnoredApps.indexOf(g)!==-1};f.prototype.ignoresPackage=function(g){return this.userdata.rgIgnoredPackages.indexOf(g)!==-1};f.prototype.wishlisted=function(h,i){if(i===void 0){i=true}var g=this.parseAppLink(h);if(!g){return false}if(g[0]=="app"){return this.isWishlisted(g[1])}else{if(g[0]=="sub"){return !i}}};f.prototype.isWishlisted=function(g){return this.userdata.rgWishlist.indexOf(g)!==-1};f.prototype.parseAppLink=function(h){if(!h){return false}var g=h.match(/\/(app|sub)\/(\d+)\//);if(!g){return false}return[g[1],parseInt(g[2])]};f.prototype.render=function(){var n=this;if(SGPP.location.pageKind=="giveaway"){var l=$("a.global__image-outer-wrap--game-large").first().attr("href");var j=false;var h=false;var g=false;var k=false;var i=this.parseAppLink(l);if(i){j=this.owns(l);h=this.ignores(l);g=this.blacklisted(l);k=this.wishlisted(l)}var m=$(".sidebar").last();if(j){if($(".sidebar__entry-insert").length!=0){$(".sidebar__entry-insert").before('<div class="sidebar__ignored sidebar__error"><i class="fa fa-exclamation-circle"></i> Owned in Steam</div>');$(".sidebar__entry-insert").hide()}}if(h){if($(".sidebar__entry-insert").length!=0){$(".sidebar__entry-insert").before('<div class="sidebar__ignored sidebar__error"><i class="fa fa-exclamation-circle"></i> Not Interested</div>');$(".sidebar__entry-insert").hide()}}if(g){if($(".sidebar__entry-insert").length!=0){$(".sidebar__entry-insert").before('<div class="sidebar__ignored sidebar__error"><i class="fa fa-exclamation-circle"></i> Game Hidden</div>');$(".sidebar__entry-insert").hide()}}if(k){$("div.featured__summary").addClass("wishlisted-giveaway")}$(".sidebar__ignored").click(function(){$(".sidebar__entry-insert").show();$(".sidebar__ignored").hide()})}else{if(SGPP.location.pageKind=="giveaways"){this.markGames();SGPP.on("EndlessScrollGiveaways","addItem",function(p,o){n.markGame(o)})}}};f.prototype.markGames=function(){var g=this;$(".giveaway__row-outer-wrap").each(function(h,j){g.markGame(j)})};f.prototype.markGame=function(i){var h=false;var g=$(i);var j=g.find("a.giveaway__icon").attr("href");g.toggleClass("wishlisted-giveaway",this.wishlisted(j))};f.prototype.refreshGamesFromSteam=function(){var g=this;GM_xmlhttpRequest({method:"GET",url:"http://store.steampowered.com/dynamicstore/userdata/",onload:function(h){var i=JSON.parse(h.responseText);if(i.rgOwnedApps.length==0){alert("You are not logged in to Steam.")}SGPP.storage.setItem("steam_userdata",i);SGPP.storage.setItem("steam_userdata_date",Date.now());g.userdata=i}})};f.prototype.loadBlacklistPage=function(h,j,g){var i=this;$.get("http://www.steamgifts.com/account/settings/giveaways/filters/search?page="+h,function(l){var m=$($.parseHTML(l));$(m).find(".table__rows").children().each(function(p,q){console.log(q);var o=$(q);var r=o.find("a.table__column__secondary-link");if(!r.length){return}var n=i.parseAppLink(r.attr("href"));if(n){if(n[0]=="app"){g.apps.push(n[1])}else{if(n[0]=="sub"){g.subs.push(n[1])}}}});var k=m.find(".pagination a").last();if(k.length&&h<parseInt(k.data("page-number"))){i.loadBlacklistPage(h+1,j,g)}else{j(g)}})};f.prototype.refreshBlacklistFromSG=function(){var g={apps:[],subs:[]};this.loadBlacklistPage(1,function(h){SGPP.storage.setItem("blacklist_data",h);SGPP.storage.setItem("blacklist_date",Date.now())},g)};f.prototype.name=function(){return"Filter Games"};return f}());d.MarkOwnedGames=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){this.style=".message_filter_hidden { display: none; }\n.message_filter_visible { }\n.filterdrop { position: absolute; }\n.filterdrop a { display: block; }\n.message-filters { margin-left: 5px; }\n.message-filter { cursor: pointer; }\n.message-filter i { margin: 0; }";this._hideRead=false}c.prototype.shouldRun=function(){return(SGPP.location.pageKind=="discussion"||SGPP.location.pageKind=="trade")};Object.defineProperty(c.prototype,"hideRead",{get:function(){return this._hideRead},set:function(d){this._hideRead=d;this._filterElement.find(".hideread i").toggleClass("fa-square-o",!d).toggleClass("fa-check-square-o",d);this.filterAll()},enumerable:true,configurable:true});c.prototype.init=function(){};c.prototype.filterItem=function(e){var d=$(e);var g=true;var h=!d.hasClass("endless_not_new");var f=!d.hasClass("endless_no_new_children");if(this.hideRead){g=g&&(h||f)}d.toggleClass("message_filter_hidden",!g);d.toggleClass("message_filter_visible",g)};c.prototype.filterAll=function(){var d=this;$(".comment").each(function(e,f){d.filterItem(f)})};c.prototype.render=function(){var e=this;SGPP.on("EndlessScrollDiscussionReplies","addItem",function(g,f){e.filterItem(f)});var d=this;this._filterElement=$('<span class="message-filters"></span>');this._filterElement.append('<span class="message-filter hideread"><i class="fa fa-square-o"></i> Hide Read</span>').click(function(){d.hideRead=!d.hideRead});$(".comments:eq(1)").prev().find("div").append(this._filterElement);this.filterAll()};c.prototype.name=function(){return"Hide Read Comments"};return c}());b.MessagesFilterTest=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(){function c(){var d=this;this.style=".SGPP__popup_giveaway { text-align: justify; width: 90%; max-width: 1000px }\n.SGPP__popup_giveaway .page__outer-wrap { padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right:20px }\n.SGPP__popup_giveaway .comment__parent { margin-top: 10px }\n.SGPP__popup_giveaway .global__image-outer-wrap--avatar-small { margin-right: 5px }\n.SGPP__popup_giveaway .page__description { max-height: 200px; overflow-y: auto }\n.SGPP__popup_giveaway .markdown li { position:relative }\n.SGPP__popup_giveaway .featured__outer-wrap form > * { background-color: #f0f2f5 }\n.SGPP__popup_giveaway .featured__outer-wrap form { margin-top: 5px; }\n";this.popupGiveaway=$("<div>",{"class":"SGPP__popup_giveaway is-hidden"});this.handlePopupCreate=function(e){$('a[href^="/giveaway/"]:not([href$="/entries"],[href$="/comments"],[href$="/winners"],[href$="/groups"])',e).on("click",function(f){f.preventDefault();d.handlePopup($(f.currentTarget))})};this.headingHelper=function(e){return'<div class="page__heading"><div class="page__heading__breadcrumbs">'+e+"</div></div>"};this.handlePopup=function(e){d.popupGiveaway.bPopup({onOpen:function(){d.popupGiveaway.removeClass("is-hidden");$.ajax({url:e.attr("href")}).done(function(j){var l=$(".featured__outer-wrap",j);$(".featured__column--whitelist, .featured__column--group",l).each(function(){this.childNodes[1].nodeValue=""});var i=$("<div>",{"class":"page__outer-wrap"});var h=$(".sidebar form",j);if(!h.length){h=$(".sidebar__error",j)}var k=$(".page__description",j);var g=$(".comment--submit .comment__parent",j);g.find("span").addClass("b-close");var f=$(".js__submit-form",g);l.find(".featured__summary").append(h);if(k.length){i.append(d.headingHelper("Description"),k)}i.append(d.headingHelper("Reply"),g);d.popupGiveaway.append(l,i);d.popupGiveaway.css({top:Math.max(0,(($(window).height()-(208+i.outerHeight()))/2)+$(window).scrollTop())+"px"});$(".sidebar__entry-insert, .sidebar__entry-delete",l).on("click",function(n){var m=$(n.currentTarget);m.addClass("is-hidden"),m.closest("form").find(".sidebar__entry-loading").removeClass("is-hidden"),m.closest("form").find("input[name=do]").val(m.attr("data-do")),$.ajax({url:"/ajax.php",type:"POST",dataType:"json",data:m.closest("form").serialize(),success:function(o){m.closest("form").find(".sidebar__entry-loading").addClass("is-hidden");if(o.type==="success"){if(m.hasClass("sidebar__entry-insert")){m.closest("form").find(".sidebar__entry-delete").removeClass("is-hidden");e.closest(".giveaway__row-inner-wrap, .SGPP__gridTile").addClass("is-faded")}else{if(m.hasClass("sidebar__entry-delete")){m.closest("form").find(".sidebar__entry-insert").removeClass("is-hidden");e.closest(".giveaway__row-inner-wrap, .SGPP__gridTile").removeClass("is-faded")}}}else{if(o.type==="error"){m.closest("form").html("undefined"!=typeof o.link&&o.link!==!1?'<a href="'+o.link+'" class="sidebar__error"><i class="fa fa-exclamation-circle"></i> '+o.msg+"</a>":'<div class="sidebar__error is-disabled"><i class="fa fa-exclamation-circle"></i> '+o.msg+"</div>")}}if("undefined"!=typeof o.entry_count&&o.entry_count!==!1){$(".live__entry-count").text(o.entry_count);$(".nav__points").text(o.points)}}})});f.on("click",function(n){n.preventDefault();var m=$(n.currentTarget);$.ajax({url:e.attr("href"),type:"POST",dataType:"json",data:m.closest("form").serialize(),complete:function(o){if(o.getResponseHeader("TM-finalURL")){m.closest("form").find("textarea").val("");m.hide()}}})})})},onClose:function(){d.popupGiveaway.addClass("is-hidden");d.popupGiveaway.empty()},follow:[true,false]})};this.shouldRun=function(e){return e.pageKind=="giveaways"}}c.prototype.init=function(){this.popupGiveaway.appendTo("body")};c.prototype.render=function(){var d=this;this.handlePopupCreate($(document));SGPP.on(["EndlessScrollGiveaways","EndlessScrollLists"],"afterAddItems",function(g,f,h,e){d.handlePopupCreate(f)})};c.prototype.name=function(){return"Popup Giveaway"};return c}());b.PopupGiveaway=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(){function c(){this._maxPage=31337;this._pageInView=-1;this._prevPage=-1;this._nextPage=-1;this._currentPage=1;this._lastPage=1;this._numberOfPages=-1;this._stopped=false;this._pages={};this._pagesUrl={}}Object.defineProperty(c.prototype,"stopped",{get:function(){return this._stopped},set:function(d){this._stopped=d},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"currentPage",{get:function(){return this._currentPage},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"lastPage",{get:function(){return this._numberOfPages},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"reverseItems",{get:function(){return false},enumerable:true,configurable:true});Object.defineProperty(c.prototype,"BaseUrl",{get:function(){throw"BaseUrl() not implmented"},enumerable:true,configurable:true});c.prototype.hasPages=function(d){return $(d).find(".pagination__navigation").length!=0};c.prototype.getNavigationElement=function(d){return $(d).find(".pagination").first()};c.prototype.createPageContainerElement=function(){throw"createPageContainerElement() not implemented"};c.prototype.getItemsElement=function(d){throw"getItemsElement() not implemented"};c.prototype.getItems=function(d){throw"getItems() not implemented"};c.prototype.createLoadingElement=function(){var d=$('<span class="endless_loading"> - <i class="fa fa-refresh fa-spin"></i> Loading...</span>');return d};c.prototype.createPageElement=function(h){var j=this;var g=$('<div class="table__heading"><div class="table__column--width-fill"><p><span class="endless_page"></span></p></div></div>');var f=g.find("p");this.updatePageElement(g,h);var d=$("<div>").addClass("pull-right").addClass("endless_control_element");var e=$("<a>").attr("href","#").append('<i class="fa fa-refresh"></i>').attr("title","Reload this page");var i=$("<a>").attr("href","#").append('<i class="fa fa-pause pausecontrol"></i>').attr("title","Pause/Resume endless scrolling");e.click(function(){j.loadPage(h,true);return false});i.click(function(){j.stopped=!j.stopped;$(".endless_control_element a i.pausecontrol").toggleClass("fa-pause",!j.stopped).toggleClass("fa-play",j.stopped);return false});d.append(e);d.append(i);f.append(d);return g};c.prototype.updatePageElement=function(d,e){var f="";if(e>0&&e<=this._maxPage){if(this._numberOfPages>0){f="Page "+e+" of "+this._numberOfPages}else{f="Page "+e}}else{f="Last page ends here"}d.find(".endless_page").text(f)};c.prototype.loadNextPage=function(){if(this._stopped){return}if(this._nextPage>this._lastPage||this._nextPage<1){return}this.loadPage(this._nextPage)};c.prototype.updateNextPage=function(d){if(this.reverseItems){this._nextPage=d-1}else{this._nextPage=d+1}this.createPageContainer(this._nextPage)};c.prototype.updatePrevPage=function(d){if(this.reverseItems){this._prevPage=d+1}else{this._prevPage=d-1}this.createPageContainer(this._prevPage)};c.prototype.createPageContainer=function(f){if(!(f in this._pages)){if(f<1||f>this._lastPage){return}var h=-1;var g=-1;$.each(this._pages,function(j,k){var l=Math.abs(j-f);if(g==-1||h>l){g=j;h=l}});var e=this.createPageContainerElement();var i=this.createPageElement(f);e.append(i);this._pages[f]={element:e,headerElement:i,loaded:false,loading:false,visible:true};var d=this._pages[g].element;if((g<f&&!this.reverseItems)||(g>f&&this.reverseItems)){d.after(e)}else{d.before(e)}}};c.prototype.loadPage=function(i,f){var g=this;if(f===void 0){f=false}if(!(i in this._pagesUrl)){throw"No URL for page "+this._currentPage}this.createPageContainer(i);var h=this._pages[i];if(h.loading){return}else{if(h.loaded&&!f){if(!h.visible){h.element.show();h.visible=true}if(this._nextPage==i){this.updateNextPage(i)}}else{var d=this._pagesUrl[i];this._pages[i].loading=true;var j=this._pages[i].loaded;var e=this._pages[i].element;var l=this._pages[i].headerElement;var k=this.createLoadingElement();l.find("p").first().append(k);if(j){$(this).trigger("beforeReloadPage",[i]);e.children().remove();this._pages[i].headerElement=l=this.createPageElement(i);e.prepend(l)}$.get(d,function(n){var q=$.parseHTML(n);var p=g.getNavigationElement(q);var o=parseInt(p.find("a.is-selected").data("page-number"));var m=$(q);$(g).trigger("beforeAddItems",[m,o,j]);var r=g.getItemsElement(q);g.parseNavigation(p);g.addItems(r,e,o);e.prepend(l);g.getNavigationElement(document).html(p.html());$(g).trigger("afterAddItems",[e,o,j]);g._pages[i].loading=false;g._pages[i].loaded=true;k.remove();if(g._nextPage==i||g._nextPage==-1){g.updateNextPage(o)}else{if(g._prevPage==i){g.updatePrevPage(o)}}if(o!=i){g.updatePageElement(l,o);g._pages[o]=g._pages[i];delete g._pages[i]}g.updatePageInView()})}}};c.prototype.addItems=function(f,d,e){var g=this;this.getItems(f).each(function(h,j){$(j).data("original-page",e);$(g).trigger("addItem",[j]);if(g.reverseItems){d.prepend(j)}else{d.append(j)}})};c.prototype.parseNavigation=function(e){var f=this;var d=e.find("a").last();this._lastPage=parseInt(d.data("page-number"));if(d.text().trim()!="Next"){this._numberOfPages=this._lastPage}e.find(".pagination__navigation a").each(function(h,j){var g=$(j);var k=parseInt(g.data("page-number"));f._pagesUrl[k]=g.attr("href");if(k>f._lastPage){f._lastPage=k}})};c.prototype.pushHistoryState=function(d){history.replaceState(null,null,this._pagesUrl[d])};c.prototype.updatePageInView=function(){var e=-1;var d=-1;$.each(this._pages,function(f,g){var h=Math.abs($(window).scrollTop()-$(g.headerElement).offset().top);if(e==-1||(h<d)){e=f;d=h}});if(e==-1){e=1}if(this._pageInView!=e){this._pageInView=e;console.log("page in view changed to "+e);this.pushHistoryState(e)}};c.prototype.preparePage=function(){var i=this;var h=this.getNavigationElement(document);if(h.hasClass("pagination--no-results")){return}if(!this.hasPages(document)){this._currentPage=1;this._lastPage=1;this._numberOfPages=1}else{this._currentPage=parseInt(h.find("a.is-selected").data("page-number"));this._pageInView=this._currentPage;this.parseNavigation(h)}var e=this.getItemsElement(document);var f=this.createPageElement(this.currentPage);var d=SGPP.location.hash!="";this._pages[this.currentPage]={element:e,headerElement:f,loaded:true,loading:false,visible:true};if(this.reverseItems){this.getItems(e).each(function(j,k){e.prepend(k)});if(this._currentPage==1&&this._numberOfPages>1&&!d){this._nextPage=this._lastPage;this.loadNextPage();this._pages[this.currentPage].visible=false;e.hide()}else{if(this._currentPage==1&&this._numberOfPages==-1&&!d){this._pagesUrl[this._maxPage]=this.BaseUrl+"/search?page="+this._maxPage;this._pages[this.currentPage].visible=false;e.hide();this.loadPage(this._maxPage)}else{this._prevPage=this.currentPage+1;this._nextPage=this.currentPage-1}}}else{this._prevPage=this._currentPage-1;this._nextPage=this._currentPage+1}if(this._prevPage>0){this.createPageContainer(this._prevPage)}this.pushHistoryState(this.currentPage);this.createPageContainer(this._nextPage);e.prepend(f);if(d){var g=$("#"+SGPP.location.hash);$(window).scrollTop(g.offset().top)}$(window).scroll(function(k){i.updatePageInView();var l=$(window).scrollTop()+$(window).height();if(i._nextPage in i._pages){var j=i._pages[i._nextPage];if(l>$(j.headerElement).position().top-200){i.loadNextPage()}}});$(window).scroll()};return c}());a.EndlessScroll=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(d){__extends(c,d);function c(){var e=d!==null&&d.apply(this,arguments)||this;e.style="";return e}c.prototype.shouldRun=function(){return SGPP.location.pageKind=="discussions"||SGPP.location.pageKind=="trades"};c.prototype.init=function(){};c.prototype.render=function(){this.preparePage()};c.prototype.createPageContainerElement=function(){return $('<div class="table__rows">')};c.prototype.getItemsElement=function(e){return $(e).find(".table__rows").first()};c.prototype.getItems=function(e){return e.children(".table__row-outer-wrap")};c.prototype.name=function(){return"Endless Scroll on Discussions page"};return c}(b.EndlessScroll));b.EndlessScrollDiscussion=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(c){__extends(d,c);function d(){var e=c!==null&&c.apply(this,arguments)||this;e.style="";return e}d.prototype.shouldRun=function(){return SGPP.location.pageKind=="discussion"||SGPP.location.pageKind=="trade"};d.prototype.init=function(){};d.prototype.render=function(){if(true){var e=$(".comment--submit").first();if(e.length==1){var f=$('<div id="esc_reply_header" class="page__heading"><div class="page__heading__breadcrumbs">Reply</div></div>');if($(".poll").length==0){$(".comments").first().after(f)}else{$(".poll").first().after(f)}$("#esc_reply_header").after(e);$(".js__comment-reply-cancel").on("click",function(){setTimeout(function(){e.insertAfter("#esc_reply_header")},10)})}}this.preparePage()};Object.defineProperty(d.prototype,"BaseUrl",{get:function(){return"/"+SGPP.location.pageKind+"/"+SGPP.location.code+"/"+SGPP.location.description},enumerable:true,configurable:true});Object.defineProperty(d.prototype,"reverseItems",{get:function(){return SGPP.settings.getSettingForModule("EndlessScrollDiscussionReplies","reversedDiscussionReplies")||false},enumerable:true,configurable:true});d.prototype.createPageContainerElement=function(){return $('<div class="comments">')};d.prototype.getItemsElement=function(e){return $(e).find(".comments:eq(1)")};d.prototype.getItems=function(e){return e.children(".comment")};d.prototype.name=function(){return"Endless Scroll on Discussion comments"};return d}(a.EndlessScroll));a.EndlessScrollDiscussionReplies=b})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(d){__extends(c,d);function c(){var e=d!==null&&d.apply(this,arguments)||this;e.style="";return e}c.prototype.shouldRun=function(){return SGPP.location.pageKind=="giveaway"&&SGPP.location.subpage==""};c.prototype.init=function(){};c.prototype.render=function(){if(true){var e=$(".comment--submit").first();var f=$('<div id="esc_reply_header" class="page__heading"><div class="page__heading__breadcrumbs">Reply</div></div>');$(".comments").prev().before(f);$("#esc_reply_header").after(e);$(".js__comment-reply-cancel").on("click",function(){setTimeout(function(){e.insertAfter("#esc_reply_header")},10)})}this.preparePage()};c.prototype.createPageContainerElement=function(){return $('<div class="comments">')};Object.defineProperty(c.prototype,"reverseItems",{get:function(){return SGPP.settings.getSettingForModule("EndlessScrollGiveawayComments","reversedGiveawayComments")||false},enumerable:true,configurable:true});c.prototype.getItemsElement=function(e){return $(e).find(".comments").first()};c.prototype.getItems=function(e){return e.children(".comment")};c.prototype.name=function(){return"Endless Scroll on Giveaway comments"};return c}(b.EndlessScroll));b.EndlessScrollGiveawayComments=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(b){var a=(function(d){__extends(c,d);function c(){var e=d!==null&&d.apply(this,arguments)||this;e._location="frontpage";e.style="";return e}c.prototype.shouldRun=function(){if(SGPP.location.pageKind=="giveaways"){return !(SGPP.location.subpage=="entered"||SGPP.location.subpage=="created"||SGPP.location.subpage=="won"||SGPP.location.subpage=="wishlist")}else{if(/^\/user\/[^\/]+(\/giveaways\/won([^\/]+)?)?$/.test(location.pathname)){this._location="profile";return true}}return false};c.prototype.init=function(){};c.prototype.render=function(){var e=this;this.preparePage();$(this).on("afterAddItems",function(h,g,i,f){g.find(".giveaway__hide").click(function(){$(".popup--hide-games input[name=game_id]").val($(this).parents("[data-game-id]").attr("data-game-id"));$(".popup--hide-games .popup__heading__bold").text($(this).closest("h2").find(".giveaway__heading__name").text())});g.find(".trigger-popup").click(function(){$("."+$(this).attr("data-popup")).bPopup({opacity:0.85,fadeSpeed:200,followSpeed:500,modalColor:"#3c424d"})})});$(".popup--hide-games .js__submit-form").after('<div class="form__submit-button ajax_submit-form"><i class="fa fa-check-circle"></i> Yes</div>');$(".popup--hide-games .js__submit-form").hide();$(".popup--hide-games .ajax_submit-form").click(function(g){var f=$(".popup--hide-games form").first();$.post("/",f.serialize(),function(h){$(".popup--hide-games").bPopup().close();e.hideGiveawaysByGameID($(".popup--hide-games input[name=game_id]").val())});return false})};c.prototype.hideGiveawaysByGameID=function(e){$(".giveaway__row-outer-wrap").each(function(g,h){var f=$(h);if(f.find(".giveaway__hide").data("game-id")==e){f.hide()}})};c.prototype.createPageContainerElement=function(){return $("<div>")};c.prototype.getItemsElement=function(e){return $(e).find(".pagination").prev()};c.prototype.getItems=function(e){return e.children(".giveaway__row-outer-wrap")};c.prototype.name=function(){return"Endless Scroll on Giveaways"};return c}(b.EndlessScroll));b.EndlessScrollGiveaways=a})(ModuleDefinition||(ModuleDefinition={}));var ModuleDefinition;(function(a){var b=(function(c){__extends(d,c);function d(){var e=c!==null&&c.apply(this,arguments)||this;e.style="";return e}d.prototype.shouldRun=function(){if(SGPP.location.pageKind=="giveaways"){return SGPP.location.subpage=="entered"||SGPP.location.subpage=="created"||SGPP.location.subpage=="won"||SGPP.location.subpage=="wishlist"}else{if(SGPP.location.pageKind=="bundle-games"){return true}else{if(SGPP.location.pageKind=="giveaway"){return SGPP.location.subpage=="entries"||SGPP.location.subpage=="winners"||SGPP.location.subpage=="groups"}else{if(SGPP.location.pageKind=="account"){return SGPP.location.subpage=="manage"||SGPP.location.subpage=="trades"||SGPP.location.subpage=="steam"||SGPP.location.subpage=="settings"}}}}return false};d.prototype.init=function(){};d.prototype.render=function(){this.preparePage()};d.prototype.createPageContainerElement=function(){return $('<div class="table__rows">')};d.prototype.getItemsElement=function(e){return $(e).find(".table__rows").first()};d.prototype.getItems=function(e){return e.children(".table__row-outer-wrap")};d.prototype.afterAddItems=function(e){$(e).find(".table__remove-default").click(function(){var f=$(this);f.addClass("is-hidden");f.siblings(".table__remove-loading").removeClass("is-hidden");$.ajax({url:"/ajax.php",type:"POST",dataType:"json",data:f.closest("form").serialize(),success:function(g){f.siblings(".table__remove-loading").addClass("is-hidden");f.siblings(".table__remove-complete").removeClass("is-hidden");f.closest(".table__row-inner-wrap").addClass("is-faded");if(typeof g.points!=="undefined"&&g.points!==false){$(".nav__points").text(g.points)}}})})};d.prototype.name=function(){return"Endless Scroll everywhere else"};return d}(a.EndlessScroll));a.EndlessScrollLists=b})(ModuleDefinition||(ModuleDefinition={}));var SGPP=new ModuleDefinition.Core();var modulesNames=new Array("GiveawaysFilter","CommentAndEnter","EntryCommenters","FixedNavbar","FixedFooter","GridView","ScrollingSidebar","UserHoverInfo","UserTags","MarkComments","MarkOwnedGames","MessagesFilterTest","PopupGiveaway","EndlessScrollDiscussion","EndlessScrollDiscussionReplies","EndlessScrollGiveaways","EndlessScrollGiveawayComments","EndlessScrollLists");var defaultModules={FixedNavbar:{enabled:true},ScrollingSidebar:{enabled:true}};var currentVersion="0.4.8";(function(c){if(!SGPP.storage.containsItem("Version")){SGPP.storage.clear();SGPP.storage.setItem("Version",currentVersion)}if(!SGPP.storage.containsItem(ModuleDefinition.Settings.SETTINGS_KEY)){SGPP.storage.setItem(ModuleDefinition.Settings.SETTINGS_KEY,defaultModules)}for(var d in modulesNames){var a=new ModuleDefinition[modulesNames[d]]();if(SGPP.settings.isModuleEnabled(modulesNames[d])&&a.shouldRun(SGPP.location)){SGPP.modules[modulesNames[d]]=a}}for(var b in SGPP.modules){SGPP.log("Module "+b+" append css.");SGPP.appendCSS(SGPP.modules[b].style);SGPP.log("Module "+b+" init() call.");SGPP.modules[b].init()}SGPP.render();for(var b in SGPP.modules){SGPP.log("Module "+b+" render() call.");SGPP.modules[b].render()}})(jQuery);