Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
snownd injection fix and banlist fix
Browse files Browse the repository at this point in the history
snuownd could not be called from other scripts in firefox, wrapped it in
a injection function.
banlist had a misplaced bracket.
  • Loading branch information
creesch committed May 3, 2014
1 parent db8b7e0 commit bfc7eb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 38 deletions.
42 changes: 4 additions & 38 deletions banlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function banlist () {
// from http://stackoverflow.com/a/15780907/362042
function getURLParameter(url, name) {
return (RegExp(name + '=' + '(.+?)(&|$)').exec(url)||[,null])[1];

}

banlist_updating = false;
banlist_last_update = 0;
Expand Down Expand Up @@ -268,43 +268,9 @@ function banlist () {
}
}





// Add script to page
(function () {

// Check if we are running as an extension
if (typeof self.on !== "undefined" || (typeof chrome !== "undefined" && chrome.extension)) {
init();
return;
}

// Check if TBUtils has been added.
if (!window.TBUadded) {
window.TBUadded = true;

var utilsURL = 'http://agentlame.github.io/toolbox/tbutils.js';
var cssURL = 'http://agentlame.github.io/toolbox/tb.css';
$('head').prepend('<script type="text/javascript" src=' + utilsURL + '></script>');
$('head').prepend('<link rel="stylesheet" type="text/css" href="' + cssURL + '"></link>');
}

// Do not add script to page until TBUtils is added.
(function loadLoop() {
setTimeout(function () {
if (typeof TBUtils !== "undefined") {
init();
} else {
loadLoop();
}
}, 100);
})();

function init() {
var s = document.createElement('script');
s.textContent = "(" + banlist.toString() + ')();';
document.head.appendChild(s);
}
var s = document.createElement('script');
s.textContent = "(" + banlist.toString() + ')();';
document.head.appendChild(s);
})();
8 changes: 8 additions & 0 deletions snuownd.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/**
@module SnuOwnd
*/
function snuWrap() {

(function(exports){
function _isspace(c) {return c == ' ' || c == '\n';}
function isspace(c) {return /[\x09-\x0d ]/.test(c);}
Expand Down Expand Up @@ -3831,4 +3833,10 @@
define('snuownd', [], exports);
}
})(typeof(exports)!=='undefined'?exports:typeof(window)!=='undefined'?window.SnuOwnd={}:{});
}

(function () {
var s = document.createElement('script');
s.textContent = "(" + snuWrap.toString() + ')();';
document.head.appendChild(s);
})();

0 comments on commit bfc7eb0

Please sign in to comment.