// ==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(" \
");
//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 ([0-9]{1,10})<\/strong> to ([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(' \
\