Created
January 14, 2016 13:51
-
-
Save iKlotho/f1bafff9d78c7676d897 to your computer and use it in GitHub Desktop.
dizist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name dizist | |
// @namespace dizist.net/dizi/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match dizist.net/dizi/* | |
// @grant none | |
// @require | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
// Your code here... | |
var string = ""; | |
var blist = document.getElementsByClassName("button "); | |
blist[blist.length-1].click(); | |
var interval = setInterval(function() { | |
if(document.readyState === 'complete') { | |
clearInterval(interval); | |
done(); | |
} | |
}, 100); | |
function add(list){ | |
for(var i = 0; i <= list.length - 1; i++){ | |
var add = list[i].textContent + "\n"; | |
string += add; | |
} | |
} | |
function tik(button){ | |
button.click(); | |
} | |
function done(){ | |
function start(counter){ | |
if(counter <= blist.length-1){ | |
setTimeout(function(){ | |
blist[counter].click(); | |
var list = $(".realcuf p"); | |
if(counter ==0){ | |
var last = blist.length; | |
var c = last.toString()+". Sezon" + "\n"; | |
string += c} | |
else{ | |
var d = counter.toString()+". Sezon" + "\n"; | |
string += d; | |
} | |
add(list); | |
counter++; | |
start(counter); | |
}, 600); | |
} | |
} | |
start(0); | |
var button = document.createElement('a'); | |
button.setAttribute('class','copy'); | |
button.innerHTML = "Copy"; | |
var a = document.getElementsByClassName('active')[0]; | |
a.appendChild(button); | |
var copyBobBtn = document.querySelector('.copy') | |
copyBobBtn.addEventListener('click', function(event) { | |
copyTextToClipboard(string); | |
}); | |
} | |
function copyTextToClipboard(text) { | |
var textArea = document.createElement("textarea"); | |
// Place in top-left corner of screen regardless of scroll position. | |
textArea.style.position = 'fixed'; | |
textArea.style.top = 0; | |
textArea.style.left = 0; | |
// Ensure it has a small width and height. Setting to 1px / 1em | |
// doesn't work as this gives a negative w/h on some browsers. | |
textArea.style.width = '2em'; | |
textArea.style.height = '2em'; | |
// We don't need padding, reducing the size if it does flash render. | |
textArea.style.padding = 0; | |
// Clean up any borders. | |
textArea.style.border = 'none'; | |
textArea.style.outline = 'none'; | |
textArea.style.boxShadow = 'none'; | |
// Avoid flash of white box if rendered for any reason. | |
textArea.style.background = 'transparent'; | |
textArea.value = text; | |
document.body.appendChild(textArea); | |
textArea.select(); | |
try { | |
var successful = document.execCommand('copy'); | |
var msg = successful ? 'successful' : 'unsuccessful'; | |
console.log('Copying text command was ' + msg); | |
} catch (err) { | |
console.log('Oops, unable to copy'); | |
} | |
document.body.removeChild(textArea); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment