reshuffling
This commit is contained in:
parent
fa47382f75
commit
61027052c4
@ -18,13 +18,10 @@ config =
|
|||||||
'Quick Report': true
|
'Quick Report': true
|
||||||
'Auto Watch': true
|
'Auto Watch': true
|
||||||
'Anonymize': false
|
'Anonymize': false
|
||||||
getConfig = (name) ->
|
|
||||||
GM_getValue(name, config[name])
|
#TODO - put 'hidden' configs here
|
||||||
x = (path, root) ->
|
|
||||||
root or= document.body
|
#utility funks
|
||||||
document.
|
|
||||||
evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).
|
|
||||||
singleNodeValue
|
|
||||||
$ = (selector, root) ->
|
$ = (selector, root) ->
|
||||||
root or= document.body
|
root or= document.body
|
||||||
root.querySelector(selector)
|
root.querySelector(selector)
|
||||||
@ -33,26 +30,36 @@ $$ = (selector, root) ->
|
|||||||
result = root.querySelectorAll(selector)
|
result = root.querySelectorAll(selector)
|
||||||
#magic that turns the results object into an array:
|
#magic that turns the results object into an array:
|
||||||
node for node in result
|
node for node in result
|
||||||
inBefore = (root, el) ->
|
getConfig = (name) ->
|
||||||
root.parentNode.insertBefore(el, root)
|
GM_getValue(name, config[name])
|
||||||
inAfter = (root, el) ->
|
|
||||||
root.parentNode.insertBefore(el, root.nextSibling)
|
|
||||||
tag = (el) ->
|
|
||||||
document.createElement(el)
|
|
||||||
hide = (el) ->
|
|
||||||
el.style.display = 'none'
|
|
||||||
show = (el) ->
|
|
||||||
el.style.display = ''
|
|
||||||
remove = (el) ->
|
|
||||||
el.parentNode.removeChild(el)
|
|
||||||
replace = (root, el) ->
|
|
||||||
root.parentNode.replaceChild(el, root)
|
|
||||||
getTime = ->
|
getTime = ->
|
||||||
Math.floor(new Date().getTime() / 1000)
|
Math.floor(new Date().getTime() / 1000)
|
||||||
|
hide = (el) ->
|
||||||
|
el.style.display = 'none'
|
||||||
|
inAfter = (root, el) ->
|
||||||
|
root.parentNode.insertBefore(el, root.nextSibling)
|
||||||
|
inBefore = (root, el) ->
|
||||||
|
root.parentNode.insertBefore(el, root)
|
||||||
n = (tag, props) -> #new
|
n = (tag, props) -> #new
|
||||||
el = document.createElement tag
|
el = document.createElement tag
|
||||||
if props then (el[key] = val) for key, val of props
|
if props then (el[key] = val) for key, val of props
|
||||||
el
|
el
|
||||||
|
position = (el) ->
|
||||||
|
id = el.id
|
||||||
|
if left = GM_getValue("#{id}Left", '0px')
|
||||||
|
el.style.left = left
|
||||||
|
else
|
||||||
|
el.style.right = '0px'
|
||||||
|
if top = GM_getValue("#{id}Top", '0px')
|
||||||
|
el.style.top = top
|
||||||
|
else
|
||||||
|
el.style.bottom = '0px'
|
||||||
|
remove = (el) ->
|
||||||
|
el.parentNode.removeChild(el)
|
||||||
|
replace = (root, el) ->
|
||||||
|
root.parentNode.replaceChild(el, root)
|
||||||
|
show = (el) ->
|
||||||
|
el.style.display = ''
|
||||||
slice = (arr, id) ->
|
slice = (arr, id) ->
|
||||||
# the while loop is the only low-level loop left in coffeescript.
|
# the while loop is the only low-level loop left in coffeescript.
|
||||||
# we need to use it to see the index.
|
# we need to use it to see the index.
|
||||||
@ -64,24 +71,19 @@ slice = (arr, id) ->
|
|||||||
arr.splice(i, 1)
|
arr.splice(i, 1)
|
||||||
return arr
|
return arr
|
||||||
i++
|
i++
|
||||||
position = (el) ->
|
tag = (el) ->
|
||||||
id = el.id
|
document.createElement(el)
|
||||||
if left = GM_getValue("#{id}Left", '0px')
|
x = (path, root) ->
|
||||||
el.style.left = left
|
root or= document.body
|
||||||
else
|
document.
|
||||||
el.style.right = '0px'
|
evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).
|
||||||
if top = GM_getValue("#{id}Top", '0px')
|
singleNodeValue
|
||||||
el.style.top = top
|
|
||||||
else
|
|
||||||
el.style.bottom = '0px'
|
|
||||||
|
|
||||||
|
|
||||||
# x-browser
|
# x-browser
|
||||||
if typeof GM_deleteValue == 'undefined'
|
if typeof GM_deleteValue == 'undefined'
|
||||||
this.GM_setValue = (name, value) ->
|
this.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) ->
|
this.GM_getValue = (name, defaultValue) ->
|
||||||
if not value = localStorage.getItem(name)
|
if not value = localStorage.getItem(name)
|
||||||
return defaultValue
|
return defaultValue
|
||||||
@ -94,13 +96,13 @@ if typeof GM_deleteValue == 'undefined'
|
|||||||
return Number(value)
|
return Number(value)
|
||||||
else
|
else
|
||||||
return value
|
return value
|
||||||
|
|
||||||
this.GM_addStyle = (css) ->
|
this.GM_addStyle = (css) ->
|
||||||
style = tag('style')
|
style = tag('style')
|
||||||
style.type = 'text/css'
|
style.type = 'text/css'
|
||||||
style.textContent = css
|
style.textContent = css
|
||||||
$('head', document).appendChild(style)
|
$('head', document).appendChild(style)
|
||||||
|
|
||||||
|
#let's get this party started.
|
||||||
watched = JSON.parse(GM_getValue('watched', '{}'))
|
watched = JSON.parse(GM_getValue('watched', '{}'))
|
||||||
if location.hostname.split('.')[0] is 'sys'
|
if location.hostname.split('.')[0] is 'sys'
|
||||||
if b = $('table font b')
|
if b = $('table font b')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user