-
Notifications
You must be signed in to change notification settings - Fork 1
/
afterthedeadline.js
85 lines (71 loc) · 2.78 KB
/
afterthedeadline.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(function(){
var pluginName = "afterthedeadline";
var plugin = function(){
$lib = AtKit.lib();
// Internationalisation
AtKit.addLocalisationMap("en", {
"spell_title" : "Start AfterTheDeadline"
});
AtKit.addLocalisationMap("ar", {
"spell_title" : "التدقٌق االمالٔيً"
});
// Spell checker
AtKit.addButton(
'afterthedeadline',
AtKit.localisation("spell_title"),
AtKit.getPluginURL() + 'images/spell-off.png',
function(dialogs, functions){
if (typeof AtD != 'undefined') return;
var loadresource = function (tag, link, type, breakc) {
var d = new Date();
var breakCache = breakc ? '?ver=' + d.getMonth() + '.' + d.getYear() + '.5' : '';
var res = document.createElement(tag);
res.type = type;
if (tag == 'link') {
res.href = link + breakCache;
res.rel = 'stylesheet';
} else {
res.src = link + breakCache;
}
document.getElementsByTagName('head')[0].appendChild(res);
};
if (typeof jQuery == 'undefined') {
loadresource('SCRIPT', 'https://core.atbar.org/resources/jquery/1.8/jquery.min.js', 'text/javascript', false);
setTimeout(function () {
if (typeof jQuery != 'undefined') jQuery.noConflict();
else setTimeout(this, 1000);
}, 1000);
}
loadresource('SCRIPT', 'http://static.afterthedeadline.com/atd-jquery/scripts/jquery.atd.textarea.js', 'text/javascript', true);
loadresource('SCRIPT', 'http://static.afterthedeadline.com/atd-jquery/scripts/csshttprequest.js', 'text/javascript', true);
loadresource('link', 'http://static.afterthedeadline.com/atd-jquery/css/atd.css', 'text/css', true);
setTimeout(function () {
if (typeof AtD != 'undefined' && typeof jQuery != 'undefined') {
AtD.rpc_css = 'http://www.polishmywriting.com/bookmarklet/proxycss.php?data=';
$lib('textarea').addProofreader();
} else {
setTimeout(this, 1000);
}
}, 1000);
},
null, null
);
}
if(typeof window['AtKit'] == "undefined"){
window.AtKitLoaded = function(){
var eventAction = null;
this.subscribe = function(fn) {
eventAction = fn;
};
this.fire = function(sender, eventArgs) {
if (eventAction != null) {
eventAction(sender, eventArgs);
}
};
}
window['AtKitLoaded'] = new AtKitLoaded();
window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
} else {
AtKit.registerPlugin(pluginName, plugin);
}
})();