2016-12-02 10:41:02 -06:00
|
|
|
// ==UserScript==
|
2016-12-02 09:59:35 -06:00
|
|
|
// @name Amazon Giveaway Listing Visited Remover
|
|
|
|
|
// @namespace danielrayjones
|
|
|
|
|
// @description Allow removal of visited links on Amazon Giveaway Listing
|
|
|
|
|
// @include https://giveawaylisting.com/
|
2020-06-05 14:48:01 -05:00
|
|
|
// @version 1.3.1
|
2016-12-02 10:41:02 -06:00
|
|
|
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
|
2016-12-02 09:59:35 -06:00
|
|
|
// ==/UserScript==
|
|
|
|
|
|
2020-06-05 14:48:01 -05:00
|
|
|
/* jshint esversion: 6 */
|
|
|
|
|
|
2016-12-02 10:41:02 -06:00
|
|
|
var checked = false;
|
|
|
|
|
|
|
|
|
|
var hideOne = function(el) {
|
|
|
|
|
$(el).parent('td').parent('tr').css('display', checked ? 'none' : 'table-row');
|
|
|
|
|
};
|
|
|
|
|
|
2016-12-02 09:59:35 -06:00
|
|
|
var hideVisited = function(evt) {
|
2016-12-02 10:41:02 -06:00
|
|
|
checked = $(this).prop('checked');
|
|
|
|
|
var $links = $('#giveaways a[href*="amzn.to"]');
|
2016-12-02 10:26:26 -06:00
|
|
|
|
|
|
|
|
$links.each(function() {
|
2016-12-02 10:41:02 -06:00
|
|
|
var href = $(this).attr('href');
|
2016-12-02 10:26:26 -06:00
|
|
|
if (localStorage.getItem(href)) {
|
2016-12-02 10:41:02 -06:00
|
|
|
hideOne(this);
|
2016-12-02 10:26:26 -06:00
|
|
|
}
|
|
|
|
|
});
|
2016-12-02 09:59:35 -06:00
|
|
|
};
|
|
|
|
|
|
2016-12-02 10:41:02 -06:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('#giveaways').on('click', 'a[href*="amzn.to"]', function(evt) {
|
2016-12-02 09:59:35 -06:00
|
|
|
|
2016-12-02 10:41:02 -06:00
|
|
|
var href = $(this).attr('href');
|
|
|
|
|
localStorage[href] = "visited";
|
|
|
|
|
hideOne(this);
|
2016-12-02 09:59:35 -06:00
|
|
|
});
|
2016-12-02 10:41:02 -06:00
|
|
|
|
|
|
|
|
$('b:contains("Hide")').after('<label><input type="checkbox" id="hide_visited"/> Visited</label>');
|
|
|
|
|
$('#hide_visited').on('click', hideVisited);
|
|
|
|
|
});
|