Revision 22201e1a
Added by VinÃcius Coque over 13 years ago
usr/local/www/filebrowser/browser.js | ||
---|---|---|
2 | 2 |
pfSense_MODULE: shell |
3 | 3 |
*/ |
4 | 4 |
|
5 |
Event.observe( |
|
6 |
window, "load", |
|
5 |
jQuery(document).ready( |
|
7 | 6 |
function() { |
8 |
Event.observe( |
|
9 |
"fbOpen", "click", |
|
7 |
jQuery("#fbOpen").click( |
|
10 | 8 |
function() { |
11 |
Effect.Appear("fbBrowser", { duration: 0.75 });
|
|
12 |
fbBrowse($("fbTarget").value);
|
|
9 |
jQuery("#fbBrowser").fadeIn(750);
|
|
10 |
fbBrowse(jQuery("#fbTarget").val());
|
|
13 | 11 |
} |
14 | 12 |
); |
15 | 13 |
} |
16 | 14 |
); |
17 | 15 |
|
18 | 16 |
function fbBrowse(path) { |
19 |
new Effect.Fade("fileContent");
|
|
17 |
jQuery("#fileContent").fadeOut();
|
|
20 | 18 |
|
21 |
if($("fbCurrentDir"))
|
|
22 |
$("fbCurrentDir").innerHTML = "Loading ...";
|
|
19 |
if(jQuery("#fbCurrentDir"))
|
|
20 |
jQuery("#fbCurrentDir").html("Loading ...");
|
|
23 | 21 |
|
24 |
new Ajax.Request(
|
|
22 |
jQuery.ajax(
|
|
25 | 23 |
"/filebrowser/browser.php?path=" + encodeURI(path ? path : "/"), |
26 |
{ method: "get", onComplete: fbComplete }
|
|
24 |
{ type: "get", complete: fbComplete }
|
|
27 | 25 |
); |
28 | 26 |
|
29 | 27 |
} |
30 | 28 |
|
31 | 29 |
function fbComplete(req) { |
32 |
$("fbBrowser").innerHTML = req.responseText;
|
|
30 |
jQuery("#fbBrowser").html(req.responseText);
|
|
33 | 31 |
|
34 | 32 |
var actions = { |
35 | 33 |
fbHome: function() { fbBrowse("/"); }, |
36 |
fbClose: function() { Effect.Fade("fbBrowser", { duration: 0.75 }); },
|
|
34 |
fbClose: function() { jQuery("#fbBrowser").fadeOut(750); },
|
|
37 | 35 |
fbDir: function() { fbBrowse(this.id); }, |
38 |
fbFile: function() { $("fbTarget").value = this.id; }
|
|
36 |
fbFile: function() { jQuery("#fbTarget").val(this.id); }
|
|
39 | 37 |
} |
40 | 38 |
|
41 | 39 |
for(var type in actions) { |
42 |
$A(Element.getElementsByClassName("fbBrowser", type)).each(
|
|
43 |
function(element) {
|
|
44 |
Event.observe(element, "click", actions[type]);
|
|
45 |
element.style.cursor = "pointer";
|
|
40 |
jQuery("#fbBrowser ." + type).each(
|
|
41 |
function() { |
|
42 |
jQuery(this).click(actions[type]);
|
|
43 |
jQuery(this).css("cursor","pointer");
|
|
46 | 44 |
} |
47 | 45 |
); |
48 | 46 |
} |
usr/local/www/filebrowser/browser.php | ||
---|---|---|
37 | 37 |
<table width="100%"> |
38 | 38 |
<tr> |
39 | 39 |
<td class="fbHome" width="25px" align="left"> |
40 |
<img onClick="$('fbTarget').value='<?=$realDir?>'; fbBrowse('/');" src="/filebrowser/images/icon_home.gif" alt="Home" title="Home" />
|
|
40 |
<img onClick="jQuery('#fbTarget').val('<?=$realDir?>'); fbBrowse('/');" src="/filebrowser/images/icon_home.gif" alt="Home" title="Home" />
|
|
41 | 41 |
</td> |
42 | 42 |
<td><b><?=$path;?></b></td> |
43 | 43 |
<td class="fbClose" align="right"> |
44 |
<img onClick="new Effect.Fade($('fbBrowser'));" border="0" src="/filebrowser/images/icon_cancel.gif" alt="Close" title="Close" />
|
|
44 |
<img onClick="jQuery('#fbBrowser').fadeOut();" border="0" src="/filebrowser/images/icon_cancel.gif" alt="Close" title="Close" />
|
|
45 | 45 |
</td> |
46 | 46 |
</tr> |
47 | 47 |
<tr> |
... | ... | |
74 | 74 |
<tr> |
75 | 75 |
<td></td> |
76 | 76 |
<td class="fbDir vexpl" id="<?=$realDir;?>" align="left"> |
77 |
<div onClick="$('fbTarget').value='<?=$realDir?>'; fbBrowse('<?=$realDir?>');">
|
|
77 |
<div onClick="jQuery('#fbTarget').val('<?=$realDir?>'); fbBrowse('<?=$realDir?>');">
|
|
78 | 78 |
<img src="/filebrowser/images/folder_generic.gif" /> |
79 | 79 |
<?=$dir;?> |
80 | 80 |
</div> |
... | ... | |
122 | 122 |
<td></td> |
123 | 123 |
<td class="fbFile vexpl" id="<?=$fqpn;?>" align="left"> |
124 | 124 |
<?php $filename = str_replace("//","/", "{$path}/{$file}"); ?> |
125 |
<div onClick="$('fbTarget').value='<?=$filename?>'; loadFile(); new Effect.Fade($('fbBrowser'));">
|
|
125 |
<div onClick="jQuery('#fbTarget').val('<?=$filename?>'); loadFile(); jQuery('#fbBrowser').fadeOut();">
|
|
126 | 126 |
<img src="/filebrowser/images/file_<?=$type;?>.gif" alt="" title=""> |
127 | 127 |
<?=$file;?> |
128 | 128 |
</div> |
Also available in: Unified diff
converting browser JS code from scriptaculous to jQuery