⬆ Update for new layout
This commit is contained in:
parent
11f4f90ed4
commit
95f1340722
1 changed files with 49 additions and 42 deletions
|
|
@ -4,10 +4,15 @@
|
||||||
// @description Allow removal of visited links on Amazon Giveaway Listing
|
// @description Allow removal of visited links on Amazon Giveaway Listing
|
||||||
// @include https://smile.amazon.com/ga/giveaways*
|
// @include https://smile.amazon.com/ga/giveaways*
|
||||||
// @include https://www.amazon.com/ga/giveaways*
|
// @include https://www.amazon.com/ga/giveaways*
|
||||||
// @version 1.8.0
|
// @version 1.9.0
|
||||||
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
|
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
|
/* global jQuery */
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var checked = false;
|
var checked = false;
|
||||||
var regex_hide;
|
var regex_hide;
|
||||||
|
|
||||||
|
|
@ -16,12 +21,12 @@ var getSmallUrl = function(fullUrl) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideOne = function(el) {
|
var hideOne = function(el) {
|
||||||
$(el).parents('.giveawayItemContainer').css('display', checked ? 'none' : 'block');
|
$(el).parents('.listing-item').css('display', checked ? 'none' : 'block');
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideVisited = function(evt) {
|
var hideVisited = function(evt) {
|
||||||
checked = $(this).prop('checked');
|
checked = $(this).prop('checked');
|
||||||
var $links = $('#giveaway-grid a[href*="amazon.com/ga"]');
|
var $links = $('.listing-info-container a[href*="/ga"]');
|
||||||
|
|
||||||
var hide = regex_hide ? new RegExp(regex_hide, 'i') : null;
|
var hide = regex_hide ? new RegExp(regex_hide, 'i') : null;
|
||||||
|
|
||||||
|
|
@ -31,7 +36,7 @@ var hideVisited = function(evt) {
|
||||||
hideOne(this);
|
hideOne(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = $(this).find('.giveawayPrizeNameContainer').text();
|
var title = $(this).find('.prize-title').text();
|
||||||
if (hide && title && hide.test(title)) {
|
if (hide && title && hide.test(title)) {
|
||||||
hideOne(this);
|
hideOne(this);
|
||||||
}
|
}
|
||||||
|
|
@ -39,9 +44,9 @@ var hideVisited = function(evt) {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('head').append('<base target="_blank" />');
|
//$('head').append('<base target="_blank" />');
|
||||||
|
|
||||||
$('#giveaway-grid').on('click', 'a[href*="amazon.com/ga"]', function(evt) {
|
$('.listing-info-container').on('click', 'a[href*="/ga"]', function(evt) {
|
||||||
|
|
||||||
var href = getSmallUrl($(this).attr('href'));
|
var href = getSmallUrl($(this).attr('href'));
|
||||||
localStorage[href] = "visited";
|
localStorage[href] = "visited";
|
||||||
|
|
@ -50,7 +55,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
regex_hide = localStorage.getItem('regex_hide') || '';
|
regex_hide = localStorage.getItem('regex_hide') || '';
|
||||||
|
|
||||||
$('#giveaway-result-info-bar-content')
|
$('#giveaway-numbers-container')
|
||||||
.append('<label><input type="checkbox" id="hide_visited"/> Visited</label>')
|
.append('<label><input type="checkbox" id="hide_visited"/> Visited</label>')
|
||||||
.append(`<input id="hide_regex" value="${regex_hide}"/>`);
|
.append(`<input id="hide_regex" value="${regex_hide}"/>`);
|
||||||
|
|
||||||
|
|
@ -60,3 +65,5 @@ $(document).ready(function() {
|
||||||
localStorage.regex_hide = regex_hide;
|
localStorage.regex_hide = regex_hide;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue