fix injection in firefox
This commit is contained in:
parent
fc18c6d448
commit
54b59eb438
1 changed files with 372 additions and 350 deletions
|
@ -1,16 +1,18 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name onlinetichu.com card counter
|
// @name onlinetichu.com card counter
|
||||||
// @version 1.0.0
|
// @version 1.0.2
|
||||||
// @description automatically count cards at onlinetichu.com
|
// @description automatically count cards at onlinetichu.com
|
||||||
// @author kesslermaximilian
|
// @author kesslermaximilian
|
||||||
// @match *://*.onlinetichu.com/Site/Game/Table/*
|
// @match *://*.onlinetichu.com/Site/Game/Table/*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
// disable auto fold functionality completely
|
// disable auto fold functionality completely
|
||||||
|
function injectCounter() {
|
||||||
if (ot.AutoFold) {
|
if (ot.AutoFold) {
|
||||||
ot.$autoFold.click()
|
ot.$autoFold.click()
|
||||||
ot.$autoFold.hide()
|
ot.$autoFold.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
var myStyles = `
|
var myStyles = `
|
||||||
#playedHigh {
|
#playedHigh {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -250,6 +252,8 @@ if (!window.otc) {
|
||||||
window.otc = OnlineTichuCounter;
|
window.otc = OnlineTichuCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
otc.$showRemaining.hide();
|
||||||
|
|
||||||
// add functionality to smartFold button
|
// add functionality to smartFold button
|
||||||
otc.$smartFold.click(function () {
|
otc.$smartFold.click(function () {
|
||||||
otc.smartFold = !otc.smartFold;
|
otc.smartFold = !otc.smartFold;
|
||||||
|
@ -397,3 +401,21 @@ MyReviewExchange = (function() {
|
||||||
ot.reaction.TableState = MyTableState;
|
ot.reaction.TableState = MyTableState;
|
||||||
ot.reaction.Chat = MyChat;
|
ot.reaction.Chat = MyChat;
|
||||||
ot.action.ExchangeCards = MyExchangeCards;
|
ot.action.ExchangeCards = MyExchangeCards;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Special care is to be taken to safely inject our javascript into the websiet
|
||||||
|
// without the website being able to talk back to greasemonkey
|
||||||
|
// (which would be a security problem)
|
||||||
|
// see
|
||||||
|
// https://stackoverflow.com/questions/5006460/userscripts-greasemonkey-calling-a-websites-javascript-functions
|
||||||
|
// and the excellent answer by Wayne for details on this
|
||||||
|
function exec(fn) {
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.setAttribute("type", "application/javascript");
|
||||||
|
script.textContent = '(' + fn + ')();';
|
||||||
|
document.body.appendChild(script); // run the script
|
||||||
|
document.body.removeChild(script); // clean up
|
||||||
|
}
|
||||||
|
|
||||||
|
exec(injectCounter);
|
||||||
|
|
Loading…
Reference in a new issue