Third pass at adding key files
BIN
site/slowtwitch.com/www/articles/static/fileman/clear_shim.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/colorchart.jpg
Normal file
After Width: | Height: | Size: 4.1 KiB |
479
site/slowtwitch.com/www/articles/static/fileman/fileman.js
Normal file
@ -0,0 +1,479 @@
|
||||
var ie = (document.all) ? true: false;
|
||||
var dialogFunc = new Object();
|
||||
|
||||
function CheckAll(cb) {
|
||||
if (wasDownload()) return;
|
||||
var main_form = window.top.mainfrm.document.frm_main ;
|
||||
var count = 0;
|
||||
var total_space = 0;
|
||||
var num_selected = 0;
|
||||
if (typeof(main_form.dparent) != 'undefined') count = 1;
|
||||
|
||||
for (var i=0;i<main_form.elements.length;i++) {
|
||||
var e = main_form.elements[i];
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox')) count++;
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox') && (!e.disabled)) {
|
||||
e.checked = main_form.allbox.checked;
|
||||
if (e.checked && !isNaN(parseInt(eval('window.top.mainfrm.document.frm_main.size'+count).value)))
|
||||
total_space = total_space + parseInt(eval('window.top.mainfrm.document.frm_main.size'+count).value);
|
||||
|
||||
if (e.checked) {
|
||||
hL(e);
|
||||
num_selected++;
|
||||
}
|
||||
else dL(e);
|
||||
}
|
||||
}
|
||||
top.mainfrm.show_msg(print_filesize(total_space), num_selected);
|
||||
}
|
||||
|
||||
function hL(E){
|
||||
if (ie) {
|
||||
while (E.tagName!="TR") { E=E.parentElement; }
|
||||
}
|
||||
else {
|
||||
while (E.tagName!="TR") { E=E.parentNode; }
|
||||
}
|
||||
E.className = "highlight";
|
||||
}
|
||||
|
||||
function dL(E){
|
||||
if (ie) {
|
||||
while (E.tagName!="TR") { E=E.parentElement; }
|
||||
}
|
||||
else {
|
||||
while (E.tagName!="TR") { E=E.parentNode; }
|
||||
}
|
||||
fillColor();
|
||||
}
|
||||
|
||||
function fillColor () {
|
||||
var count = 0;
|
||||
var mytable = window.top.mainfrm.document.getElementById('tabMain');
|
||||
if (!mytable) return;
|
||||
|
||||
var rows = mytable.rows;
|
||||
var fmobj = window.top.mainfrm.document.frm_main.c_edit ;
|
||||
var j = 0;
|
||||
var tmp = (typeof(window.top.mainfrm.document.frm_main.dparent) != 'undefined') ? 2 : 1;
|
||||
for (var i=tmp; i < rows.length; i++) {
|
||||
j = i - tmp;
|
||||
if (typeof(fmobj[j]) != 'undefined' && fmobj[j].checked == true) rows[i].className = 'highlight';
|
||||
else rows[i].className = (i % 2 == 0) ? 'bg_main' : 'background';
|
||||
}
|
||||
}
|
||||
|
||||
function CheckCheckAll(cb) {
|
||||
if (wasDownload()) return;
|
||||
|
||||
if (cb.checked) hL(cb);
|
||||
else dL(cb);
|
||||
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
var total_boxes = 0;
|
||||
var total_on = 0;
|
||||
var total_space = 0;
|
||||
var count = 0;
|
||||
if (typeof(main_form.dparent) != 'undefined') count = 1;
|
||||
for (var i=0; i<main_form.elements.length; i++) {
|
||||
var e = main_form.elements[i];
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox')) {
|
||||
total_boxes++;
|
||||
count++;
|
||||
if (e.checked) {
|
||||
total_on++;
|
||||
if (!isNaN(parseInt(eval('window.top.mainfrm.document.frm_main.size' + count).value)))
|
||||
total_space = total_space + parseInt(eval('window.top.mainfrm.document.frm_main.size'+count).value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (total_boxes == total_on) main_form.allbox.checked = true;
|
||||
else main_form.allbox.checked = false;
|
||||
top.mainfrm.show_msg(print_filesize(total_space), total_on);
|
||||
}
|
||||
|
||||
function init_chmod() {
|
||||
var bottom_form = top.bottomfrm.document.frm_footer;
|
||||
var u_mod=0, g_mod=0, w_mod =0, a_mod=0;
|
||||
|
||||
if (bottom_form.ar.checked) a_mod = 4;
|
||||
if (bottom_form.ur.checked) u_mod = 4;
|
||||
if (bottom_form.gr.checked) g_mod = 4;
|
||||
if (bottom_form.wr.checked) w_mod = 4;
|
||||
|
||||
if (bottom_form.aw.checked) a_mod += 2;
|
||||
if (bottom_form.uw.checked) u_mod += 2;
|
||||
if (bottom_form.gw.checked) g_mod += 2;
|
||||
if (bottom_form.ww.checked) w_mod += 2;
|
||||
|
||||
if (bottom_form.ax.checked) a_mod++;
|
||||
if (bottom_form.ux.checked) u_mod++;
|
||||
if (bottom_form.gx.checked) g_mod++;
|
||||
if (bottom_form.wx.checked) w_mod++;
|
||||
|
||||
bottom_form.txt_input.value = a_mod + '' + u_mod + '' + g_mod + '' + w_mod ;
|
||||
}
|
||||
|
||||
function show_chmod(name,perm) {
|
||||
if (top.wasDownload()) return;
|
||||
|
||||
js_cmd_chmod(); // Print the chmod form
|
||||
var bottom_form = window.top.bottomfrm.document.frm_footer;
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
for (var i=0;i<main_form.elements.length;i++) {
|
||||
var e = main_form.elements[i];
|
||||
if (e.checked && ie) dL(e);
|
||||
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox') && (e.value == name)) {
|
||||
e.checked = true;
|
||||
if (ie) hL(e);
|
||||
}
|
||||
else {
|
||||
e.checked = false;
|
||||
}
|
||||
}
|
||||
window.top.bottomfrm.document.getElementById('d_status').innerHTML = '<font color=green>chmod of <b>' + name + '</font></b>';
|
||||
|
||||
if (perm.length == 16) {
|
||||
if (perm.substr(0,1) == 'r') bottom_form.ar.checked = true;
|
||||
if (perm.substr(1,1) == 'w') bottom_form.aw.checked = true;
|
||||
if (perm.substr(2,1) == 'x') bottom_form.ax.checked = true;
|
||||
if (perm.substr(4,1) == 'r') bottom_form.ur.checked = true;
|
||||
if (perm.substr(5,1) == 'w') bottom_form.uw.checked = true;
|
||||
if (perm.substr(6,1) == 'x') bottom_form.ux.checked = true;
|
||||
if (perm.substr(8,1) == 'r') bottom_form.gr.checked = true;
|
||||
if (perm.substr(9,1) == 'w') bottom_form.gw.checked = true;
|
||||
if (perm.substr(10,1)== 'x') bottom_form.gx.checked = true;
|
||||
if (perm.substr(12,1)== 'r') bottom_form.wr.checked = true;
|
||||
if (perm.substr(13,1)== 'w') bottom_form.ww.checked = true;
|
||||
if (perm.substr(14,1)== 'x') bottom_form.wx.checked = true;
|
||||
}
|
||||
else {
|
||||
if (perm.substr(0,1) == 'r') bottom_form.ur.checked = true;
|
||||
if (perm.substr(1,1) == 'w') bottom_form.uw.checked = true;
|
||||
if (perm.substr(2,1) == 'x') bottom_form.ux.checked = true;
|
||||
if (perm.substr(4,1) == 'r') bottom_form.gr.checked = true;
|
||||
if (perm.substr(5,1) == 'w') bottom_form.gw.checked = true;
|
||||
if (perm.substr(6,1) == 'x') bottom_form.gx.checked = true;
|
||||
if (perm.substr(8,1) == 'r') bottom_form.wr.checked = true;
|
||||
if (perm.substr(9,1) == 'w') bottom_form.ww.checked = true;
|
||||
if (perm.substr(10,1)== 'x') bottom_form.wx.checked = true;
|
||||
}
|
||||
init_chmod();
|
||||
top.mainfrm.show_msg('0',1);
|
||||
}
|
||||
|
||||
function checkSelected(multi) {
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
var count = 0, _checked;
|
||||
for (var i=0; i<main_form.elements.length; i++) {
|
||||
var e = main_form.elements[i];
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox')&& (e.checked)) {
|
||||
_checked = true;
|
||||
count++;
|
||||
}
|
||||
if (count>1) break;
|
||||
}
|
||||
if (!_checked) {
|
||||
return (multi) ? ('Please select the files or directories.') : ('Please select a file.');
|
||||
}
|
||||
if (count > 1 && multi == false) return 'Can not execute the command because the selected file more than one.';
|
||||
return;
|
||||
}
|
||||
|
||||
function checkFMCommand(error, isnum) {
|
||||
if (top.wasDownload()) return;
|
||||
if (!window.top.bottomfrm.document.frm_footer.txt_input.value) return error;
|
||||
|
||||
if (isnum && isNaN(window.top.bottomfrm.document.frm_footer.txt_input.value)) return 'This field is a number';
|
||||
return;
|
||||
}
|
||||
|
||||
function checkSearch() {
|
||||
var bottom_form = top.bottomfrm.document.frm_footer;
|
||||
if (!bottom_form.txt_input.value) return 'Please enter file name or content you wish to search for';
|
||||
if (bottom_form.scope.selectedIndex == 1) return checkSelected(true);
|
||||
}
|
||||
|
||||
function checkReplace() {
|
||||
if (top.wasDownload()) return;
|
||||
|
||||
var bottom_form = top.bottomfrm.document.frm_footer;
|
||||
if (!bottom_form.txt_input.value) return 'Please enter the content you wish to search for';
|
||||
if (!bottom_form.txt_with.value) return 'Please enter the content you wish to replace with';
|
||||
if (bottom_form.scope.selectedIndex == 1) return top.checkSelected(true);
|
||||
}
|
||||
|
||||
function checkUpload(){
|
||||
if (top.wasDownload()) return;
|
||||
|
||||
var bottom_form = top.bottomfrm.document.frm_footer;
|
||||
if (!bottom_form.txt_input.value) alert('Please select the file you wish to upload');
|
||||
else {
|
||||
bottom_form.work_path.value = top.mainfrm.document.frm_main.work_path.value;
|
||||
bottom_form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function checkDownload(srv_soft) {
|
||||
if (wasDownload()) return false;
|
||||
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
var bottom_form = window.top.bottomfrm.document.frm_footer;
|
||||
if (!isMainForm(true)) return false;
|
||||
|
||||
var name, count = 0;
|
||||
for (var i=0;i<main_form.elements.length;i++) {
|
||||
var e = main_form.elements[i];
|
||||
if ((e.name != 'allbox') && (e.type=='checkbox')&& (e.checked)) {
|
||||
name = e.value;
|
||||
count++;
|
||||
}
|
||||
if (count > 1) { break; }
|
||||
}
|
||||
if (typeof(name) == 'undefined') {
|
||||
alert("Please select files and directories to download");
|
||||
return false;
|
||||
}
|
||||
if ( count > 1 && ( bottom_form.zip_type.selectedIndex == 0 || bottom_form.type[0].checked || bottom_form.type[2].checked ) ) {
|
||||
alert("If you want to download multiple files, it requires either 'Binary' and 'Compressed' mods");
|
||||
return false;
|
||||
}
|
||||
main_form.cmd_do.value = 'cmd_download';
|
||||
if (!srv_soft) {
|
||||
if ( main_form.action == '') main_form.action = 'fileman.cgi';
|
||||
main_form.action += "/" + name;
|
||||
}
|
||||
if ( bottom_form.type.selectedIndex == 0 ) { main_form.chmode.value = 'ascii'; }
|
||||
else if ( bottom_form.type.selectedIndex == 1 ) { main_form.chmode.value = 'binary'; }
|
||||
else if ( bottom_form.type.selectedIndex == 2 ) { main_form.chmode.value = 'auto'; }
|
||||
main_form.opt_gz.value = bottom_form.zip_type.options[bottom_form.zip_type.selectedIndex].value;
|
||||
main_form.submit();
|
||||
workPath = main_form.work_path.value;
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkCommand(funcReturn, not_required) {
|
||||
var bottom_form = window.top.bottomfrm.document.frm_footer;
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
|
||||
if (funcReturn) dialogFunc.returnFunc = funcReturn;
|
||||
|
||||
if (top.wasDownload()) return false;
|
||||
if (typeof(main_form) == 'unknown' || typeof(main_form) == 'undefined') {
|
||||
alert("Please return to main screen and execute the command again");
|
||||
return false;
|
||||
}
|
||||
var msg;
|
||||
var act = new Array(10);
|
||||
var cmd_do = bottom_form.cmd_do.value;
|
||||
var input = bottom_form.txt_input.value;
|
||||
act[0] = 'cmd_copy';
|
||||
act[1] = 'cmd_delete';
|
||||
act[2] = 'cmd_move';
|
||||
act[3] = 'cmd_chmod';
|
||||
act[5] = 'cmd_perl';
|
||||
act[6] = 'cmd_tar';
|
||||
act[7] = 'cmd_download';
|
||||
act[4] = 'cmd_tail';
|
||||
act[8] = 'cmd_diff';
|
||||
act[9] = 'cmd_command';
|
||||
if ( !not_required ) {
|
||||
for (ii=0; ii< act.length; ii++) {
|
||||
if (act[ii] == cmd_do) {
|
||||
if (cmd_do == 'cmd_tail' || cmd_do == 'cmd_diff' || cmd_do == 'cmd_perl') {
|
||||
if (typeof(main_form.type) == 'undefined') msg = checkSelected(false);
|
||||
}
|
||||
else if (cmd_do == 'cmd_command') {
|
||||
msg = checkSelected(false);
|
||||
}
|
||||
else {
|
||||
msg = checkSelected(true)
|
||||
}
|
||||
if (msg) {
|
||||
alert(msg);
|
||||
return false;
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cmd_do != 'cmd_perl' && cmd_do != 'cmd_uncompress' && funcReturn) {
|
||||
msg = dialogFunc.returnFunc;
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
alert(msg); return false;
|
||||
}
|
||||
switch (cmd_do) {
|
||||
case 'cmd_uncompress':
|
||||
var uncomp_option = bottom_form.uncom_option;
|
||||
main_form.uncomp_option.value = uncomp_option.options[uncomp_option.selectedIndex].value;
|
||||
break;
|
||||
case 'cmd_tar':
|
||||
if (typeof(bottom_form.opt_gz) != 'undefined' && bottom_form.opt_gz.checked) {
|
||||
main_form.opt_gz.value = 1;
|
||||
}
|
||||
else if (typeof(bottom_form.archive_type) != 'undefined') {
|
||||
var archive_type = bottom_form.archive_type;
|
||||
main_form.opt_gz.value = archive_type.options[archive_type.selectedIndex].value;
|
||||
}
|
||||
break;
|
||||
case 'cmd_search':
|
||||
main_form.scope.value = 0;
|
||||
if (bottom_form.scope.selectedIndex == 1) main_form.scope.value = 1;
|
||||
if (bottom_form.c_case.checked) main_form.c_case.value = 1;
|
||||
if (bottom_form.c_regex.checked) main_form.c_regex.value = 1;
|
||||
if (bottom_form.c_content.checked) main_form.c_content.value = 1;
|
||||
break;
|
||||
case 'cmd_replace':
|
||||
main_form.scope.value = 0;
|
||||
if (bottom_form.scope.selectedIndex == 1) main_form.scope.value = 1;
|
||||
if (bottom_form.c_case.checked) main_form.c_case.value = 1;
|
||||
if (bottom_form.c_regex.checked) main_form.c_regex.value = 1;
|
||||
if (bottom_form.c_word.checked) main_form.c_word.value = 1;
|
||||
if (bottom_form.c_bak.checked) main_form.c_bak.value = 1;
|
||||
main_form.txt_with.value = bottom_form.txt_with.value;
|
||||
break;
|
||||
case 'cmd_tail':
|
||||
var objtime = bottom_form.retime.options;
|
||||
main_form.retime.value = objtime[objtime.selectedIndex].value;
|
||||
break;
|
||||
case 'cmd_chmod':
|
||||
if (typeof(bottom_form.recursive) != 'undefined' && bottom_form.recursive.checked) main_form.opt_gz.value = 1;
|
||||
}
|
||||
if (cmd_do != 'cmd_tail') bottom_form.txt_input.value = '';
|
||||
main_form.cmd_do.value = cmd_do;
|
||||
main_form.txt_input.value = input;
|
||||
main_form.submit();
|
||||
if (cmd_do != 'cmd_tail') bottom_form.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
function run_command () {
|
||||
if (top.wasDownload()) return;
|
||||
|
||||
var bottom_form = window.top.bottomfrm.document.frm_footer;
|
||||
var main_form = window.top.mainfrm.document.frm_main;
|
||||
var msg;
|
||||
if (typeof(main_form.type) == 'undefined') msg = checkSelected(false);
|
||||
if (msg) { alert(msg); return; }
|
||||
main_form.cmd_do.value = bottom_form.cmd_do.value;
|
||||
main_form.txt_input.value = bottom_form.txt_input.value;
|
||||
main_form.submit();
|
||||
}
|
||||
|
||||
function load_progress_bar (pxs, percent, msg) {
|
||||
var bottom_doc = window.top.bottomfrm.document
|
||||
var sp_msg = bottom_doc.getElementById('msg');
|
||||
var sp_per = bottom_doc.getElementById('percent');
|
||||
var sp_img = bottom_doc.getElementById('progress');
|
||||
if (typeof(sp_img) != 'undefined') {
|
||||
var wimg = sp_img.width;
|
||||
if ( pxs == 0 ) {
|
||||
sp_per.innerHTML = "0";
|
||||
sp_msg.innerHTML = "The selected files has been copied";
|
||||
}
|
||||
else {
|
||||
sp_img.width = Number(pxs);
|
||||
sp_per.innerHTML = percent;
|
||||
sp_msg.innerHTML = "Processing... " + msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function additem(objright, objleft, flag){
|
||||
//--------------------------------
|
||||
if (flag == 1) {// add all
|
||||
var src = eval(objleft);
|
||||
var rows = src.options.length
|
||||
for (ii=1; ii< rows ; ii++) {
|
||||
moveitem(eval(objleft), eval(objright), 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
moveitem(eval(objleft), eval(objright));
|
||||
}
|
||||
}
|
||||
|
||||
function removeitem(objright, objleft, flag){
|
||||
//------------------------------------
|
||||
if (flag == 1) {// move all
|
||||
var src = eval(objright);
|
||||
var rows = src.options.length
|
||||
for (ii=1; ii< rows ; ii++) {
|
||||
moveitem(eval(objright), eval(objleft), 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
moveitem(eval(objright),eval(objleft));
|
||||
}
|
||||
}
|
||||
|
||||
function moveitem (src, tar, index) {
|
||||
var li_rows = tar.options.length
|
||||
var li_index = (index > 0) ? index : src.selectedIndex;
|
||||
var objs = 0;
|
||||
|
||||
if (li_index <= 0) { alert("Please select an item."); return; }
|
||||
|
||||
// get value & text from objright
|
||||
var text = src.options[li_index].text
|
||||
var value = src.options[li_index].value
|
||||
|
||||
// add item into lbleft from lbright.
|
||||
if (li_rows==0) {
|
||||
tar.options[0] = new Option(text, value);
|
||||
}
|
||||
else {
|
||||
tar.options[li_rows] = new Option(text,value);
|
||||
tar.options[li_rows].selected = true
|
||||
}
|
||||
|
||||
for (m=src.options.length-1;m>=0;m--){
|
||||
if (src.options[m].value==value) src.options[m]=null;
|
||||
}
|
||||
}
|
||||
|
||||
function setFocus(object) {
|
||||
if (object) {
|
||||
if (typeof(object) != 'undefined') object.focus();
|
||||
}
|
||||
else {
|
||||
var top_form = top.topfrm.document.frm_top;
|
||||
if (typeof(top_form) != 'undefined') top_form.txt_input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function rs(n, u, w, h, l, t, s) {
|
||||
var args ="width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",resizable=no,scrollbars=" + s + ",status=0,titlebar=0";
|
||||
var remote =window.open(u, n, args);
|
||||
if (remote != null) {
|
||||
if (remote.opener == null)
|
||||
remote.opener = self;
|
||||
}
|
||||
}
|
||||
|
||||
function outputComma(number) {
|
||||
number = '' + number
|
||||
if (number.length > 3) {
|
||||
var mod = number.length%3;
|
||||
var output = (mod > 0 ? (number.substring(0,mod)) : '');
|
||||
for (i=0 ; i < Math.floor(number.length/3) ; i++) {
|
||||
if (mod == 0 && i == 0) output+= number.substring(mod + 3 * i, mod + 3 * i + 3);
|
||||
else output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
|
||||
}
|
||||
return (output);
|
||||
}
|
||||
else return number;
|
||||
}
|
||||
|
||||
function print_filesize(size) {
|
||||
var formatted_size = 0;
|
||||
|
||||
if (size > 0) formatted_size = parseInt(size / 1000);
|
||||
else return 0;
|
||||
|
||||
if (formatted_size == 0) return size + 'b';
|
||||
else return outputComma(formatted_size) + 'kb';
|
||||
}
|
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/17copy.jpg
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/18move.jpg
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/19chmod.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/20tail.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/22diff.jpg
Normal file
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/actions.gif
Normal file
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 15 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/command.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/fig2.gif
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/fig3.gif
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/fig6.gif
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/fig7.gif
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/newfile.gif
Normal file
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.1 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/protect.gif
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/replace.gif
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/search.gif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/toolbar.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/tools.gif
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/help/upload.gif
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/1pixel.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/back.gif
Normal file
After Width: | Height: | Size: 193 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/binary.gif
Normal file
After Width: | Height: | Size: 246 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/close.gif
Normal file
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 1.0 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/doc.gif
Normal file
After Width: | Height: | Size: 163 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/down.gif
Normal file
After Width: | Height: | Size: 61 B |
After Width: | Height: | Size: 1.5 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/first.gif
Normal file
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 72 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/folder.gif
Normal file
After Width: | Height: | Size: 147 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/ie.gif
Normal file
After Width: | Height: | Size: 915 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/image2.gif
Normal file
After Width: | Height: | Size: 309 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/last.gif
Normal file
After Width: | Height: | Size: 207 B |
After Width: | Height: | Size: 71 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/next.gif
Normal file
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 58 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/p.gif
Normal file
After Width: | Height: | Size: 237 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/parent.gif
Normal file
After Width: | Height: | Size: 216 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/pdf.gif
Normal file
After Width: | Height: | Size: 161 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/prev.gif
Normal file
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 58 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/quill.gif
Normal file
After Width: | Height: | Size: 267 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/script.gif
Normal file
After Width: | Height: | Size: 242 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/sound.gif
Normal file
After Width: | Height: | Size: 204 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/sound1.gif
Normal file
After Width: | Height: | Size: 248 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/text.gif
Normal file
After Width: | Height: | Size: 124 B |
After Width: | Height: | Size: 245 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/up.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
site/slowtwitch.com/www/articles/static/fileman/icons/xls.gif
Normal file
After Width: | Height: | Size: 161 B |
467
site/slowtwitch.com/www/articles/static/fileman/js/date.js
Normal file
@ -0,0 +1,467 @@
|
||||
/*
|
||||
* Date prototype extensions. Doesn't depend on any
|
||||
* other code. Doens't overwrite existing methods.
|
||||
*
|
||||
* Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
|
||||
* isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
|
||||
* setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
|
||||
*
|
||||
* Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*
|
||||
* Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
|
||||
* I've added my name to these methods so you know who to blame if they are broken!
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* An Array of day names starting with Sunday.
|
||||
*
|
||||
* @example dayNames[0]
|
||||
* @result 'Sunday'
|
||||
*
|
||||
* @name dayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated day names starting with Sun.
|
||||
*
|
||||
* @example abbrDayNames[0]
|
||||
* @result 'Sun'
|
||||
*
|
||||
* @name abbrDayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
|
||||
/**
|
||||
* An Array of month names starting with Janurary.
|
||||
*
|
||||
* @example monthNames[0]
|
||||
* @result 'January'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated month names starting with Jan.
|
||||
*
|
||||
* @example abbrMonthNames[0]
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
/**
|
||||
* The first day of the week for this locale.
|
||||
*
|
||||
* @name firstDayOfWeek
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.firstDayOfWeek = 1;
|
||||
|
||||
/**
|
||||
* The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.format = 'dd/mm/yyyy';
|
||||
//Date.format = 'mm/dd/yyyy';
|
||||
//Date.format = 'yyyy-mm-dd';
|
||||
//Date.format = 'dd mmm yy';
|
||||
|
||||
/**
|
||||
* The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
|
||||
* only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fullYearStart = '20';
|
||||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Adds a given method under the given name
|
||||
* to the Date prototype if it doesn't
|
||||
* currently exist.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function add(name, method) {
|
||||
if( !Date.prototype[name] ) {
|
||||
Date.prototype[name] = method;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the year is a leap year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isLeapYear();
|
||||
* @result true
|
||||
*
|
||||
* @name isLeapYear
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isLeapYear", function() {
|
||||
var y = this.getFullYear();
|
||||
return (y%4==0 && y%100!=0) || y%400==0;
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks if the day is a weekend day (Sat or Sun).
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekend();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekend
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekend", function() {
|
||||
return this.getDay()==0 || this.getDay()==6;
|
||||
});
|
||||
|
||||
/**
|
||||
* Check if the day is a day of the week (Mon-Fri)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekDay();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekDay
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekDay", function() {
|
||||
return !this.isWeekend();
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the number of days in the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDaysInMonth();
|
||||
* @result 31
|
||||
*
|
||||
* @name getDaysInMonth
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDaysInMonth", function() {
|
||||
return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the day.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName();
|
||||
* @result 'Saturday'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName(true);
|
||||
* @result 'Sat'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName();
|
||||
* @result 'Janurary'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName(true);
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getMonthName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayOfYear();
|
||||
* @result 11
|
||||
*
|
||||
* @name getDayOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayOfYear", function() {
|
||||
var tmpdtm = new Date("1/1/" + this.getFullYear());
|
||||
return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the week of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getWeekOfYear();
|
||||
* @result 2
|
||||
*
|
||||
* @name getWeekOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getWeekOfYear", function() {
|
||||
return Math.ceil(this.getDayOfYear() / 7);
|
||||
});
|
||||
|
||||
/**
|
||||
* Set the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.setDayOfYear(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Jan 01 2008 00:00:00'
|
||||
*
|
||||
* @name setDayOfYear
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("setDayOfYear", function(day) {
|
||||
this.setMonth(0);
|
||||
this.setDate(day);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of years to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addYears(1);
|
||||
* dtm.toString();
|
||||
* @result 'Mon Jan 12 2009 00:00:00'
|
||||
*
|
||||
* @name addYears
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addYears", function(num) {
|
||||
this.setFullYear(this.getFullYear() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of months to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMonths(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Feb 12 2008 00:00:00'
|
||||
*
|
||||
* @name addMonths
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMonths", function(num) {
|
||||
var tmpdtm = this.getDate();
|
||||
|
||||
this.setMonth(this.getMonth() + num);
|
||||
|
||||
if (tmpdtm > this.getDate())
|
||||
this.addDays(-this.getDate());
|
||||
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of days to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addDays(1);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addDays
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addDays", function(num) {
|
||||
this.setDate(this.getDate() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of hours to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addHours(24);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addHours
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addHours", function(num) {
|
||||
this.setHours(this.getHours() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of minutes to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMinutes(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 01:00:00'
|
||||
*
|
||||
* @name addMinutes
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMinutes", function(num) {
|
||||
this.setMinutes(this.getMinutes() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of seconds to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addSeconds(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name addSeconds
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addSeconds", function(num) {
|
||||
this.setSeconds(this.getSeconds() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
|
||||
*
|
||||
* @example var dtm = new Date();
|
||||
* dtm.zeroTime();
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name zeroTime
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("zeroTime", function() {
|
||||
this.setMilliseconds(0);
|
||||
this.setSeconds(0);
|
||||
this.setMinutes(0);
|
||||
this.setHours(0);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a string representation of the date object according to Date.format.
|
||||
* (Date.toString may be used in other places so I purposefully didn't overwrite it)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.asString();
|
||||
* @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name asString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("asString", function() {
|
||||
var r = Date.format;
|
||||
return r
|
||||
.split('yyyy').join(this.getFullYear())
|
||||
.split('yy').join((this.getFullYear() + '').substring(2))
|
||||
.split('mmm').join(this.getMonthName(true))
|
||||
.split('mm').join(_zeroPad(this.getMonth()+1))
|
||||
.split('dd').join(_zeroPad(this.getDate()));
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
|
||||
* (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
|
||||
*
|
||||
* @example var dtm = Date.fromString("12/01/2008");
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name fromString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fromString = function(s)
|
||||
{
|
||||
var f = Date.format;
|
||||
var d = new Date('01/01/1977');
|
||||
var iY = f.indexOf('yyyy');
|
||||
if (iY > -1) {
|
||||
d.setFullYear(Number(s.substr(iY, 4)));
|
||||
} else {
|
||||
// TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
|
||||
d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
|
||||
}
|
||||
var iM = f.indexOf('mmm');
|
||||
if (iM > -1) {
|
||||
var mStr = s.substr(iM, 3);
|
||||
for (var i=0; i<Date.abbrMonthNames.length; i++) {
|
||||
if (Date.abbrMonthNames[i] == mStr) break;
|
||||
}
|
||||
d.setMonth(i);
|
||||
} else {
|
||||
d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
|
||||
}
|
||||
d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
|
||||
if (isNaN(d.getTime())) {
|
||||
return false;
|
||||
}
|
||||
return d;
|
||||
};
|
||||
|
||||
// utility method
|
||||
var _zeroPad = function(num) {
|
||||
var s = '0'+num;
|
||||
return s.substring(s.length-2)
|
||||
//return ('0'+num).substring(-2); // doesn't work on IE :(
|
||||
};
|
||||
|
||||
})();
|
3605
site/slowtwitch.com/www/articles/static/fileman/js/fileman.js
Normal file
@ -0,0 +1,543 @@
|
||||
/*
|
||||
* jQuery clueTip plugin
|
||||
* Version 0.9.8 (05/22/2008)
|
||||
* @requires jQuery v1.1.4+
|
||||
* @requires Dimensions plugin (for jQuery versions < 1.2.5)
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
;(function($) {
|
||||
/*
|
||||
* @name clueTip
|
||||
* @type jQuery
|
||||
* @cat Plugins/tooltip
|
||||
* @return jQuery
|
||||
* @author Karl Swedberg
|
||||
*
|
||||
* @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com)
|
||||
* @credit Thanks to the following people for their many and varied contributions:
|
||||
Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer
|
||||
* @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-)
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element.
|
||||
* By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents.
|
||||
* If a "title" attribute is specified, its value is used as the clueTip's heading.
|
||||
* The attribute to be used for both the body and the heading of the clueTip is user-configurable.
|
||||
* Optionally, the clueTip's body can display content from an element on the same page.
|
||||
* * Just indicate the element's id (e.g. "#some-id") in the rel attribute.
|
||||
* Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated.
|
||||
* * The string before the first instance of the delimiter is set as the clueTip's heading.
|
||||
* * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body.
|
||||
* The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below...
|
||||
*
|
||||
*
|
||||
* @example $('#tip).cluetip();
|
||||
* @desc This is the most basic clueTip. It displays a 275px-wide clueTip on mouseover of the element with an ID of "tip." On mouseout of the element, the clueTip is hidden.
|
||||
*
|
||||
*
|
||||
* @example $('a.clue').cluetip({
|
||||
* hoverClass: 'highlight',
|
||||
* sticky: true,
|
||||
* closePosition: 'bottom',
|
||||
* closeText: '<img src="cross.png" alt="close" />',
|
||||
* truncate: 60,
|
||||
* ajaxSettings: {
|
||||
* type: 'POST'
|
||||
* }
|
||||
* });
|
||||
* @desc Displays a clueTip on mouseover of all <a> elements with class="clue". The hovered element gets a class of "highlight" added to it (so that it can be styled appropriately. This is esp. useful for non-anchor elements.). The clueTip is "sticky," which means that it will not be hidden until the user either clicks on its "close" text/graphic or displays another clueTip. The "close" text/graphic is set to diplay at the bottom of the clueTip (default is top) and display an image rather than the default "Close" text. Moreover, the body of the clueTip is truncated to the first 60 characters, which are followed by an ellipsis (...). Finally, the clueTip retrieves the content using POST rather than the $.ajax method's default "GET."
|
||||
*
|
||||
* More examples can be found at http://plugins.learningjquery.com/cluetip/demo/
|
||||
*
|
||||
* Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/
|
||||
*/
|
||||
|
||||
var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount;
|
||||
$.fn.cluetip = function(js, options) {
|
||||
if (typeof js == 'object') {
|
||||
options = js;
|
||||
js = null;
|
||||
}
|
||||
return this.each(function(index) {
|
||||
var $this = $(this);
|
||||
|
||||
// support metadata plugin (v1.0 and 2.0)
|
||||
var opts = $.extend(false, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
|
||||
|
||||
// start out with no contents (for ajax activation)
|
||||
var cluetipContents = false;
|
||||
var cluezIndex = parseInt(opts.cluezIndex, 10)-1;
|
||||
var isActive = false, closeOnDelay = 0;
|
||||
|
||||
// create the cluetip divs
|
||||
if (!$('#cluetip').length) {
|
||||
$cluetipInner = $('<div id="cluetip-inner"></div>');
|
||||
$cluetipTitle = $('<h3 id="cluetip-title"></h3>');
|
||||
$cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
|
||||
$cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex})
|
||||
.append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
|
||||
$('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
|
||||
.insertBefore('#cluetip').hide();
|
||||
$cluetip.css({position: 'absolute', zIndex: cluezIndex});
|
||||
$cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
|
||||
$cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip');
|
||||
}
|
||||
var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0;
|
||||
if (!$dropShadow) {
|
||||
$dropShadow = $([]);
|
||||
for (var i=0; i < dropShadowSteps; i++) {
|
||||
$dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i}));
|
||||
};
|
||||
$dropShadow.css({position: 'absolute', backgroundColor: '#000'})
|
||||
.prependTo($cluetip);
|
||||
}
|
||||
var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass;
|
||||
if (!tipAttribute && !opts.splitTitle && !js) return true;
|
||||
// if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
|
||||
if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); }
|
||||
var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
|
||||
// vertical measurement variables
|
||||
var tipHeight, wHeight;
|
||||
var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
|
||||
var sTop, linkTop, posY, tipY, mouseY, baseline;
|
||||
// horizontal measurement variables
|
||||
var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10);
|
||||
var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps;
|
||||
var linkWidth = this.offsetWidth;
|
||||
var linkLeft, posX, tipX, mouseX, winWidth;
|
||||
|
||||
// parse the title
|
||||
var tipParts;
|
||||
var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : '';
|
||||
if (opts.splitTitle) {
|
||||
if(tipTitle == undefined) {tipTitle = '';}
|
||||
tipParts = tipTitle.split(opts.splitTitle);
|
||||
tipTitle = tipParts.shift();
|
||||
}
|
||||
var localContent;
|
||||
|
||||
/***************************************
|
||||
* ACTIVATION
|
||||
****************************************/
|
||||
|
||||
//activate clueTip
|
||||
var activate = function(event) {
|
||||
if (!opts.onActivate($this)) {
|
||||
return false;
|
||||
}
|
||||
isActive = true;
|
||||
$cluetip.removeClass().css({width: tipInnerWidth});
|
||||
if (tipAttribute == $this.attr('href')) {
|
||||
$this.css('cursor', opts.cursor);
|
||||
}
|
||||
$this.attr('title','');
|
||||
if (opts.hoverClass) {
|
||||
$this.addClass(opts.hoverClass);
|
||||
}
|
||||
linkTop = posY = $this.offset().top;
|
||||
linkLeft = $this.offset().left;
|
||||
mouseX = event.pageX;
|
||||
mouseY = event.pageY;
|
||||
if ($this[0].tagName.toLowerCase() != 'area') {
|
||||
sTop = $(document).scrollTop();
|
||||
winWidth = $(window).width();
|
||||
}
|
||||
// position clueTip horizontally
|
||||
if (opts.positionBy == 'fixed') {
|
||||
posX = linkWidth + linkLeft + lOffset;
|
||||
$cluetip.css({left: posX});
|
||||
} else {
|
||||
posX = (linkWidth > linkLeft && linkLeft > tipWidth)
|
||||
|| linkLeft + linkWidth + tipWidth + lOffset > winWidth
|
||||
? linkLeft - tipWidth - lOffset
|
||||
: linkWidth + linkLeft + lOffset;
|
||||
if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
|
||||
if (mouseX + 20 + tipWidth > winWidth) {
|
||||
$cluetip.addClass(' cluetip-' + ctClass);
|
||||
posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2);
|
||||
} else {
|
||||
posX = mouseX + lOffset;
|
||||
}
|
||||
}
|
||||
var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
|
||||
$cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)});
|
||||
}
|
||||
wHeight = $(window).height();
|
||||
|
||||
/***************************************
|
||||
* load a string from cluetip method's first argument
|
||||
***************************************/
|
||||
if (js) {
|
||||
$cluetipInner.html(js);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
/***************************************
|
||||
* load the title attribute only (or user-selected attribute).
|
||||
* clueTip title is the string before the first delimiter
|
||||
* subsequent delimiters place clueTip body text on separate lines
|
||||
***************************************/
|
||||
|
||||
else if (tipParts) {
|
||||
var tpl = tipParts.length;
|
||||
for (var i=0; i < tpl; i++){
|
||||
if (i == 0) {
|
||||
$cluetipInner.html(tipParts[i]);
|
||||
} else {
|
||||
$cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
|
||||
}
|
||||
};
|
||||
cluetipShow(pY);
|
||||
}
|
||||
/***************************************
|
||||
* load external file via ajax
|
||||
***************************************/
|
||||
|
||||
else if (!opts.local && tipAttribute.indexOf('#') != 0) {
|
||||
if (cluetipContents && opts.ajaxCache) {
|
||||
$cluetipInner.html(cluetipContents);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
else {
|
||||
var ajaxSettings = opts.ajaxSettings;
|
||||
ajaxSettings.url = tipAttribute;
|
||||
ajaxSettings.beforeSend = function() {
|
||||
$cluetipOuter.children().empty();
|
||||
if (opts.waitImage) {
|
||||
$('#cluetip-waitimage')
|
||||
.css({top: mouseY+20, left: mouseX+20})
|
||||
.show();
|
||||
}
|
||||
};
|
||||
ajaxSettings.error = function() {
|
||||
if (isActive) {
|
||||
$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
|
||||
}
|
||||
};
|
||||
ajaxSettings.success = function(data) {
|
||||
cluetipContents = opts.ajaxProcess(data);
|
||||
if (isActive) {
|
||||
$cluetipInner.html(cluetipContents);
|
||||
}
|
||||
};
|
||||
ajaxSettings.complete = function() {
|
||||
imgCount = $('#cluetip-inner img').length;
|
||||
if (imgCount && !$.browser.opera) {
|
||||
$('#cluetip-inner img').load(function() {
|
||||
imgCount--;
|
||||
if (imgCount<1) {
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (isActive) cluetipShow(pY);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (isActive) cluetipShow(pY);
|
||||
}
|
||||
};
|
||||
$.ajax(ajaxSettings);
|
||||
}
|
||||
|
||||
/***************************************
|
||||
* load an element from the same page
|
||||
***************************************/
|
||||
} else if (opts.local){
|
||||
var $localContent = $(tipAttribute + ':first');
|
||||
var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html();
|
||||
$.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
};
|
||||
|
||||
// get dimensions and options for cluetip and prepare it to be shown
|
||||
var cluetipShow = function(bpY) {
|
||||
$cluetip.addClass('cluetip-' + ctClass);
|
||||
|
||||
if (opts.truncate) {
|
||||
var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
|
||||
$cluetipInner.html($truncloaded);
|
||||
}
|
||||
function doNothing() {}; //empty function
|
||||
tipTitle ? $cluetipTitle.show().html(tipTitle) : (opts.showTitle) ? $cluetipTitle.show().html(' ') : $cluetipTitle.hide();
|
||||
if (opts.sticky) {
|
||||
var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
|
||||
(opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
|
||||
$closeLink.click(function() {
|
||||
cluetipClose();
|
||||
return false;
|
||||
});
|
||||
if (opts.mouseOutClose) {
|
||||
if ($.fn.hoverIntent && opts.hoverIntent) {
|
||||
$cluetip.hoverIntent({
|
||||
over: doNothing,
|
||||
timeout: opts.hoverIntent.timeout,
|
||||
out: function() { $closeLink.trigger('click'); }
|
||||
});
|
||||
} else {
|
||||
$cluetip.hover(doNothing,
|
||||
function() {$closeLink.trigger('click'); });
|
||||
}
|
||||
} else {
|
||||
$cluetip.unbind('mouseout');
|
||||
}
|
||||
}
|
||||
// now that content is loaded, finish the positioning
|
||||
var direction = '';
|
||||
$cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
|
||||
tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10);
|
||||
tipY = posY;
|
||||
baseline = sTop + wHeight;
|
||||
if (opts.positionBy == 'fixed') {
|
||||
tipY = posY - opts.dropShadowSteps + tOffset;
|
||||
} else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') {
|
||||
if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) {
|
||||
tipY = mouseY - tipHeight - tOffset;
|
||||
direction = 'top';
|
||||
} else {
|
||||
tipY = mouseY + tOffset;
|
||||
direction = 'bottom';
|
||||
}
|
||||
} else if ( posY + tipHeight + tOffset > baseline ) {
|
||||
tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
|
||||
} else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
|
||||
tipY = bpY - tOffset;
|
||||
} else {
|
||||
tipY = posY - opts.dropShadowSteps;
|
||||
}
|
||||
if (direction == '') {
|
||||
posX < linkLeft ? direction = 'left' : direction = 'right';
|
||||
}
|
||||
$cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass);
|
||||
if (opts.arrows) { // set up arrow positioning to align with element
|
||||
var bgY = (posY - tipY - opts.dropShadowSteps);
|
||||
$cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show();
|
||||
} else {
|
||||
$cluetipArrows.hide();
|
||||
}
|
||||
|
||||
// (first hide, then) ***SHOW THE CLUETIP***
|
||||
$dropShadow.hide();
|
||||
$cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed);
|
||||
if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show();
|
||||
if ($.fn.bgiframe) { $cluetip.bgiframe(); }
|
||||
// trigger the optional onShow function
|
||||
if (opts.delayedClose > 0) {
|
||||
closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
|
||||
}
|
||||
opts.onShow($cluetip, $cluetipInner);
|
||||
|
||||
};
|
||||
|
||||
/***************************************
|
||||
=INACTIVATION
|
||||
-------------------------------------- */
|
||||
var inactivate = function() {
|
||||
isActive = false;
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
|
||||
cluetipClose();
|
||||
clearTimeout(closeOnDelay);
|
||||
};
|
||||
if (opts.hoverClass) {
|
||||
$this.removeClass(opts.hoverClass);
|
||||
}
|
||||
$('.cluetip-clicked').removeClass('cluetip-clicked');
|
||||
};
|
||||
// close cluetip and reset some things
|
||||
var cluetipClose = function() {
|
||||
$cluetipOuter
|
||||
.parent().hide().removeClass().end()
|
||||
.children().empty();
|
||||
if (tipTitle) {
|
||||
$this.attr(opts.titleAttribute, tipTitle);
|
||||
}
|
||||
$this.css('cursor','');
|
||||
if (opts.arrows) $cluetipArrows.css({top: ''});
|
||||
};
|
||||
|
||||
/***************************************
|
||||
=BIND EVENTS
|
||||
-------------------------------------- */
|
||||
// activate by click
|
||||
if ( (/click|toggle/).test(opts.activation) ) {
|
||||
$this.click(function(event) {
|
||||
if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) {
|
||||
activate(event);
|
||||
$('.cluetip-clicked').removeClass('cluetip-clicked');
|
||||
$this.addClass('cluetip-clicked');
|
||||
|
||||
} else {
|
||||
inactivate(event);
|
||||
|
||||
}
|
||||
this.blur();
|
||||
return false;
|
||||
});
|
||||
// activate by focus; inactivate by blur
|
||||
} else if (opts.activation == 'focus') {
|
||||
$this.focus(function(event) {
|
||||
activate(event);
|
||||
});
|
||||
$this.blur(function(event) {
|
||||
inactivate(event);
|
||||
});
|
||||
// activate by hover
|
||||
// clicking is returned false if cluetip url is same as href url
|
||||
} else {
|
||||
$this.click(function() {
|
||||
if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//set up mouse tracking
|
||||
var mouseTracks = function(evt) {
|
||||
if (opts.tracking == true) {
|
||||
var trackX = posX - evt.pageX;
|
||||
var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
|
||||
$this.mousemove(function(evt) {
|
||||
$cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
|
||||
});
|
||||
}
|
||||
};
|
||||
if ($.fn.hoverIntent && opts.hoverIntent) {
|
||||
$this.mouseover(function() {$this.attr('title',''); })
|
||||
.hoverIntent({
|
||||
sensitivity: opts.hoverIntent.sensitivity,
|
||||
interval: opts.hoverIntent.interval,
|
||||
over: function(event) {
|
||||
activate(event);
|
||||
mouseTracks(event);
|
||||
},
|
||||
timeout: opts.hoverIntent.timeout,
|
||||
out: function(event) {inactivate(event); $this.unbind('mousemove');}
|
||||
});
|
||||
} else {
|
||||
$this.hover(function(event) {
|
||||
activate(event);
|
||||
mouseTracks(event);
|
||||
}, function(event) {
|
||||
inactivate(event);
|
||||
$this.unbind('mousemove');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* options for clueTip
|
||||
*
|
||||
* each one can be explicitly overridden by changing its value.
|
||||
* for example: $.fn.cluetip.defaults.width = 200;
|
||||
* would change the default width for all clueTips to 200.
|
||||
*
|
||||
* each one can also be overridden by passing an options map to the cluetip method.
|
||||
* for example: $('a.example').cluetip({width: 200});
|
||||
* would change the default width to 200 for clueTips invoked by a link with class of "example"
|
||||
*
|
||||
*/
|
||||
|
||||
$.fn.cluetip.defaults = { // set up default options
|
||||
width: 275, // The width of the clueTip
|
||||
height: 'auto', // The height of the clueTip
|
||||
cluezIndex: 97, // Sets the z-index style property of the clueTip
|
||||
positionBy: 'auto', // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed'
|
||||
topOffset: 15, // Number of px to offset clueTip from top of invoking element
|
||||
leftOffset: 15, // Number of px to offset clueTip from left of invoking element
|
||||
local: false, // Whether to use content from the same page for the clueTip's body
|
||||
hideLocal: true, // If local option is set to true, this determines whether local content
|
||||
// to be shown in clueTip should be hidden at its original location
|
||||
attribute: 'rel', // the attribute to be used for fetching the clueTip's body content
|
||||
titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title
|
||||
splitTitle: '', // A character used to split the title attribute into the clueTip title and divs
|
||||
// within the clueTip body. more info below [6]
|
||||
showTitle: true, // show title bar of the clueTip, even if title attribute not set
|
||||
cluetipClass: 'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
|
||||
hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout
|
||||
waitImage: true, // whether to show a "loading" img, which is set in jquery.cluetip.css
|
||||
cursor: 'help',
|
||||
arrows: false, // if true, displays arrow on appropriate side of clueTip
|
||||
dropShadow: true, // set to false if you don't want the drop-shadow effect on the clueTip
|
||||
dropShadowSteps: 6, // adjusts the size of the drop shadow
|
||||
sticky: false, // keep visible until manually closed
|
||||
mouseOutClose: false, // close when clueTip is moused out
|
||||
activation: 'hover', // set to 'click' to force user to click to show clueTip
|
||||
// set to 'focus' to show on focus of a form element and hide on blur
|
||||
clickThrough: false, // if true, and activation is not 'click', then clicking on link will take user to the link's href,
|
||||
// even if href and tipAttribute are equal
|
||||
tracking: false, // if true, clueTip will track mouse movement (experimental)
|
||||
delayedClose: 0, // close clueTip on a timed delay (experimental)
|
||||
closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
|
||||
closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips
|
||||
truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs
|
||||
|
||||
// effect and speed for opening clueTips
|
||||
fx: {
|
||||
open: 'show', // can be 'show' or 'slideDown' or 'fadeIn'
|
||||
openSpeed: ''
|
||||
},
|
||||
|
||||
// settings for when hoverIntent plugin is used
|
||||
hoverIntent: {
|
||||
sensitivity: 3,
|
||||
interval: 50,
|
||||
timeout: 0
|
||||
},
|
||||
|
||||
// function to run just before clueTip is shown.
|
||||
onActivate: function(e) {return true;},
|
||||
|
||||
// function to run just after clueTip is shown.
|
||||
onShow: function(ct, c){},
|
||||
|
||||
// whether to cache results of ajax request to avoid unnecessary hits to server
|
||||
ajaxCache: true,
|
||||
|
||||
// process data retrieved via xhr before it's displayed
|
||||
ajaxProcess: function(data) {
|
||||
data = data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');
|
||||
return data;
|
||||
},
|
||||
|
||||
// can pass in standard $.ajax() parameters, not including error, complete, success, and url
|
||||
ajaxSettings: {
|
||||
dataType: 'html'
|
||||
},
|
||||
debug: false
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Global defaults for clueTips. Apply to all calls to the clueTip plugin.
|
||||
*
|
||||
* @example $.cluetip.setup({
|
||||
* insertionType: 'prependTo',
|
||||
* insertionElement: '#container'
|
||||
* });
|
||||
*
|
||||
* @property
|
||||
* @name $.cluetip.setup
|
||||
* @type Map
|
||||
* @cat Plugins/tooltip
|
||||
* @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter'
|
||||
* @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip.
|
||||
*
|
||||
*/
|
||||
|
||||
var insertionType = 'appendTo', insertionElement = 'body';
|
||||
$.cluetip = {};
|
||||
$.cluetip.setup = function(options) {
|
||||
if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
|
||||
insertionType = options.insertionType;
|
||||
}
|
||||
if (options && options.insertionElement) {
|
||||
insertionElement = options.insertionElement;
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,869 @@
|
||||
/*
|
||||
* jQuery Form Plugin
|
||||
* version: 2.07 (03/04/2008)
|
||||
* @requires jQuery v1.2.2 or later
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.form.js,v 1.1 2008/07/21 22:54:09 bao Exp $
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
|
||||
*
|
||||
* ajaxSubmit accepts a single argument which can be either a success callback function
|
||||
* or an options Object. If a function is provided it will be invoked upon successful
|
||||
* completion of the submit and will be passed the response from the server.
|
||||
* If an options Object is provided, the following attributes are supported:
|
||||
*
|
||||
* target: Identifies the element(s) in the page to be updated with the server response.
|
||||
* This value may be specified as a jQuery selection string, a jQuery object,
|
||||
* or a DOM element.
|
||||
* default value: null
|
||||
*
|
||||
* url: URL to which the form data will be submitted.
|
||||
* default value: value of form's 'action' attribute
|
||||
*
|
||||
* type: The method in which the form data should be submitted, 'GET' or 'POST'.
|
||||
* default value: value of form's 'method' attribute (or 'GET' if none found)
|
||||
*
|
||||
* data: Additional data to add to the request, specified as key/value pairs (see $.ajax).
|
||||
*
|
||||
* beforeSubmit: Callback method to be invoked before the form is submitted.
|
||||
* default value: null
|
||||
*
|
||||
* success: Callback method to be invoked after the form has been successfully submitted
|
||||
* and the response has been returned from the server
|
||||
* default value: null
|
||||
*
|
||||
* dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json'
|
||||
* default value: null
|
||||
*
|
||||
* semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
|
||||
* default value: false
|
||||
*
|
||||
* resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
|
||||
*
|
||||
* clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
|
||||
*
|
||||
*
|
||||
* The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
|
||||
* validating the form data. If the 'beforeSubmit' callback returns false then the form will
|
||||
* not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
|
||||
* in array format, the jQuery object, and the options object passed into ajaxSubmit.
|
||||
* The form data array takes the following form:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* If a 'success' callback method is provided it is invoked after the response has been returned
|
||||
* from the server. It is passed the responseText or responseXML value (depending on dataType).
|
||||
* See jQuery.ajax for further details.
|
||||
*
|
||||
*
|
||||
* The dataType option provides a means for specifying how the server response should be handled.
|
||||
* This maps directly to the jQuery.httpData method. The following values are supported:
|
||||
*
|
||||
* 'xml': if dataType == 'xml' the server response is treated as XML and the 'success'
|
||||
* callback method, if specified, will be passed the responseXML value
|
||||
* 'json': if dataType == 'json' the server response will be evaluted and passed to
|
||||
* the 'success' callback, if specified
|
||||
* 'script': if dataType == 'script' the server response is evaluated in the global context
|
||||
*
|
||||
*
|
||||
* Note that it does not make sense to use both the 'target' and 'dataType' options. If both
|
||||
* are provided the target will be ignored.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
*
|
||||
* When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
|
||||
*
|
||||
* $("#form-id").submit(function() {
|
||||
* $(this).ajaxSubmit(options);
|
||||
* return false; // cancel conventional submit
|
||||
* });
|
||||
*
|
||||
* When using ajaxForm(), however, this is done for you.
|
||||
*
|
||||
* @example
|
||||
* $('#myForm').ajaxSubmit(function(data) {
|
||||
* alert('Form submit succeeded! Server returned: ' + data);
|
||||
* });
|
||||
* @desc Submit form and alert server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and update page element with server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and alert the server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Pre-submit validation which aborts the submit operation if form data is empty
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myJsonUrl.php,
|
||||
* dataType: 'json',
|
||||
* success: function(data) {
|
||||
* // 'data' is an object representing the the evaluated json data
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc json data returned and evaluated
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myXmlUrl.php,
|
||||
* dataType: 'xml',
|
||||
* success: function(responseXML) {
|
||||
* // responseXML is XML document object
|
||||
* var data = $('myElement', responseXML).text();
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc XML data returned from server
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* resetForm: true
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc submit form and reset it if successful
|
||||
*
|
||||
* @example
|
||||
* $('#myForm).submit(function() {
|
||||
* $(this).ajaxSubmit();
|
||||
* return false;
|
||||
* });
|
||||
* @desc Bind form's submit event to use ajaxSubmit
|
||||
*
|
||||
*
|
||||
* @name ajaxSubmit
|
||||
* @type jQuery
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @cat Plugins/Form
|
||||
* @return jQuery
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
if (typeof options == 'function')
|
||||
options = { success: options };
|
||||
|
||||
options = $.extend({
|
||||
url: this.attr('action') || window.location.toString(),
|
||||
type: this.attr('method') || 'GET'
|
||||
}, options || {});
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) return this;
|
||||
|
||||
var a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (var n in options.data)
|
||||
a.push( { name: n, value: options.data[n] } );
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) return this;
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else
|
||||
options.data = q; // data is the query string for 'post'
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
||||
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
$(options.target).html(data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success)
|
||||
callbacks.push(options.success);
|
||||
|
||||
options.success = function(data, status) {
|
||||
for (var i=0, max=callbacks.length; i < max; i++)
|
||||
callbacks[i](data, status, $form);
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var files = $('input:file', this).fieldValue();
|
||||
var found = false;
|
||||
for (var j=0; j < files.length; j++)
|
||||
if (files[j])
|
||||
found = true;
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
if (options.iframe || found) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if ($.browser.safari && options.closeKeepAlive)
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
else
|
||||
fileUpload();
|
||||
}
|
||||
else
|
||||
$.ajax(options);
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
var opts = $.extend({}, $.ajaxSettings, options);
|
||||
|
||||
var id = 'jqFormIO' + (new Date().getTime());
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" />');
|
||||
var io = $io[0];
|
||||
var op8 = $.browser.opera && window.opera.version() < 9;
|
||||
if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {}
|
||||
};
|
||||
|
||||
var g = opts.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
||||
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
||||
|
||||
var cbInvoked = 0;
|
||||
var timedOut = 0;
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
setTimeout(function() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
$form.attr({
|
||||
target: id,
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data',
|
||||
method: 'POST',
|
||||
action: opts.url
|
||||
});
|
||||
|
||||
// support timout
|
||||
if (opts.timeout)
|
||||
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (options.extraData)
|
||||
for (var n in options.extraData)
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
$form.attr('action', a);
|
||||
t ? $form.attr('target', t) : $form.removeAttr('target');
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked++) return;
|
||||
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) throw 'timeout';
|
||||
// extract the server response from the iframe
|
||||
var data, doc;
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': opts.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
xhr.responseText = ta ? ta.value : xhr.responseText;
|
||||
}
|
||||
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
data = $.httpData(xhr, opts.dataType);
|
||||
}
|
||||
catch(e){
|
||||
ok = false;
|
||||
$.handleError(opts, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
opts.success(data, 'success');
|
||||
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
||||
}
|
||||
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
||||
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
||||
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* Note that for accurate x/y coordinates of image submit elements in all browsers
|
||||
* you need to also use the "dimensions" plugin (this method will auto-detect its presence).
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself. See ajaxSubmit for a full description of the options argument.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSForm(options);
|
||||
* @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
|
||||
* when the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that server response is alerted after the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that pre-submit callback is invoked before the form
|
||||
* is submitted.
|
||||
*
|
||||
*
|
||||
* @name ajaxForm
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
}).each(function() {
|
||||
// store options in hash
|
||||
$(":submit,input:image", this).bind('click.form-plugin',function(e) {
|
||||
var $form = this.form;
|
||||
$form.clk = this;
|
||||
if (this.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
$form.clk_x = e.offsetX;
|
||||
$form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $(this).offset();
|
||||
$form.clk_x = e.pageX - offset.left;
|
||||
$form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
$form.clk_x = e.pageX - this.offsetLeft;
|
||||
$form.clk_y = e.pageY - this.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
*
|
||||
* @name ajaxFormUnbind
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
this.unbind('submit.form-plugin');
|
||||
return this.each(function() {
|
||||
$(":submit,input:image", this).unbind('click.form-plugin');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
* @example var data = $("#myForm").formToArray();
|
||||
* $.post( "myscript.cgi", data );
|
||||
* @desc Collect all the data from a form and submit it to the server.
|
||||
*
|
||||
* @name formToArray
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type Array<Object>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length == 0) return a;
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
continue;
|
||||
}
|
||||
|
||||
var v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle them here
|
||||
var inputs = form.getElementsByTagName("input");
|
||||
for(var i=0, max=inputs.length; i < max; i++) {
|
||||
var input = inputs[i];
|
||||
var n = input.name;
|
||||
if(n && !input.disabled && input.type == "image" && form.clk == input)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* If your form must be submitted with name/value pairs in semantic order then pass
|
||||
* true for this arg, otherwise pass false (or nothing) to avoid the overhead for
|
||||
* this logic (which can be significant for very large forms).
|
||||
*
|
||||
* @example var data = $("#myForm").formSerialize();
|
||||
* $.ajax('POST', "myscript.cgi", data);
|
||||
* @desc Collect all the data from a form into a single string
|
||||
*
|
||||
* @name formSerialize
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The successful argument controls whether or not serialization is limited to
|
||||
* 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true.
|
||||
*
|
||||
* @example var data = $("input").fieldSerialize();
|
||||
* @desc Collect the data from all successful input elements into a query string
|
||||
*
|
||||
* @example var data = $(":radio").fieldSerialize();
|
||||
* @desc Collect the data from all successful radio input elements into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldSerialize();
|
||||
* @desc Collect the data from all successful checkbox input elements in myForm into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldSerialize(false);
|
||||
* @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
|
||||
*
|
||||
* @example var data = $(":input").fieldSerialize();
|
||||
* @desc Collect the data from all successful input, select, textarea and button elements into a query string
|
||||
*
|
||||
* @name fieldSerialize
|
||||
* @param successful true if only successful controls should be serialized (default is true)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) return;
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++)
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: this.name, value: v});
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*
|
||||
* @example var data = $("#myPasswordElement").fieldValue();
|
||||
* alert(data[0]);
|
||||
* @desc Alerts the current value of the myPasswordElement element
|
||||
*
|
||||
* @example var data = $("#myForm :input").fieldValue();
|
||||
* @desc Get the value(s) of the form elements in myForm
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldValue();
|
||||
* @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
|
||||
*
|
||||
* @example var data = $("#mySingleSelect").fieldValue();
|
||||
* @desc Get the value(s) of the select control
|
||||
*
|
||||
* @example var data = $(':text').fieldValue();
|
||||
* @desc Get the value(s) of the text input or textarea elements
|
||||
*
|
||||
* @example var data = $("#myMultiSelect").fieldValue();
|
||||
* @desc Get the values for the select-multiple control
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Boolean successful true if only the values for successful controls should be returned (default is true)
|
||||
* @type Array<String>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
||||
continue;
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If the given element is not
|
||||
* successful and the successful arg is not false then the returned value will be null.
|
||||
*
|
||||
* Note: If the successful flag is true (default) but the element is not successful, the return will be null
|
||||
* Note: The value returned for a successful select-multiple element will always be an array.
|
||||
* Note: If the element has no value the return value will be undefined.
|
||||
*
|
||||
* @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
|
||||
* @desc Gets the current value of the myPasswordElement element
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Element el The DOM element for which the value will be returned
|
||||
* @param Boolean successful true if value returned must be for a successful controls (default is true)
|
||||
* @type String or Array<String> or null or undefined
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
// extra pain for IE...
|
||||
var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('form').clearForm();
|
||||
* @desc Clears all forms on the page.
|
||||
*
|
||||
* @name clearForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements. Takes the following actions on the matched elements:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('.myInputs').clearFields();
|
||||
* @desc Clears all inputs with class myInputs
|
||||
*
|
||||
* @name clearFields
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea')
|
||||
this.value = '';
|
||||
else if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = false;
|
||||
else if (tag == 'select')
|
||||
this.selectedIndex = -1;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*
|
||||
* @example $('form').resetForm();
|
||||
* @desc Resets all forms on the page.
|
||||
*
|
||||
* @name resetForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*
|
||||
* @example $(':radio').enabled(false);
|
||||
* @desc Disables all radio buttons
|
||||
*
|
||||
* @name select
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b == undefined) b = true;
|
||||
return this.each(function() {
|
||||
this.disabled = !b
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*
|
||||
* @example $(':checkbox').select();
|
||||
* @desc Checks all checkboxes
|
||||
*
|
||||
* @name select
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.select = function(select) {
|
||||
if (select == undefined) select = true;
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = select;
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').select(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* hoverIntent is similar to jQuery's built-in "hover" function except that
|
||||
* instead of firing the onMouseOver event immediately, hoverIntent checks
|
||||
* to see if the user's mouse has slowed down (beneath the sensitivity
|
||||
* threshold) before firing the onMouseOver event.
|
||||
*
|
||||
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2
|
||||
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
|
||||
*
|
||||
* hoverIntent is currently available for use in all personal or commercial
|
||||
* projects under both MIT and GPL licenses. This means that you can choose
|
||||
* the license that best suits your project, and use it accordingly.
|
||||
*
|
||||
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
|
||||
* $("ul li").hoverIntent( showNav , hideNav );
|
||||
*
|
||||
* // advanced usage receives configuration object only
|
||||
* $("ul li").hoverIntent({
|
||||
* sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
|
||||
* interval: 50, // number = milliseconds of polling interval
|
||||
* over: showNav, // function = onMouseOver callback (required)
|
||||
* timeout: 100, // number = milliseconds delay before onMouseOut function call
|
||||
* out: hideNav // function = onMouseOut callback (required)
|
||||
* });
|
||||
*
|
||||
* @param f onMouseOver function || An object with configuration options
|
||||
* @param g onMouseOut function || Nothing (use configuration options object)
|
||||
* @return The object (aka "this") that called hoverIntent, and the event object
|
||||
* @author Brian Cherne <brian@cherne.net>
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.hoverIntent = function(f,g) {
|
||||
// default configuration options
|
||||
var cfg = {
|
||||
sensitivity: 7,
|
||||
interval: 100,
|
||||
timeout: 0
|
||||
};
|
||||
// override configuration options with user supplied object
|
||||
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).unbind("mousemove",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = 1;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = 0;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
||||
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
||||
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
||||
if ( p == this ) { return false; }
|
||||
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
var ev = jQuery.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
|
||||
// else e.type == "onmouseover"
|
||||
if (e.type == "mouseover") {
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).bind("mousemove",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "onmouseout"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).unbind("mousemove",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// bind the function to the two event listeners
|
||||
return this.mouseover(handleHover).mouseout(handleHover);
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* jqModal - Minimalist Modaling with jQuery
|
||||
*
|
||||
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* $Version: 2007.08.17 +r11
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.jqm=function(o){
|
||||
var _o = {
|
||||
zIndex: 3000,
|
||||
overlay: 50,
|
||||
overlayClass: 'jqmOverlay',
|
||||
closeClass: 'jqmClose',
|
||||
trigger: '.jqModal',
|
||||
ajax: false,
|
||||
target: false,
|
||||
modal: false,
|
||||
toTop: false,
|
||||
onShow: false,
|
||||
onHide: false,
|
||||
onLoad: false
|
||||
};
|
||||
return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
|
||||
H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
|
||||
if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
|
||||
});};
|
||||
|
||||
$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
|
||||
$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
|
||||
$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
|
||||
$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};
|
||||
|
||||
$.jqm = {
|
||||
hash:{},
|
||||
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
|
||||
if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
|
||||
else if(c.overlay > 0)h.w.jqmAddClose(o);
|
||||
else o=false;
|
||||
|
||||
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
|
||||
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
|
||||
|
||||
if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
|
||||
r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
|
||||
else if(cc)h.w.jqmAddClose($(cc,h.w));
|
||||
|
||||
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
|
||||
(c.onShow)?c.onShow(h):h.w.show();e(h);return false;
|
||||
},
|
||||
close:function(s){var h=H[s];h.a=false;
|
||||
if(A[0]){A.pop();if(!A[0])F('unbind');}
|
||||
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
|
||||
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
|
||||
}};
|
||||
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
|
||||
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
|
||||
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
|
||||
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
|
||||
F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
|
||||
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
|
||||
hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
|
||||
$(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
|
||||
})(jQuery);
|
32
site/slowtwitch.com/www/articles/static/fileman/js/jquery.min.js
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
/* http://jquery.offput.ca/every/ */
|
||||
|
||||
jQuery.fn.extend({
|
||||
everyTime: function(interval, label, fn, times, belay) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.add(this, interval, label, fn, times, belay);
|
||||
});
|
||||
},
|
||||
oneTime: function(interval, label, fn) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.add(this, interval, label, fn, 1);
|
||||
});
|
||||
},
|
||||
stopTime: function(label, fn) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.remove(this, label, fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.extend({
|
||||
timer: {
|
||||
guid: 1,
|
||||
global: {},
|
||||
regex: /^([0-9]+)\s*(.*s)?$/,
|
||||
powers: {
|
||||
// Yeah this is major overkill...
|
||||
'ms': 1,
|
||||
'cs': 10,
|
||||
'ds': 100,
|
||||
's': 1000,
|
||||
'das': 10000,
|
||||
'hs': 100000,
|
||||
'ks': 1000000
|
||||
},
|
||||
timeParse: function(value) {
|
||||
if (value == undefined || value == null)
|
||||
return null;
|
||||
var result = this.regex.exec(jQuery.trim(value.toString()));
|
||||
if (result[2]) {
|
||||
var num = parseInt(result[1], 10);
|
||||
var mult = this.powers[result[2]] || 1;
|
||||
return num * mult;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
add: function(element, interval, label, fn, times, belay) {
|
||||
var counter = 0;
|
||||
|
||||
if (jQuery.isFunction(label)) {
|
||||
if (!times)
|
||||
times = fn;
|
||||
fn = label;
|
||||
label = interval;
|
||||
}
|
||||
|
||||
interval = jQuery.timer.timeParse(interval);
|
||||
|
||||
if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
|
||||
return;
|
||||
|
||||
if (times && times.constructor != Number) {
|
||||
belay = !!times;
|
||||
times = 0;
|
||||
}
|
||||
|
||||
times = times || 0;
|
||||
belay = belay || false;
|
||||
|
||||
if (!element.$timers)
|
||||
element.$timers = {};
|
||||
|
||||
if (!element.$timers[label])
|
||||
element.$timers[label] = {};
|
||||
|
||||
fn.$timerID = fn.$timerID || this.guid++;
|
||||
|
||||
var handler = function() {
|
||||
if (belay && this.inProgress)
|
||||
return;
|
||||
this.inProgress = true;
|
||||
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
|
||||
jQuery.timer.remove(element, label, fn);
|
||||
this.inProgress = false;
|
||||
};
|
||||
|
||||
handler.$timerID = fn.$timerID;
|
||||
|
||||
if (!element.$timers[label][fn.$timerID])
|
||||
element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
|
||||
|
||||
if ( !this.global[label] )
|
||||
this.global[label] = [];
|
||||
this.global[label].push( element );
|
||||
|
||||
},
|
||||
remove: function(element, label, fn) {
|
||||
var timers = element.$timers, ret;
|
||||
|
||||
if ( timers ) {
|
||||
|
||||
if (!label) {
|
||||
for ( label in timers )
|
||||
this.remove(element, label, fn);
|
||||
} else if ( timers[label] ) {
|
||||
if ( fn ) {
|
||||
if ( fn.$timerID ) {
|
||||
window.clearInterval(timers[label][fn.$timerID]);
|
||||
delete timers[label][fn.$timerID];
|
||||
}
|
||||
} else {
|
||||
for ( var fn in timers[label] ) {
|
||||
window.clearInterval(timers[label][fn]);
|
||||
delete timers[label][fn];
|
||||
}
|
||||
}
|
||||
|
||||
for ( ret in timers[label] ) break;
|
||||
if ( !ret ) {
|
||||
ret = null;
|
||||
delete timers[label];
|
||||
}
|
||||
}
|
||||
|
||||
for ( ret in timers ) break;
|
||||
if ( !ret )
|
||||
element.$timers = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (jQuery.browser.msie)
|
||||
jQuery(window).one("unload", function() {
|
||||
var global = jQuery.timer.global;
|
||||
for ( var label in global ) {
|
||||
var els = global[label], i = els.length;
|
||||
while ( --i )
|
||||
jQuery.timer.remove(els[i], label);
|
||||
}
|
||||
});
|
||||
|
||||
|
After Width: | Height: | Size: 26 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/schemes/gt.jpg
Normal file
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 25 KiB |
BIN
site/slowtwitch.com/www/articles/static/fileman/schemes/rose.jpg
Normal file
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,154 @@
|
||||
tinyMCE.addI18n({en:{
|
||||
common:{
|
||||
edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
|
||||
apply:"Apply",
|
||||
insert:"Insert",
|
||||
update:"Update",
|
||||
cancel:"Cancel",
|
||||
close:"Close",
|
||||
browse:"Browse",
|
||||
class_name:"Class",
|
||||
not_set:"-- Not set --",
|
||||
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
|
||||
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
|
||||
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
|
||||
invalid_data:"Error: Invalid values entered, these are marked in red.",
|
||||
more_colors:"More colors"
|
||||
},
|
||||
contextmenu:{
|
||||
align:"Alignment",
|
||||
left:"Left",
|
||||
center:"Center",
|
||||
right:"Right",
|
||||
full:"Full"
|
||||
},
|
||||
insertdatetime:{
|
||||
date_fmt:"%Y-%m-%d",
|
||||
time_fmt:"%H:%M:%S",
|
||||
insertdate_desc:"Insert date",
|
||||
inserttime_desc:"Insert time",
|
||||
months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
|
||||
months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
|
||||
day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
|
||||
day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
|
||||
},
|
||||
print:{
|
||||
print_desc:"Print"
|
||||
},
|
||||
preview:{
|
||||
preview_desc:"Preview"
|
||||
},
|
||||
directionality:{
|
||||
ltr_desc:"Direction left to right",
|
||||
rtl_desc:"Direction right to left"
|
||||
},
|
||||
layer:{
|
||||
insertlayer_desc:"Insert new layer",
|
||||
forward_desc:"Move forward",
|
||||
backward_desc:"Move backward",
|
||||
absolute_desc:"Toggle absolute positioning",
|
||||
content:"New layer..."
|
||||
},
|
||||
save:{
|
||||
save_desc:"Save",
|
||||
cancel_desc:"Cancel all changes"
|
||||
},
|
||||
nonbreaking:{
|
||||
nonbreaking_desc:"Insert non-breaking space character"
|
||||
},
|
||||
iespell:{
|
||||
iespell_desc:"Run spell checking",
|
||||
download:"ieSpell not detected. Do you want to install it now?"
|
||||
},
|
||||
advhr:{
|
||||
advhr_desc:"Horizontal rule"
|
||||
},
|
||||
emotions:{
|
||||
emotions_desc:"Emotions"
|
||||
},
|
||||
searchreplace:{
|
||||
search_desc:"Find",
|
||||
replace_desc:"Find/Replace"
|
||||
},
|
||||
advimage:{
|
||||
image_desc:"Insert/edit image"
|
||||
},
|
||||
advlink:{
|
||||
link_desc:"Insert/edit link"
|
||||
},
|
||||
xhtmlxtras:{
|
||||
cite_desc:"Citation",
|
||||
abbr_desc:"Abbreviation",
|
||||
acronym_desc:"Acronym",
|
||||
del_desc:"Deletion",
|
||||
ins_desc:"Insertion",
|
||||
attribs_desc:"Insert/Edit Attributes"
|
||||
},
|
||||
style:{
|
||||
desc:"Edit CSS Style"
|
||||
},
|
||||
paste:{
|
||||
paste_text_desc:"Paste as Plain Text",
|
||||
paste_word_desc:"Paste from Word",
|
||||
selectall_desc:"Select All"
|
||||
},
|
||||
paste_dlg:{
|
||||
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
|
||||
text_linebreaks:"Keep linebreaks",
|
||||
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
|
||||
},
|
||||
table:{
|
||||
desc:"Inserts a new table",
|
||||
row_before_desc:"Insert row before",
|
||||
row_after_desc:"Insert row after",
|
||||
delete_row_desc:"Delete row",
|
||||
col_before_desc:"Insert column before",
|
||||
col_after_desc:"Insert column after",
|
||||
delete_col_desc:"Remove column",
|
||||
split_cells_desc:"Split merged table cells",
|
||||
merge_cells_desc:"Merge table cells",
|
||||
row_desc:"Table row properties",
|
||||
cell_desc:"Table cell properties",
|
||||
props_desc:"Table properties",
|
||||
paste_row_before_desc:"Paste table row before",
|
||||
paste_row_after_desc:"Paste table row after",
|
||||
cut_row_desc:"Cut table row",
|
||||
copy_row_desc:"Copy table row",
|
||||
del:"Delete table",
|
||||
row:"Row",
|
||||
col:"Column",
|
||||
cell:"Cell"
|
||||
},
|
||||
autosave:{
|
||||
unload_msg:"The changes you made will be lost if you navigate away from this page."
|
||||
},
|
||||
fullscreen:{
|
||||
desc:"Toggle fullscreen mode"
|
||||
},
|
||||
media:{
|
||||
desc:"Insert / edit embedded media",
|
||||
edit:"Edit embedded media"
|
||||
},
|
||||
fullpage:{
|
||||
desc:"Document properties"
|
||||
},
|
||||
template:{
|
||||
desc:"Insert predefined template content"
|
||||
},
|
||||
visualchars:{
|
||||
desc:"Visual control characters on/off."
|
||||
},
|
||||
spellchecker:{
|
||||
desc:"Toggle spellchecker",
|
||||
menu:"Spellchecker settings",
|
||||
ignore_word:"Ignore word",
|
||||
ignore_words:"Ignore all",
|
||||
langs:"Languages",
|
||||
wait:"Please wait...",
|
||||
sug:"Suggestions",
|
||||
no_sug:"No suggestions",
|
||||
no_mpell:"No misspellings found."
|
||||
},
|
||||
pagebreak:{
|
||||
desc:"Insert page break."
|
||||
}}});
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.AdvancedHRPlugin',{init:function(ed,url){ed.addCommand('mceAdvancedHr',function(){ed.windowManager.open({file:url+'/rule.htm',width:250+parseInt(ed.getLang('advhr.delta_width',0)),height:160+parseInt(ed.getLang('advhr.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('advhr',{title:'advhr.advhr_desc',cmd:'mceAdvancedHr'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('advhr',n.nodeName=='HR');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='HR')ed.selection.select(e);});},getInfo:function(){return{longname:'Advanced HR',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advhr',tinymce.plugins.AdvancedHRPlugin);})();
|
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvancedHr', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/rule.htm',
|
||||
width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('advhr', {
|
||||
title : 'advhr.advhr_desc',
|
||||
cmd : 'mceAdvancedHr'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('advhr', n.nodeName == 'HR');
|
||||
});
|
||||
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'HR')
|
||||
ed.selection.select(e);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced HR',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
|
||||
})();
|
@ -0,0 +1,43 @@
|
||||
var AdvHRDialog = {
|
||||
init : function(ed) {
|
||||
var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
|
||||
|
||||
w = dom.getAttrib(n, 'width');
|
||||
f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
|
||||
f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
|
||||
f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
|
||||
selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
|
||||
|
||||
h = '<hr';
|
||||
|
||||
if (f.size.value) {
|
||||
h += ' size="' + f.size.value + '"';
|
||||
st += ' height:' + f.size.value + 'px;';
|
||||
}
|
||||
|
||||
if (f.width.value) {
|
||||
h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
|
||||
st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
|
||||
}
|
||||
|
||||
if (f.noshade.checked) {
|
||||
h += ' noshade="noshade"';
|
||||
st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
|
||||
}
|
||||
|
||||
if (ed.settings.inline_styles)
|
||||
h += ' style="' + tinymce.trim(st) + '"';
|
||||
|
||||
h += ' />';
|
||||
|
||||
ed.execCommand("mceInsertContent", false, h);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);
|
@ -0,0 +1,5 @@
|
||||
tinyMCE.addI18n('en.advhr_dlg',{
|
||||
width:"Width",
|
||||
size:"Height",
|
||||
noshade:"No shadow"
|
||||
});
|