-
Notifications
You must be signed in to change notification settings - Fork 91
/
fuckit.coffee
49 lines (33 loc) · 950 Bytes
/
fuckit.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
###
FuckItJS v2.0.0-alpha
Note: this is ALPHA software and may result in
irreversible brain damage
###
$ ->
$.ajaxSetup { cache: true }
_FuckIt = window.FuckIt;
FuckIt = (script) ->
req = $.ajax {
url: script,
dataType: 'text'
}
success = (result) ->
window.fuckedScript = result
eval window.fuckedScript
error = ->
throw new Error "Could not load script: #{script}"
req.then success, error
window.onError = (error, url, line) ->
if not window.fuckedScript then return
parsed = window.fuckedScript.split "\n"
parsed.splice line - 1, 1
window.fuckedScript = parsed.join "\n"
$.getScript 'FuckIt.js', () ->
eval window.fuckedScript
return true
FuckIt.noConflict = () ->
window.FuckIt = _FuckIt
FuckIt
FuckIt.moreConflict = () ->
window[prop] = FuckIt for prop in window when prop isnt 'location'
window.FuckIt = FuckIt;