-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.js
43 lines (39 loc) · 1.33 KB
/
init.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
plugin.loadLang();
if(plugin.canChangeMenu())
{
theWebUI.getWebSeedSource = function( id )
{
$("#webseedsrchash").val(id);
$("#getWebSeedSource").submit();
}
plugin.createMenu = theWebUI.createMenu;
theWebUI.createMenu = function( e, id )
{
plugin.createMenu.call(this, e, id);
if(plugin.enabled)
{
var el = theContextMenu.get( theUILang.Properties );
if( el )
theContextMenu.add( el, [theUILang.getWebSeedSource, (this.getTable("trt").selCount > 1) || (id.length>40) ? null : "theWebUI.getWebSeedSource('" + id + "')"] );
}
}
}
plugin.onLangLoaded = function()
{
$(document.body).append($("<iframe name='webseedsrcfrm'/>").css({visibility: "hidden"}).attr( { name: "webseedsrcfrm", id: "webseedsrcfrm" } ).width(0).height(0).load(function()
{
$("#webseedsrchash").val('');
var d = (this.contentDocument || this.contentWindow.document);
if(d && (d.location.href != "about:blank"))
try { eval(d.body.textContent ? d.body.textContent : d.body.innerText); } catch(e) {}
}));
$(document.body).append(
$('<form action="plugins/webseedsource/action.php" id="getWebSeedSource" method="get" target="webseedsrcfrm">'+
'<input type="hidden" name="hash" id="webseedsrchash" value="">'+
'</form>').width(0).height(0));
}
plugin.onRemove = function()
{
$('#webseedsrcfrm').remove();
$('#getWebSeedSource').remove();
}