fix x-browser code
This commit is contained in:
parent
5551cdbcc3
commit
82ae41298c
@ -23,10 +23,10 @@ AEOS =
|
|||||||
init: ->
|
init: ->
|
||||||
#x-browser
|
#x-browser
|
||||||
if typeof GM_deleteValue == 'undefined'
|
if typeof GM_deleteValue == 'undefined'
|
||||||
this.GM_setValue = (name, value) ->
|
window.GM_setValue = (name, value) ->
|
||||||
value = (typeof value)[0] + value
|
value = (typeof value)[0] + value
|
||||||
localStorage.setItem name, value
|
localStorage.setItem name, value
|
||||||
this.GM_getValue = (name, defaultValue) ->
|
window.GM_getValue = (name, defaultValue) ->
|
||||||
if not value = localStorage.getItem name
|
if not value = localStorage.getItem name
|
||||||
return defaultValue
|
return defaultValue
|
||||||
type = value[0]
|
type = value[0]
|
||||||
@ -38,11 +38,11 @@ AEOS =
|
|||||||
return Number value
|
return Number value
|
||||||
else
|
else
|
||||||
return value
|
return value
|
||||||
this.GM_addStyle = (css) ->
|
window.GM_addStyle = (css) ->
|
||||||
style = document.createElement 'style'
|
style = document.createElement 'style'
|
||||||
style.type = 'text/css'
|
style.type = 'text/css'
|
||||||
style.textContent = css
|
style.textContent = css
|
||||||
$('head', document).appendChild(style)
|
document.getElementsByTagName('head')[0].appendChild style
|
||||||
|
|
||||||
#dialog styling
|
#dialog styling
|
||||||
GM_addStyle '
|
GM_addStyle '
|
||||||
@ -122,6 +122,7 @@ AEOS =
|
|||||||
GM_setValue "#{id}Left", div.style.left
|
GM_setValue "#{id}Left", div.style.left
|
||||||
GM_setValue "#{id}Top", div.style.top
|
GM_setValue "#{id}Top", div.style.top
|
||||||
|
|
||||||
|
AEOS.init()
|
||||||
d = document
|
d = document
|
||||||
#utility funks
|
#utility funks
|
||||||
$ = (selector, root) ->
|
$ = (selector, root) ->
|
||||||
|
|||||||
@ -19,11 +19,11 @@
|
|||||||
AEOS = {
|
AEOS = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (typeof GM_deleteValue === 'undefined') {
|
if (typeof GM_deleteValue === 'undefined') {
|
||||||
this.GM_setValue = function(name, value) {
|
window.GM_setValue = function(name, value) {
|
||||||
value = (typeof value)[0] + value;
|
value = (typeof value)[0] + value;
|
||||||
return localStorage.setItem(name, value);
|
return localStorage.setItem(name, value);
|
||||||
};
|
};
|
||||||
this.GM_getValue = function(name, defaultValue) {
|
window.GM_getValue = function(name, defaultValue) {
|
||||||
var type, value;
|
var type, value;
|
||||||
if (!(value = localStorage.getItem(name))) {
|
if (!(value = localStorage.getItem(name))) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -39,12 +39,12 @@
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.GM_addStyle = function(css) {
|
window.GM_addStyle = function(css) {
|
||||||
var style;
|
var style;
|
||||||
style = document.createElement('style');
|
style = document.createElement('style');
|
||||||
style.type = 'text/css';
|
style.type = 'text/css';
|
||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
return $('head', document).appendChild(style);
|
return document.getElementsByTagName('head')[0].appendChild(style);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return GM_addStyle('\
|
return GM_addStyle('\
|
||||||
@ -137,6 +137,7 @@
|
|||||||
return GM_setValue("" + (id) + "Top", div.style.top);
|
return GM_setValue("" + (id) + "Top", div.style.top);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
AEOS.init();
|
||||||
d = document;
|
d = document;
|
||||||
$ = function(selector, root) {
|
$ = function(selector, root) {
|
||||||
root || (root = d.body);
|
root || (root = d.body);
|
||||||
|
|||||||
2
readme
2
readme
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan x
|
// @name 4chan x
|
||||||
// @namespace aeosynth
|
// @namespace aeosynth
|
||||||
// @description Adds various features; replaces the extension / fychan.
|
// @description Adds various features.
|
||||||
// @version 1.4.3
|
// @version 1.4.3
|
||||||
// @copyright 2009, 2010 James Campos
|
// @copyright 2009, 2010 James Campos
|
||||||
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user