Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name NYT Cooking
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://cooking.nytimes.com/*
// @grant none
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
var debug = true;
let modal=".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG";
waitForKeyElements (
modal, function(node) {
node.remove();
console.log("finished before all that loading stuff");}
);
var start = function (jQuery) {
let modal=".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG",
i=0;
waitForKeyElements (
modal, function(node) {node.remove()}
);
// console.log("inside start fn" );
// console.log(new Date().toLocaleTimeString()); // 11:18:48 AM);
// while ( ! jQuery(modal).length && i<20 ) {
// console.log("still waiting; this is iteration number " + i + " -- at " +new Date().toLocaleTimeString()); // 11:18:48 AM);
// window.setTimeout(function() {console.log("waiting")}, 3000);
// i += 1;
// }
// console.log(jQuery(modal));
// jQuery(modal).remove();
// console.log("tried to remove");
// console.log(new Date().toLocaleTimeString()); // 11:18:48 AM);
// var waitForEl = function(selector, callback, count, jQuery = jQuery) {
// if (jQuery(selector).length) {
// callback();
// } else {
// setTimeout(function() {
// if(!count) {
// count=0;
// }
// count++;
// console.log("count: " + count);
// if(count<10) {
// waitForEl(selector,callback,count);
// } else {return;}
// }, 3000);
// }
// };
// waitForEl (".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG", function (jQuery) {
// jQuery(".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG").remove();
// console.log("Should be removed");
// });
};
/*
http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome/12751531#12751531
*/
// console.log(new Date().toLocaleTimeString()); // 11:18:48 AM);
// if (typeof jQuery === "function") {
// if (debug){
// console.log ("Running with local copy of jQuery!");
// }
// setTimeout(start(jQuery), 8000);
// }
// else {
// if (debug){
// console.log ("Fetching jQuery from some 3rd-party server.");
// }
// setTimeout(add_jQuery (start, "2"), 8000);
// }
// function add_jQuery (callbackFn, jqVersion) {
// jqVersion = jqVersion || "2";
// var D = document;
// var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
// var scriptNode = D.createElement ('script');
// scriptNode.src = 'https://ajax.googleapis.com/ajax/libs/jquery/'
// + jqVersion
// + '/jquery.min.js'
// ;
// scriptNode.addEventListener ("load", function () {
// var scriptNode = D.createElement ("script");
// scriptNode.textContent =
// 'var gm_jQuery = jQuery.noConflict (true);\n'
// + '(' + callbackFn.toString () + ')(gm_jQuery);'
// ;
// targ.appendChild (scriptNode);
// }, false);
// targ.appendChild (scriptNode);
// }
// (function() {
// 'use strict';
// console.log ("only a test")
// waitForKeyElements (".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG", actionFunction);
// function actionFunction () {
// if jQuery(".nytc---modal-window---windowContainer.nytc---modal-window---isShown.nytc---shared---whiteBG").remove() {
// console.log ("Removing Modal Blocker");
// }
// }
//
// // Your code here...
// })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.