Last active
April 24, 2024 08:55
-
-
Save Michal-Mikolas/77dabbdbf39f57fe6816dc9e00866bb9 to your computer and use it in GitHub Desktop.
My Bookmarklets
This file contains 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
// https://katanya.co.uk/labs/bookmarklet-generator | |
fetch('https://api.github.com/gists/77dabbdbf39f57fe6816dc9e00866bb9?time=' + Math.floor(Date.now()/(5*60*1000)) | |
.then(response => response.json()) | |
.then(data => { | |
var scriptContent = data.files['FILENAME.js'].content; | |
scriptContent = scriptContent.replaceAll('{{ID}}', ''); | |
scriptContent = scriptContent.replaceAll('{{SECURITY_KEY}}', ''); | |
const scriptFn = new Function(scriptContent); | |
scriptFn(); | |
}) | |
.catch(error => { | |
console.error('Error fetching script from GitHub Gist:', error); | |
}); |
This file contains 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
function jquerify(callback){ | |
var el = document.createElement("div"), | |
b = document.getElementsByTagName("body")[0], | |
otherlib = !1; | |
el.style.position = "fixed", el.style.height = "32px", el.style.width = "220px", el.style.marginLeft = "-110px", el.style.top = "0", el.style.left = "50%", el.style.padding = "5px 10px", el.style.zIndex = 1001, el.style.fontSize = "12px", el.style.color = "#222", el.style.backgroundColor = "#f99"; | |
if (typeof jQuery != "undefined") return callback(); | |
typeof $ == "function" && (otherlib = !0); | |
function getScript(url, success) { | |
var script = document.createElement("script"); | |
script.src = url; | |
var head = document.getElementsByTagName("head")[0], | |
done = !1; | |
script.onload = script.onreadystatechange = function() { | |
!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") && (done = !0, success(), script.onload = script.onreadystatechange = null, head.removeChild(script)) | |
}, head.appendChild(script) | |
} | |
getScript("//code.jquery.com/jquery.min.js", function() { | |
return typeof jQuery == "undefined" | |
? console.log("Sorry, but jQuery was not able to load") | |
: callback() | |
}); | |
} | |
function kill(){ | |
jQuery('.tab-switcher > .dijitButton:eq(2) > .dijitButtonNode')[0].click(); | |
jQuery('input[type=password]').val('Station123.'); | |
jQuery('input[type=password]').trigger('focus'); | |
/*jQuery('span[widgetid="uiLogic_util_StateControl_5"]:not(.checked) span.dijitButtonText').trigger('click');*/ | |
setTimeout(function() { | |
jQuery('.button-save .dijitButtonNode')[0].click(); | |
setupForwarding = function(){ | |
if (jQuery('li.help-strong.length.help-init').length != 0) { | |
setTimeout(setupForwarding, 500); | |
return; | |
} | |
setTimeout(function(){ | |
jQuery('.tab-switcher > .dijitButton:eq(5) > .dijitButtonNode')[0].click(); | |
jQuery('.submenu-section-forward .dijitButtonNode')[0].click(); | |
setTimeout(function(){ | |
jQuery('.submenu-section-forward input.dijitInputInner').trigger('focus'); | |
}, 200); | |
}, 1000); | |
}; | |
setupForwarding(); | |
}, 1000); | |
} | |
jquerify(kill); |
This file contains 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
var fullname = jQuery('table.form_table.dynamic-forms.ui-sortable tbody:eq(1) tr:eq(2) td:eq(1) input').val().trim(); | |
var date_string = jQuery('table.form_table.dynamic-forms.ui-sortable tbody:eq(1) tr:eq(3) td:eq(1) input').val().trim(); | |
var y = date_string.match(/(\d+)-(\d+)-(\d+)/)[1].replace(/^0/, ''); | |
var m = date_string.match(/(\d+)-(\d+)-(\d+)/)[2].replace(/^0/, ''); | |
var d = date_string.match(/(\d+)-(\d+)-(\d+)/)[3].replace(/^0/, ''); | |
var company = jQuery('table.form_table.dynamic-forms.ui-sortable tbody:eq(1) tr:eq(4) li.select2-selection__choice[title]').text().trim().substr(1,13); | |
if (company.substr(0, 3) == 'Jin') { | |
var company = jQuery('table.form_table.dynamic-forms.ui-sortable tbody:eq(1) tr:eq(5) input').val().trim().substr(0,13); | |
} | |
const today = new Date(); | |
const today_y = today.getFullYear(); | |
const today_m = String(today.getMonth() + 1).padStart(2, '0'); | |
const today_d = String(today.getDate()).padStart(2, '0'); | |
const today_string = `${today_y}-${today_m}-${today_d}`; | |
jQuery('table.form_table.dynamic-forms.ui-sortable tbody:eq(0) tr:eq(3) td:eq(1) input') | |
.val(fullname + ', ' + d + '.' + m + '., ' + company); | |
jQuery('input#duedate').val((date_string > today_string)? date_string: today_string); | |
jQuery('select#time').val('23:45'); |
This file contains 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
function jquerify(callback){ | |
var el = document.createElement("div"), | |
b = document.getElementsByTagName("body")[0], | |
otherlib = !1; | |
el.style.position = "fixed", el.style.height = "32px", el.style.width = "220px", el.style.marginLeft = "-110px", el.style.top = "0", el.style.left = "50%", el.style.padding = "5px 10px", el.style.zIndex = 1001, el.style.fontSize = "12px", el.style.color = "#222", el.style.backgroundColor = "#f99"; | |
if (typeof jQuery != "undefined") return callback(); | |
typeof $ == "function" && (otherlib = !0); | |
function getScript(url, success) { | |
var script = document.createElement("script"); | |
script.src = url; | |
var head = document.getElementsByTagName("head")[0], | |
done = !1; | |
script.onload = script.onreadystatechange = function() { | |
!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") && (done = !0, success(), script.onload = script.onreadystatechange = null, head.removeChild(script)) | |
}, head.appendChild(script) | |
} | |
getScript("//code.jquery.com/jquery.min.js", function() { | |
return typeof jQuery == "undefined" | |
? console.log("Sorry, but jQuery was not able to load") | |
: callback() | |
}); | |
} | |
function readfill(){ | |
if (location.href.match('podpora')) { | |
var text = window.getSelection().toString().trim(); | |
var name = text.match(/[^\s]+/)[0]; | |
var surname = text.match(/[^\s]+\n/)[0].trim(); | |
var login = text.match(/([^\s]+)@/)[1]; | |
var email = text.match(/[a-zA-Z0-9._]+@[a-zA-Z0-9._]+/)[0].trim(); | |
var password = text.match(/([^\s]+)\n\n/)[1]; | |
var pin = text.match(/[0-9]{4}/)[0]; | |
var request = new XMLHttpRequest(); | |
request.open("PUT", "https://json.extendsclass.com/bin/1a4b8c0e8ce2", true); | |
request.setRequestHeader("Content-type", "application/json"); | |
request.setRequestHeader("Security-key", "2299a9f8-f985-11ea-8cc4-0242ac110002"); | |
request.onreadystatechange = (a, b, c) => { }; | |
var data = '{"name": "' + name + '", "surname": "' + surname + '", "login": "' + login + '", "email": "' + email + '", "password": "' + password + '", "pin": "' + pin + '"}'; | |
var result = request.send(data); | |
} else { | |
var request = new XMLHttpRequest(); | |
request.open( | |
"GET", | |
"https://json.extendsclass.com/bin/1a4b8c0e8ce2?rand=" + Math.ceil(Math.random()*9999), | |
true | |
); | |
request.onreadystatechange = () => { | |
if (request.responseText == "") { | |
return; | |
} | |
console.log(request.responseText); | |
var values = JSON.parse(request.responseText); | |
console.log(values); | |
if (location.href.match('cml')) { | |
jQuery('#uzivatel_login').val(values.login); | |
jQuery('#uzivatel_password').val(values.password); | |
jQuery('#uzivatel_name').val(values.name); | |
jQuery('#uzivatel_surname').val(values.surname); | |
jQuery('#uzivatel_email').val(values.email); | |
jQuery('#uzivatel_id_role').val('2'); | |
jQuery('#uzivatel_id_pobocka').val('2'); | |
} | |
if (location.href.match('buffer')) { | |
jQuery('#frm-form-common-full_name').val(values.name + ' ' + values.surname); | |
jQuery('#frm-form-common-email').val(values.email); | |
jQuery('#frm-form-common-role').val('office'); | |
jQuery('#frm-form-common-password').val(values.password); | |
} | |
if (location.href.match('profisluzby')) { | |
jQuery('#al').val(values.login); | |
jQuery('#ap').val(values.password); | |
} | |
if (location.href.match('forpsi')) { | |
jQuery('[id^=uiLogic_postmaster_utils_FullOrLocalEmailInput_]').val(values.login); | |
jQuery('[id^=uiLogic_util_FineTextBox_]').val( | |
values.name.normalize("NFD").replace(/[\u0300-\u036f]/g, "") | |
+ ' ' | |
+ values.surname.normalize("NFD").replace(/[\u0300-\u036f]/g, "") | |
); | |
jQuery('[id^=uiLogic_util_changepassword_FineNewPasswordTextBox_]').val(values.password); | |
jQuery('[id^=uiLogic_util_changepassword_FineRepeatPasswordTextBox_]').val(values.password); | |
jQuery('[id=uiLogic_postmaster_utils_FullOrLocalEmailInput_1]').val(''); | |
jQuery('[id=uiLogic_util_FineTextBox_1]').val(''); | |
} | |
if (location.href.match('UserList')) { // SafeQ old | |
var $iframe = jQuery('iframe[name=user]'); | |
jQuery('#userLogin', $iframe.contents()).val(values.login); | |
jQuery('#userName', $iframe.contents()).val(values.name); | |
jQuery('#userSurname', $iframe.contents()).val(values.surname); | |
jQuery('input[name=f_email]', $iframe.contents()).val(values.email); | |
// jQuery('input[#pin-type-manual]', $iframe.contents()).trigger('click'); | |
jQuery('input[name=pin-type]', $iframe.contents()).val('1'); | |
jQuery('#pin-code', $iframe.contents()).val(values.pin); | |
} | |
if (location.href.match('UserEdit')) { // SafeQ | |
jQuery('#userLogin').val(values.login); | |
jQuery('#userName').val(values.name); | |
jQuery('#userSurname').val(values.surname); | |
jQuery('#f_user_email').val(values.email); | |
jQuery('#pin-type-manual').trigger('click') | |
jQuery('#pin-code').val(values.pin); | |
} | |
if (location.href.match('dochazka')) { | |
jQuery('#frm-form-name').val(values.name); | |
jQuery('#frm-form-surname').val(values.surname); | |
jQuery('#frm-form-email').val(values.email); | |
jQuery('#frm-form-branch_id').val('2'); | |
} | |
}; | |
request.send(); | |
} | |
} | |
jquerify(readfill); |
This file contains 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
var r = Math.round(Math.random() * 9000) + 999; | |
var fullname = jQuery('#content .tixTitle h3').text().trim(); | |
var name = fullname.match(/^[^\s]+/)[0].trim(); | |
var surname = fullname.match(/\s([^\s]+)$/)[1].trim(); | |
var company = jQuery('table.ticket_info.custom-data:eq(1) tr:eq(2) td:eq(1) a').text().trim().substr(0,3); | |
var domain = company == "REN" ? "@renturi.cz" : "@ascari.cz"; | |
var email = jQuery('table.ticket_info.custom-data:eq(1) tr:eq(4) td:eq(1) a').text().trim() | |
|| (surname.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") + domain); | |
var password = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "").substr(0,3) | |
+ Math.floor(r/10) | |
+ surname.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").substr(0,3) | |
+ '.'; | |
var printer = "Printer " + r; | |
var drive = company == "REN" | |
? "Renturi drive" | |
: (company == "TEM" ? "Tempo drive" : "Ascari drive"); | |
gen = fullname + "</br>" | |
+ email + "</br>" | |
+ password + "</br>" | |
+ "</br>" | |
+ printer + "</br>" | |
+ "</br>" | |
+ drive + "</br>" | |
+ "</br>" | |
+ "================" + "</br>" | |
+ "(, all in )" + "</br>" | |
+ fullname + "</br>" | |
+ email + "</br>" | |
+ "</br>" | |
+ "LAPTOP ID: " + "</br>" | |
+ "</br>" | |
jQuery('#user-gen').remove(); | |
jQuery('#thread-items').append("<div id=user-gen>" + gen + "</div>"); |
This file contains 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
function getScript(url, success) { | |
var script = document.createElement("script"); | |
script.src = url; | |
var head = document.getElementsByTagName("head")[0], | |
done = !1; | |
script.onload = script.onreadystatechange = function() { | |
!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") && (done = !0, success(), script.onload = script.onreadystatechange = null, head.removeChild(script)) | |
}, head.appendChild(script) | |
} | |
function jquerify(callback){ | |
var el = document.createElement("div"), | |
b = document.getElementsByTagName("body")[0], | |
otherlib = !1; | |
el.style.position = "fixed", el.style.height = "32px", el.style.width = "220px", el.style.marginLeft = "-110px", el.style.top = "0", el.style.left = "50%", el.style.padding = "5px 10px", el.style.zIndex = 1001, el.style.fontSize = "12px", el.style.color = "#222", el.style.backgroundColor = "#f99"; | |
if (typeof jQuery != "undefined") return callback(); | |
typeof $ == "function" && (otherlib = !0); | |
getScript("//code.jquery.com/jquery.min.js", function() { | |
return typeof jQuery == "undefined" | |
? console.log("Sorry, but jQuery was not able to load") | |
: callback() | |
}); | |
} | |
function syncToRemote(localDB) { | |
console.log('Syncing to remoteDB...'); | |
var remoteDB = new PouchDB('https://admin:Station123@vps.michalm.xyz:6984/cache'); | |
var syncComplete = function(){ console.log('Remote sync complete!'); } | |
var syncError = function(err){ console.log('Remote sync error...'); console.log(err); } | |
localDB.replicate.to(remoteDB) | |
.on('complete', syncComplete) | |
.on('error', syncError); | |
// db.replicate.from(remoteDB, opts, syncError); | |
} | |
scrapCurrent = function() { | |
var db = new PouchDB('cache'); | |
var name = jQuery('h1.song-name').text(); | |
var chords = []; | |
jQuery('.chord').each(function(){ | |
chords.push(jQuery(this).text()); | |
}); | |
var entry = { | |
_id: location.href, | |
name: name, | |
chords: chords | |
}; | |
db.put(entry, function callback(err, result) { | |
if (!err) { | |
console.log('Successfully posted to local DB!'); | |
syncToRemote(db); | |
} else { | |
console.log(err); | |
} | |
}); | |
} | |
scrapRecursive = function() { | |
scrapCurrent(); | |
setTimeout(function(){ | |
jQuery('body nav > .justify-end > a:nth-child(4) > button').trigger('click'); | |
setTimeout(function(){ | |
scrapRecursive(); | |
}, 1000); | |
}, 500); | |
} | |
jquerify(function() { | |
console.log('jQuery loaded'); | |
getScript('https://cdn.jsdelivr.net/npm/pouchdb@8.0.1/dist/pouchdb.min.js', function() { | |
console.log('PouchDB loaded'); | |
scrapRecursive(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment