diff --git a/forum.slowtwitch.com/.htaccess b/forum.slowtwitch.com/.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/forum.slowtwitch.com/.htpasswd b/forum.slowtwitch.com/.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/forum.slowtwitch.com/.keep b/forum.slowtwitch.com/.keep new file mode 100644 index 0000000..e69de29 diff --git a/forum.slowtwitch.com/.service-lock b/forum.slowtwitch.com/.service-lock new file mode 100644 index 0000000..e69de29 diff --git a/forum.slowtwitch.com/.svn/dir-prop-base b/forum.slowtwitch.com/.svn/dir-prop-base new file mode 100644 index 0000000..108af56 --- /dev/null +++ b/forum.slowtwitch.com/.svn/dir-prop-base @@ -0,0 +1,7 @@ +K 10 +svn:ignore +V 12 +*.bak +*.bck + +END diff --git a/forum.slowtwitch.com/.svn/entries b/forum.slowtwitch.com/.svn/entries new file mode 100644 index 0000000..916540b --- /dev/null +++ b/forum.slowtwitch.com/.svn/entries @@ -0,0 +1,34 @@ +9 + +dir +79 +https://projects.gossamer-threads.com/svn/slowtwitch/tags/released/gforum +https://projects.gossamer-threads.com/svn/slowtwitch + + + +2010-04-14T21:25:45.287710Z +79 +vivian +has-props + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +9372ece4-6914-43d3-834c-a59b432a6956 + +www +dir + +cgi-bin +dir + diff --git a/forum.slowtwitch.com/.svn/format b/forum.slowtwitch.com/.svn/format new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/forum.slowtwitch.com/.svn/format @@ -0,0 +1 @@ +9 diff --git a/forum.slowtwitch.com/advertprotestcode b/forum.slowtwitch.com/advertprotestcode new file mode 100644 index 0000000..a1c0a7a --- /dev/null +++ b/forum.slowtwitch.com/advertprotestcode @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/forum.slowtwitch.com/www b/forum.slowtwitch.com/www new file mode 120000 index 0000000..1797862 --- /dev/null +++ b/forum.slowtwitch.com/www @@ -0,0 +1 @@ +/var/home/slowtwitch/site/forum.slowtwitch.com/www \ No newline at end of file diff --git a/site/common/static/js/base.min.js b/site/common/static/js/base.min.js new file mode 100644 index 0000000..a4208d0 --- /dev/null +++ b/site/common/static/js/base.min.js @@ -0,0 +1,69 @@ +/*! jQuery v2.2.0 | (c) jQuery Foundation | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!k.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c}catch(e){}O.set(a,b,c); +}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return this;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.rnamespace||a.rnamespace.test(g.namespace))&&(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,la=/\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("'); + }); + $li.mouseout(function() { + $li.find('iframe').remove(); + $li.removeClass('sfhover'); + }); + }); + } + +/* Search Expression option requires 'Search Contents' checked */ + $('#search_exp').click(function() { + $('#search_content').attr('checked', $(this).attr('checked') ? true : false); + }) + +/* Browse buttons */ + $('input[name="button-browse"]').each(function() { + var button = $(this); + button.click(function() { + var command = fm.current.command || fm.current.action; + fm.browse({ + title : command == 'diff' ? 'Select a text file' : 'Select Directory', + filter : command == 'diff' ? 2 : 1, + hidden_query : fm.hiddens.hidden_query, + id : command + '_input' + }); + }); + }); + +/* Setting for chmod command */ + $('#cmd-chmod input[name="chmod_input"]').change(function() { + var val = $(this).val(); + if (val.length == 0) return; + if (val.search(/\D/) >= 0) { + $(this).val('').focus(); + fm.showMessage({ success : false, message : 'Invalid octal notation.'}) + return; + } + var nums = val.split(""); + var invalid = false; + for (var i=0; i 7) { + invalid = true; + break; + } + } + + if (invalid) { + fm.showMessage({ success : false, message : 'Invalid octal notation.'}) + return; + } + fm.chmod(val); + }); + +/* Logout link */ + $('#loginbar a[rel]').click(function() { + fm.current.command = 'logout'; + fm.form.find('input[name="cmd"]').val('logout'); + fm.form.submit(); + return false; + }); + +/* Format Date */ + this.config.date_format = this.config.date_format; + Date.firstDayOfWeek = 7; + Date.format = this.config.date_format; + +/* Prevent user uses mousewheel on IE */ + document.getElementById('fm_action').onmousewheel = function() { return false; }; + +/* Setting action for access menu bar. This is only available for user who has multiple access directories */ + $('#uaccess a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname: '/', a : link.attr('rel') }); + return false; + }); + }); +} + +/* + login method: handles all none authentication actions + html : should be login form. This happens when session is expired +*/ +FileMan.prototype.login = function(html) { + if (html) $('#home').html(html).addClass('noauth'); + + var $contentmessage = $('#contentmessage'); + + $('#username').focus(); + $contentmessage.find('.error').oneTime(5000, 'msgtimer', function() { $contentmessage.slideUp('normal'); }); + + var fm = this; + $('a[rel="reset_password"]').click(function() { + fm.printForm('reset_password', function(response) { + if (response.success) { + $('form input[name="cmd"]').val('reset_password'); + var $login = $('#login'); + $login.fadeOut('normal', function() { + $('#content').append(response.data.html); + $('#email').focus(); + $('a[rel="login"]').click(function() { + var $reset = $('#reset_password'); + $reset.fadeOut('normal', function() { + $login.fadeIn('fast', function() { + $reset.remove(); + $('#username').focus(); + $('form input[name="cmd"]').val('login'); + }); + }); + }); + }); + } + }); + + return false; + }); + + $('form').ajaxForm({ + dataType : 'json', + success : function(response) { + if (response.success) { + if (response.data.redirect == 'login') { + var $reset = $('#reset_password'); + $reset.fadeOut('normal', function() { + $('#login').fadeIn('normal', function() { + $reset.remove(); + $('form input[name="cmd"]').val('login'); + $contentmessage.find('div').html(response.message).removeClass().addClass('message'); + $contentmessage.slideDown('normal', function() { $('#username').focus(); }); + }); + }); + fm.login(response.data.html); + } + else { + $('#wrapper').fadeOut('normal').remove(); + window.location = fm.config.cgi_url + (response.data.notuse_cookie == 1 ? ('?sid=' + response.data.session.id) : ''); + } + } + else { + $contentmessage.find('div').html(response.message).removeClass().addClass('error'); + $contentmessage.slideDown('normal', function() { + if ($('#login').is(':hidden')) $('#email').focus(); + else $('#username').focus(); + }).oneTime(5000, 'msgtimer', function() { $contentmessage.slideUp('normal'); }); + } + } + }); +} + +/* + Handle layout dimensions + wHeight: Should be window height. This is an optional. + message_height: Should be message box height. This is an optional + */ +FileMan.prototype.layoutDimensions = function(wHeight) { + if (typeof(wHeight) == 'undefined' || !wHeight) wHeight = $(window).height(); + + var message_height = $('#contentmessage').is(':hidden') ? 0 : ($('#contentmessage').outerHeight() + 2); + var height = wHeight - this.height.wrapperheader - this.height.wrapperfooter - 5; + var shadow_height = $('#ocwrapper .shadowtop').outerHeight() + $('#ocwrapper .shadowbottom').outerHeight(); + var command_height = $('#contentheader').is(':hidden') ? 0 : $('#contentheader').outerHeight(); + + var wrapper_content_padding = command_height > 0 ? 2 : 18; + var content_height = height - command_height - message_height - shadow_height - wrapper_content_padding; + + /* Setting height for these objects */ + $('#ocwrapper').css('height', height - command_height + 'px'); + $('#wrapper-content').css('height', height + 'px'); + $('#content').css('height', content_height + 'px'); + + this.height.content = $('#content').height(); + this.height.wrapper = height; + + $('#contentheader').css('width', $('#wrapper-content').width() - 20 + 'px'); + + /* If command-dialog exists, it needs to get resized as well */ + var $command_dialog = $('#command-dialog'); + if ($command_dialog.length > 0) { + var $editor = $command_dialog.find('textarea[name="editor"]'); + if ($editor.length > 0) { + var nwidth = getScreenWidth() - 45; + var nheight = getScreenHeight() - 275; + $editor.css('height', nheight + 'px').css('width', nwidth + 'px'); + + if ($editor.is(':hidden') && this.config.tinyMCE) { + this.config.tinyMCE.width = nwidth + 'px'; + this.config.tinyMCE.height = nheight - 5 + 'px'; + + tinyMCE.activeEditor.hide(); + tinyMCE.init(this.config.tinyMCE); + } + } + + var toolbar_height = $command_dialog.find('.toolbar').outerHeight() || 0; + $command_dialog.find('.contentframe').css('height', this.height.content - toolbar_height + 'px'); + } + else { + /* Setting the height for the content frame which is set 'scroll' for overflow-y */ + if ($('.contentframe').length > 0 && !$('.contentframe').hasClass('hide')) { + this.height.folder = $('.foldertab:first').height(); + this.height.toolbar = $('.toolbar').outerHeight() + this.height.folder; + + $('.contentframe').css('height', content_height - this.height.toolbar + 'px'); + + /* Fixing the width for file table which doesn't work probably on IE7 */ + $('.contentframe table[class="foldertab"]').css('width', $('.foldertab:first').outerWidth() - 18 + 'px'); + } + } +} + +/* + Handles showing the command panel + args : should be a hash of parameters +*/ +FileMan.prototype.commandDialog = function(args) { + var fm = this; + if (this.fileEditor.beingEdited) { + if (args.command == 'command') this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { fm.commandDialog(args); }); + } + + if (typeof(args) == 'undefined') args = new Object(); + +/* Clear timeoud ID if exists */ + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + + var $contentheader = $('#contentheader'); + var $contentmessage = $('#contentmessage'); + var command_height = $contentheader.height(); + var message_height = 0 + var msg_show = false; + var command = args.command || null; + +/* Hide the action bar if visible */ + if (this.current.action) { + $('#fm_action').attr('selectedIndex', 0); + this.fadeOut($('#cmd-' + this.current.action)); + this.current.action = null; + } + +/* Display message */ + if (!$contentmessage.is(':hidden')){ + $contentmessage.stopTime('msgtimer'); + this.fadeOut($contentmessage); + msg_show = true; + } + +/* Display the Command command screen */ + var $command_dialog = $('#command-dialog'); + if (command == 'command') { + if (this.current.command != command) { + var $content = $('#content'); + + this.printForm('command', function(response) { + if (response.success) { + fm.working_dir = response.data.working_dir; + if ($command_dialog.length > 0) $command_dialog.remove(); + fm.fadeOut($('#listfiles'), function() { + $content.append('
' + response.data.prompt + '
'); + fm.fadeIn($('#command-dialog').css('overflow-y', 'scroll'), function() { + fm.showStatus(command); + }); + }); + } + }); + } + } + +/* Display editor form */ + else if ($command_dialog.is(':hidden')) { + this.fadeOut($('#listfiles'), function() { + if (command.search(/file|edit/) == 0) { + var $modal = $('#modal-dialog'); + fm.loading('start'); + + fm.fadeIn($command_dialog, function() { + var $contentframe = $command_dialog.find('.contentframe'); + var $editor = $contentframe.find('textarea[name="editor"]'); + $contentframe.css('height', $command_dialog.height() + 'px').css('width', $command_dialog.width() + 'px').css('overflow', 'hidden'); + if ($('#editor_mode').val() == 'html') { + $editor.css('height', $command_dialog.height() - 13 + 'px').css('width', $command_dialog.width() - 5 + 'px'); + tinyMCE.init(fm.config.tinyMCE); + } + else { + $editor.css('height', $command_dialog.height() - 5 + 'px') + .css('width', $command_dialog.width() - 5 + 'px') + .change(function() { + if (!fm.fileEditor.beingEdited) fm.fileEditor.beingEdited = true; + }); + + fm.fadeIn($editor, function() { + if (!$modal.is(':hidden')) $modal.html('').jqmHide(); + }); + } + fm.loading('end'); + }); + } + else { + fm.fadeIn($command_dialog); + } + }); + } + +/* Display main screen */ + else if ($('#listfiles').is(':hidden') || $('.foldertab').is(':hidden')) { + if (!$command_dialog.is(':hidden')) { + this.fadeOut($command_dialog, function() { + $command_dialog.remove(); + if (command == null) $('.contentframe').css('height', fm.height.content - fm.height.toolbar - message_height + 'px'); + fm.fadeIn($('.foldertab')); + fm.fadeIn($('.paging')); + fm.fadeIn($('#listfiles'), function() { + if (args.message) fm.showMessage(args); + if (args.refresh) fm.cd(); + }); + }); + } + else { + this.fadeIn($('#listfiles'), function() { + if (args.message) fm.showMessage(args); + if (args.refresh) fm.cd(); + }); + this.fadeIn($('.foldertab')); + this.fadeIn($('.paging')); + } + this.showStatus(); + } + if (this.current.command == command) return; + + if (command == null && this.current.command != command) { + $("#ocwrapper").css('height', this.height.wrapper - command_height - message_height + 'px').css('margin-top', '0px'); + $("#content").css('height', this.height.content - message_height + 'px'); + $(".contentframe").css('height', this.height.content - message_height - command_height - 10 + 'px'); + + this.fadeOut($contentheader); + } + else { + $('#primarynav a[rel="' + command + '"]').parent().addClass('selected'); + +/* Create space for the command panel */ + if ($contentheader.is(':hidden')) { + if ($(".contentframe").length > 0) { + $("#content").css('height', fm.height.content - command_height + 'px'); + this.animate($(".contentframe"), { + height : this.height.content - this.height.toolbar - command_height, + scrollTop : 0 + }, 'fast', function() { + fm.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : fm.height.wrapper - command_height + }, 'fast', function() { + fm.slideDown($contentheader, function() { + $('#' + command + '_input').val(args.value || '').focus(); + }); + }); + }); + } + } + +/* Hide message box and resize the main screen */ + else if (msg_show) { + if ($(".contentframe").length > 0) { + $("#content").css('height', this.height.content - command_height + 'px'); + $(".contentframe").css('height', this.height.content - this.height.toolbar - command_height + 'px'); + + this.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : this.height.wrapper - command_height + }); + } + } + } + + /* Reset form before display it */ + this.resetForm(command); + + /* Display the command dialobottomg */ + if (this.current.command) { + this.fadeOut($('#cmd-' + this.current.command), function() { + fm.fadeIn($('#cmd-' + command), function() { + $('#' + command + '_input').val(args.value || '').focus(); + }); + }); + } + else { + this.fadeIn($('#cmd-' + command)); + } + +/* Remove #xx-content */ + $('#content').css('overflow', 'hidden'); + if (this.current.command) { + this.fadeOut($('#' + this.current.command + '-content'), function() { $('#' + this.current.command + '-content').remove() }); + $('.primarynav a[rel="' + this.current.command + '"]').parent().removeClass('selected'); + } + +/* Set the current command */ + this.current.command = command; + $('#cmd').val(command) + + if (this.form.find('input[name="cmd-result"]').length > 0 && command != 'command') { + this.form.find('input[name="cmd-result"]').remove(); + this.cd(); + } +} + +/* + actionDialog method: Show action dialog + action : should be action name + json : should be json object +*/ +FileMan.prototype.actionDialog = function(args) { + var fm = this; + if (this.fileEditor.beingEdited) { + this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { + fm.actionDialog(args); + }); + } + + if (!args) args = new Object; + var action = args.action; + var json = args.json; + + if (this.current.action == action) return; + +/* Clear timeoud ID if exists */ + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + +/* Get rid of hide from .fodlertab */ + if ($('.foldertab').is(':hidden')) { + $('#command-dialog').remove(); + this.fadeIn($('.foldertab')); + this.fadeIn($('.paging')); + this.fadeIn($('.readme')); + } + + var message_height = 0; + var toolbar_height = this.height.toolbar; + var folder_height = 0; + var $contentframe = $('.contentframe'); + var $contentheader = $('#contentheader'); + + if (json && json.message) { + this.showMessage(json); + message_height = this.height.contentmessage; + } + else if (!$('#contentmessage').is(':hidden')) { + this.slideUp($('#contentmessage')); + } + +/* Display a form instead: this applies for actions under toolbar menus*/ + var html = json && json.data.html ? json.data.html : ''; + if (html != '') { + if ($('#command-dialog').length == 0) $('#content').append('
'); + if (action != 'user' && action.search(/log/) == -1) toolbar_height -= this.height.folder; + if (action != 'user_modify' && json.data.user_modify) action = 'user_modify'; + + var $command_dialog = $('#command-dialog').css('overflow-y', 'hidden'); + this.fadeOut($('#listfiles'), function() { + fm.fadeOut($command_dialog, function() { + $command_dialog.html(html); + fm.fadeIn($command_dialog); + + $contentframe = $('#command-dialog .contentframe'); + if (action.search(/user/) == 0) { + if (action == 'user') { + fm.userManagement(json); + } + else { + fm.userAction(); + $command_dialog.find('input[name="button-cancel"]').click(function() { fm.actionForm('user'); }); + + $command_dialog.find('input[name="button-browse"]').click(function() { + var access = $('textarea[name="access_directories"]').val(); + var aTemp = access != '' ? access.split('\n') : new Array(); + fm.cdata.accesses = aTemp; + fm.browse({ + title : 'Select Directories', + filter : 1, + hidden_query : fm.hiddens.hidden_query, + multiple : true, + id : 'access_directories' + }) + }); + + $command_dialog.find('select[name="mod_type"]').change(function() { + if ($(this).val() == 1) { + fm.fadeOut($('#user_section')); + } + else { + fm.fadeIn($('#user_section')); + } + }); + } + } + else if (action == 'log') { + fm.browseLogs(json); + } + else if (action == 'uncompress') { + fm.uncompress(json.data.files); + folder_height = $('#command-dialog .foldertab:first').outerHeight() + 5; + } + + fm.animate($('#content'), { height : fm.height.content - message_height }); + fm.animate($contentframe, { height : fm.height.content - toolbar_height - message_height - folder_height }, 'normal', function() { + $command_dialog.find('input[id="' + action + '_input"]').focus(); + $command_dialog.find('.help').cluetip({ + activation : 'click', + closePosition : 'title', + closeText: 'Close', + width : 400, + height : 300, + sticky : true, + arrows : false + }); + }); + }); + }); + this.showStatus(this.languages[action] || action); + } + + if (!$contentheader.is(':hidden')) { + this.fadeOut($('#cmd-' + this.current.command), function() { + fm.animate($("#ocwrapper"), { + 'margin-top' : 0, + 'height' : fm.height.wrapper + }, 'normal', function() { + fm.animate($("#content"), { height: fm.height.content }); + $contentframe.css('height', fm.height.content - toolbar_height + 'px'); + + fm.fadeOut($contentheader, function() { + $('#' + action + '_input').focus(); + }); + }); + }); + + this.current.command = null; + $('.primarynav a[rel]').parent().removeClass('selected'); + } + else if (!html) { + this.animate($("#content"), { height: fm.height.content }); + $contentframe.css('height', fm.height.content - toolbar_height + 'px'); + } + +/* Reset form before display it */ + this.resetForm(action); + +/* Show action form if applicated */ + if (this.current.action && this.current.action != 'delete') { + this.fadeOut($('#cmd-' + this.current.action), function() { + fm.fadeIn($('#cmd-' + action), function () { + $('#' + action + '_input').focus(); + }); + }); + } + else { + this.fadeIn($('#cmd-' + action), function () { + $('#' + action + '_input').focus(); + }); + } + +/* Save the action */ + this.current.action = action; + $('#cmd').val(action) + this.form.find('input[name="confirm-name"]').val(''); + + /* Handle specific action */ + if (this.current.action.search(/delete|perl|print/) == 0) { + this.form.submit(); + } + else if (this.current.action == 'chmod') { + $('#cmd-chmod .checkbox').click(function() { + fm.chmod(); + }); + + /* Loading permission for a file if selected */ + var fselected = $('input[name="cinput"][checked]'); + if (fselected.length > 0) { + var fname = fselected.length == 1 ? fselected.val() : $(fselected[0]).val(); + this.parsePerm(fname); + } + } + else if (this.current.action == 'tail') { + $('#' + this.current.action + '_input').val('25'); + } +} + +/* + commandReponse method handles output of a command + json: should be json data object +*/ +FileMan.prototype.commandResponse = function(json) { + var command = this.current.command || this.current.action; + + var fm = this; + this.form.find('input[name="confirm-name"]').val(''); + if (command.search(/search|replace/) != -1) { /* The search command returns */ + this.paging.num_hits = json.data.hits; + this.paging.size = json.data.size; + this.readme = ''; + + /* Displaying search results, paging, and status info */ + this.sort(json.data.files, this.paging.sb, this.paging.so); + this.page(this.paging, function(nh) { fm.printFiles(nh); }); + + if (json.success) this.showStatus(); + this.form.append(''); + + this.showMessage(json); + } + else if (json.data.confirm == 1 && json.data.file) { + this.modalConfirm({ + html : 'Do you want to overwrite ' + json.data.file.name + '?', + yes : function($modal) { + fm.form.append('').submit(); + $modal.html('').jqmHide(); + }, + no : function($modal) { + $modal.html('').jqmHide(); + } + }); + } + else if (command.search(/copy|move/) == 0) { + this.copy(json); + } + else if (command == 'delete') { + this.remove(json); + } + else if (command == 'print') { + this.print(json); + } + else if (command == 'download') { + if (json.success) { + this.preview(json.data.file, 'download'); + } + else { + this.showMessage(json); + } + } + else if (command == 'perl') { + this.perl(json); + } + else if (command.search(/diff|tail/) == 0) { + if (json.success) { + this.showStatus(command); + + this.actionResponse('
' + json.data.output + '
'); + $('#' + command + '_input').focus(); + + /* Handle refreshing for tail command if enabled */ + if (command == 'tail' && json.data.refresh > 0) { + this.timerID = window.setTimeout(function() { fm.form.submit(); }, json.data.refresh * 1000); + } + } + else { + if (this.timerID) window.clearTimeOut(this.timerID); + this.showMessage(json); + } + } + else if (command.search(/user/) == 0) { + if (json.success == true) { + this.actionDialog({ action : 'user', json : json }); + } + else if (json.message) { + this.showMessage(json); + $('#user_action').val(''); + } + } + else if (command == 'logout') { + this.login(json.data.html); + } + else { + if (command == 'upload') $('#modal-dialog').jqm().jqmHide(); + if (json.success) { + /* Overwrite preferences */ + if (command == 'preferences') { + this.config.effect = json.data.defaults.effect == 1 ? true : false; + this.config.readme = json.data.defaults.readme; + this.paging.max_hits = json.data.defaults.maxhits; + this.paging.sb = json.data.defaults.sb || 'name'; + this.paging.so = json.data.defaults.so || 'asc'; + } + + var callback = this.fileEditor.callback; + var edited = this.fileEditor.beingEdited; + var action_called = this.fileEditor.actionCalled; + + /* Re-load file list */ + this.fileEditor = new Object(); + + if (action_called != true) { + if (command == 'uncompress') this.commandDialog({ success : json.success, message : json.message, refresh : true }); + else this.cd(json); + this.resetForm(command); + } + + /* Excutive editor's callback if available */ + if (edited && typeof(callback) == 'function') { + callback(); + } + } + else if (json.message) { + this.showMessage(json); + } + } +} + +/* + actionResponse method handles displaying the result of actions that aren't requried 'submit' button hit + (e.g.: delete, perl, print...) + html : should be html code +*/ +FileMan.prototype.actionResponse = function(html) { + this.form.append(''); + if ($('#command-dialog').length == 0) { + var contentframe_height = this.height.content - this.height.toolbar + this.height.folder; + this.fadeOut($('.paging')); + this.fadeOut($('.readme')); + this.fadeOut($('.foldertab'), function() { $(".contentframe").css('height', contentframe_height + 'px'); }); + $('.contentframe').append(''); + } + this.fadeIn($('#command-dialog').html(html)); +} + +/* + actionForm method prints out a action form. + action : should be an action + args : should be a hash of all parameters that are passed in. +*/ +FileMan.prototype.actionForm = function(action, args) { + var fm = this; + + this.printForm(action, function (response) { + if (response.success) { + fm.actionDialog({ action : action, json : response }); + } + else if (response.message) { + fm.showMessage(response); + } + }, args); +} + +/* + uploadFiles : allows multiple files uploading +*/ +FileMan.prototype.uploadFiles = function() { + var $modal = $('#modal-dialog'); + var html = '
' + this.hiddens.hidden_objects + + '

Upload Files

' + + '
'; + + var mwidth = 650; + var mleft = parseInt(($(window).width() - mwidth) / 2); + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '20%') + .html(html).jqmShow(); + + var fm = this; + $modal.find('a[rel="addfile"]').click(function() { + var uploads = $modal.find('input[type="file"]'); + if (uploads.length == fm.config.max_upload) return false; + if (uploads.length < fm.config.max_upload) { + $('#upfiles').append('
'); + $modal.find('input[name="num_files"]').val(uploads.length + 1); + } + return false; + }); + + $modal.find('.close').css('cursor', 'pointer').click(function() { $modal.html('').jqmHide(); }); + + var form = $modal.find('form'); + form.submit(function() { + $(this).hide(); + fm.upload(true); + }); + + form.ajaxForm({ + dataType : 'json', + success : function(response) { fm.commandResponse(response); } + }); + + return false; +} + +/* + upload command +*/ +FileMan.prototype.upload = function(multiple) { + var $modal = $('#modal-dialog'); + var fm = this; + $modal.jqm({ + onHide : function(hash) { + if (fm.timerID > 0) { + window.clearTimeout(fm.timerID); + fm.timerID = 0; + } + $modal.find('.done').css('width', fm.config.uploadmax_width + 'px'); + hash.w.fadeOut('fast',function() { hash.o.remove(); }); + } + }).removeClass().addClass('modal-dialog upload-dialog').css('width', this.config.uploadmax_width + 25 + 'px').css('top', '40%').css('left', '35%'); + + var html = ''; + + this.config.serial = randomString(); + if (multiple) { + $modal.append(html).jqmShow(); + $modal.find('form').attr('action', this.config.cgi_url + '?serial=' + this.config.serial).attr('enctype', 'multipart/form-data'); + } + else { + $modal.html(html).jqmShow(); + this.form.attr('action', this.config.cgi_url + '?serial=' + this.config.serial).attr('enctype', 'multipart/form-data'); + } + + if (this.timerID > 0) { + window.clearTimeout(fm.timerID); + this.timerID = 0; + } + this.timerID = window.setTimeout(function() { fm.uploadProgress(); }, 500); +} + +/* + uploadProgress method + This method handles upload progress +*/ +FileMan.prototype.uploadProgress = function() { + var $modal = $('#modal-dialog'); + var fm = this; + this.printForm('upload', function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (response.success) { + var uploaded = response.data.uploaded; + var upload_size = response.data.upload_size; + var elapsed_time = response.data.elapsed_time; + var filename = response.data.filename; + var allowed_space= response.data.allowed_space; + var free_space = response.data.free_space; + + if ($modal.find('#uploaded').length == 0) { + $modal.find('.meter-info').empty().html('Uploading... of at 0 KB/sec; 00:00:00 remain'); + if (allowed_space > 0 && free_space > upload_size) { + $modal.jqmHide(); + window.clearTimeout(fm.timerID); + fm.timerID = 0; + fm.showMessage({ message : 'NO_SPACE', success : false }); + return; + } + } + + if (fm.cdata.upload_filename != filename) { + $modal.find('.meter-filename').html(filename); + fm.cdata.upload_filename = filename; + } + + var percentage = upload_size > 0 ? Math.ceil((uploaded / upload_size) * 100) : 0; + if (fm.cdata.uploaded == uploaded) { + percentage = 100; + $modal.find('.done').css('width', fm.config.uploadmax_width + 'px'); + } + else { + var done_width = parseInt(percentage * fm.config.uploadmax_width / 100); + if (done_width > 0) $modal.find('.done').css('width', done_width + 'px'); + } + + var speed = elapsed_time > 0 ? (uploaded / elapsed_time) : 0; + var time = parseInt((elapsed_time * 100) / percentage); + var remain = eval(time - elapsed_time); + + if (percentage == 100) { + window.clearTimeout(fm.timerID); + fm.timerID = 0; + $modal.find('.meter-info').empty().html('Copying...'); + } + else { + $modal.find('#uploaded').html(friendly_size(uploaded)); + $modal.find('#upload-size').html(friendly_size(upload_size)); + $modal.find('#upload-speed').html(friendly_size(speed, 1, upload_size)); + $modal.find('#remain').html(format_time(remain)); + + fm.cdata.uploaded = uploaded; + fm.timerID = window.setTimeout(function() { fm.uploadProgress(); }, 500); + } + } + }, { upload : this.config.serial }); +} + +/* Download command */ +FileMan.prototype.download = function() { + var file = $('.foldertab input[name="cinput"][checked]'); + if (file.length == 0) { + this.showMessage({ success : false, message : "No File was selected." }); + } + else if (file.length > 1 && $('#cmd-download select[name="download_compress"]').val() == 0) { + this.showMessage({ success : false, message : 'No mode was selected.' }); + } +} + +/* + Perl command +*/ +FileMan.prototype.perl = function(json) { + this.resetCommand(); + + if (json.success) { + this.showStatus('perl'); + + var html = '
';
+        for (var i=0; i\n' +  message + '

'; + } + html += '
'; + this.actionResponse(html); + } + else { + this.showMessage(json); + } +} + +/* + hideMessage method: which does hide the message bar +*/ +FileMan.prototype.hideMessage = function() { + var $contentframe = $('#command-dialog .contentframe').length > 0 ? $('#command-dialog .contentframe') : $('.contentframe'); + var command_height = $('#contentheader').is(':hidden') ? 0 : $('#contentheader').height(); + var toolbar_height = this.height.toolbar - ($('#command-dialog .contentframe').length > 0 ? this.height.folder : 0); + var command = this.current.command || this.current.action; + + var fm = this; + this.slideUp($('#contentmessage').stopTime('msgtimer')); + this.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : this.height.wrapper - command_height + }, 'normal', function() { + $("#content").css('height', fm.height.content - command_height + 'px'); + $contentframe.css('height', fm.height.content - toolbar_height - command_height + 'px'); + $('#' + command + '_input').focus(); + }); +} + +/* + showMessage method which shows message bar + args: should be a hash as { message : 'blah', success : true/fase } +*/ +FileMan.prototype.showMessage = function(args) { + var success = args.success; + var message = args.message; + var $content_message = $('#contentmessage'); + var $content = $('#content'); + var $contentframe = $('#command-dialog .contentframe').length > 0 ? $('#command-dialog .contentframe') : $('.contentframe'); + var command = this.current.command || this.current.action; + var fm = this; + var commnand = this.current.command || this.current.action; + + $content_message.stopTime('msgtimer'); + if ($content_message.is(':hidden')) { + this.animate($contentframe, { + height : $contentframe.height() - this.height.contentmessage + }, 'normal', function() { + fm.animate($content, { + height : $content.height() - fm.height.contentmessage - 2 + }, 'normal', function() { + $content_message.removeClass(success ? 'error' : 'message').addClass(success ? 'message' : 'error').text(message); + fm.slideDown($content_message, function() { + if (!success) $('#' + command + '_input').focus(); + }); + }); + }); + + if (!success) $content_message.oneTime(5000, 'msgtimer', function() { fm.hideMessage(); }); + } + else { + $content_message.removeClass(success ? 'error' : 'message').addClass(success ? 'message' : 'error').text(message); + if (!success) $content_message.oneTime(5000, 'msgtimer', function() { fm.hideMessage(); }); + } +} + +/* + Print command +*/ +FileMan.prototype.print = function(json) { + if (json.success) { + var files = json.data.files; + var url = this.config.cgi_url + '?cmd=print;print=1' + this.hiddens.hidden_query; + var fm = this; + for (var i=0; i 0) { + var count = 0; + var confirms = json.data.confirms; + var fm = this; + + /* Print out the confirmation modal dialog */ + this.modalConfirm({ + data : json.data, + del : true, + html : 'Do you want to delete ' + confirms[0] + '', + yes : function($modal) { + $modal.find('input[name="confirm-name"]').val(confirms[count]); + $modal.find('form').submit(); + }, + all : function($modal) { + $modal.find('input[name="confirm-name"]').val('delete-all'); + $modal.find('form').submit(); + }, + skip : function($modal) { + /* Remove file from the list */ + $modal.find('input[name="cinput"][value="' + confirms[count] + '"]').remove(); + + count++; + if (count == confirms.length) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-skip'); + $modal.find('form').submit(); + } + else { + fm.resetCommand(); + $modal.html('').jqmHide(); + } + } + else { + $modal.find('#confirm-name').html(confirms[count]); + $modal.find('input[name="confirm-name"]').val(confirms[count]); + } + }, + cancel : function($modal) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-cancel'); + $modal.find('form').submit(); + } + else { + fm.resetCommand(); + $modal.html('').jqmHide(); + } + } + }); + } + else { + /* Hide the modal dialog if visible */ + $('#modal-dialog').html('').jqm().jqmHide(); + if (json.success) { + this.resetCommand(); + this.cd(json); + } + else { + this.showMessage(json); + } + } +} + +/* Copy/Move command */ +FileMan.prototype.copy = function(json) { + var command = this.current.command || this.current.action; + + /* Need to confirm on overwrite existing files */ + if (json.success && json.data.confirms && json.data.confirms.length > 0) { + var count = 0; + var confirms = json.data.confirms; + var fm = this; + + /* Print out the confirmation modal dialog */ + this.modalConfirm({ + data : json.data, + html : 'Do you want to overwrite ' + confirms[0] + '', + yes : function($modal) { + $modal.find('input[name="confirm-name"]').val(confirms[count]); + $modal.find('form').submit(); + }, + all : function($modal) { + $modal.find('input[name="confirm-name"]').val('copy-all'); + $modal.find('form').submit(); + }, + skip : function($modal) { + /* Remove file from the list */ + $modal.find('input[name="cinput"][value="' + confirms[count] + '"]').remove(); + + count++; + if (count == confirms.length) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-skip'); + $modal.find('form').submit(); + } + else { + $modal.html('').jqmHide(); + } + } + else { + $modal.find('#confirm-name').html(confirms[count]); + $modal.find('input[name="confirm-name"]').val(confirms[count]); + } + }, + cancel : function($modal) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-cancel'); + $modal.find('form').submit(); + } + else { + $modal.html('').jqmHide(); + } + } + }); + } + else { + /* Hide the modal dialog if visible */ + $('#modal-dialog').html('').jqm().jqmHide(); + + /* Reset values */ + if (json.success) { + this.cd(json); + $('#' + command + '_input').val('').focus(); + } + else { + this.showMessage(json); + } + } +} + +/* + The command command +*/ +FileMan.prototype.command = function() { + this.config.serial = randomString(); + $('#serial').val(this.config.serial); + + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + + var fm = this; + var longrun = $('#opt_long').attr('checked') ? true : false; + this.timerID = window.setTimeout( + function() { + fm.commandProgress(fm.config.serial, ';command_input=' + $('#command_input').val() + (longrun ? ';long=1' : '')); + }, (longrun ? 80 : 100) + ); +} + +/* + commandProgress method handles command output + randome_str : should be a unique string + input : should be a string of command inputs +*/ +FileMan.prototype.commandProgress = function(random_str, input) { + var fm = this; var flag = true; + var $first_prompt = $('#command-dialog span[class="prompt"]:first'); + if ($('#' + random_str).length == 0) { + $first_prompt.after('
'); + } + else { + flag = false; + } + $.ajax({ + type : 'GET', + url : this.config.cgi_url + '?cmd=command' + input + (this.working_dir ? ';working_dir=' + this.working_dir : '') + ';serial=' + this.config.serial + ';retrieve=1;ajax=1' + this.hiddens.hidden_query, + dataType : 'xml', + cache : false, + success : function(response, tstatus) { + var prompt = response.getElementsByTagName('prompt')[0].firstChild.nodeValue; + var next_prompt = response.getElementsByTagName('next_prompt')[0].firstChild.nodeValue; + var command = response.getElementsByTagName('command')[0].firstChild.nodeValue; + var output = response.getElementsByTagName('output')[0].firstChild.nodeValue; + fm.working_dir = response.getElementsByTagName('working')[0].firstChild.nodeValue; + $('#cmd-command input[name="working_dir"]').val(fm.working_dir); + + if (flag) { + $('#command_input').val('').focus(); + $('#cmd-' + random_str).html('' + htmlEscape(prompt) + ' ' + htmlEscape(command)); + } + if (next_prompt != $first_prompt.html()) $first_prompt.html(htmlEscape(next_prompt)); + + if (output.search(/timeout|done/) > -1) { + output = output.replace(/done/, ''); + $('#' + random_str).html('
' + htmlEscape(output) + '
'); + + /* Clear timer ID */ + window.clearTimeout(fm.timerID); + fm.timerID = 0; + $.ajax({ + type : 'GET', + dataType : 'xml', + cache : false, + url : fm.config.cgi_url + '?cmd=command;serial=' + fm.config.serial + ';remove=1;ajax=1' + fm.hiddens.hidden_query + }); + } + else { + $('#' + random_str).html('
' + output + '
'); + fm.timerID = window.setTimeout(function() { fm.commandProgress(random_str, input); }, 500); + } + } + }); +} + +/* + List information about the files of a directory + args : should be a hash of all options + func : should be a callback function. +*/ +FileMan.prototype.ls = function(args, func) { + if (!args) args = new Object(); + var dname = args.dname || ''; + var html = '
' + + '' + + '' + (args.hidden_objects || this.hiddens.hidden_objects) + '
'; + + var $form = $('#cdbar').append(html).find('#tmpform'); + if (args.breadcrumbs) $form.find('input[name="work_path"]').val(''); + + var params = new Array('load_default', 'filter', 'a'); + for (var i=0; i'); + } + + var fm = this; + $form.submit(function() { + $(this).ajaxSubmit({ + dataType : 'json', + success : function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (typeof(func) == 'function') { + func(response); + } + $form.remove(); + } + }); + return false; + }); + $form.submit(); +} + +FileMan.prototype.loading = function(action) { + if (action == 'start') { + var fm = this; + this.timer = true; + $(document).oneTime(this.config.timer, 'waitingtimer', function() { + if (!fm.timer) return; + var mwidth = 16; + var mleft = parseInt((fm.screen.width - mwidth) / 2); + $('#waiting-dialog').jqm().removeClass().addClass('modal-dialog modal-waiting') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '40%') + .html('').jqmShow(); + }); + } + else { + this.timer = false; + if (!$('#waiting-dialog').is(':hidden')) $('#waiting-dialog').html('').jqmHide(); + } +} +/* + cd command + args : should be a hash of + dname : should be directory name where you want to cd to + breadcrumbs : should be true/false. work_path will be set to null if it's true + work_path : should be true/false +*/ +FileMan.prototype.cd = function(args) { + if (!args) args = new Object(); + + this.loading('start'); + var success = args.success; + var fm = this; + this.ls(args, function(response) { + if (response.success) { + fm.paging.num_hits = response.data.hits; + fm.paging.size = response.data.size; + fm.paging.current_page = 1; + fm.hiddens = response.data.hiddens; + fm.readme = response.data.readme_content; + + if (response.data.root_path) fm.config.root_path = response.data.root_path; + $('#hiddens').empty().append(fm.hiddens.hidden_objects); + + if (response.data.paths) { + fm.paths = response.data.paths.loop; + fm.parent = response.data.paths.parent; + fm.config.work_path = response.data.paths.work_path; + } + else { + fm.paths = new Array(); + fm.parent = ''; + fm.config.work_path = '/'; + } + + /* Print out the list of files, sorting, bread crumbs, paging */ + fm.sort(response.data.files, fm.paging.sb, fm.paging.so); + fm.breadCrumbs(); + fm.page(fm.paging, function(nh) { fm.printFiles(nh); }); + fm.showStatus(); + + $('#cdform input[name="dname"]').focus(); + + if ($('#listfiles').is(':hidden') || $('.foldertab').is(':hidden')) { + fm.commandDialog(args); + } + else if (!success && !$('#contentmessage').is(':hidden')) { + fm.hideMessage(); + } + else if (success) { + fm.showMessage(args); + } + + fm.htaccess(response.data.htaccess_users); + } + else { + fm.showMessage(response); + } + fm.loading('end'); + }); +} + +/* + modalConfirm show a modal confirm dialog + args : should be a hash of all actions + e.g. + object.modalConfirm({ + data : 'json data object', + yes : function($modal) { + Do something here.. + }, + no : function($modal) { + blah blah.. + } + .... + }); +*/ +FileMan.prototype.modalConfirm = function(args) { + var $modal = $('#modal-dialog'); + var html = '
' + + '' + this.hiddens.hidden_objects + + '

Confirmation

' + + '
'; + + var nwidth = 400; + var nleft = parseInt($(window).width() - nwidth) /2; + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form modal-confirm') + .css('left', nleft + 'px').css('top', '30%').css('width', nwidth + 'px') + .html(html).jqmShow().find('input[type="button"]').click(function() { + var name = $(this).attr('name'); + if (name == 'button-yes' && typeof(args.yes) == 'function') args.yes($modal); + else if (name == 'button-all' && typeof(args.all) == 'function') args.all($modal); + else if (name == 'button-skip' && typeof(args.skip) == 'function') args.skip($modal); + else if (name == 'button-no' && typeof(args.no) == 'function') args.no($modal); + else if (name == 'button-cancel' && typeof(args.cancel) == 'function') args.cancel($modal); + }); + var fm = this; + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $('select[class="action"]').val(''); + fm.current.action = ''; + $modal.jqmHide(); + }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(data) { + fm.commandResponse(data); + } + }); +} + +/* + printFiles method handles files listing + nh : should be a page number +*/ +FileMan.prototype.printFiles = function(nh) { + if (typeof(nh) == 'undefined') nh = 1; + + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var $body = $('.contentframe table[class="foldertab"]'); + $body.empty(); + $('.readme').remove(); + + var count = 0; + var array = ''; + var maps = this.maps; + + /* Print out parent link */ + if (this.parent != '') { + var tr = ' <\/td>' + + '
File Folder<\/a><\/div><\/td>' + + '..<\/a><\/td>' + + ' <\/td>' + + ' <\/td>' + + ' <\/td>' + + ' <\/td>'; + + tr += this.config.is_win + ? '<\/tr>\n<\/td>\n>' + : ' <\/td><\/tr>\n<\/td>\n'; + + $body.append(tr); + + $('.link-uplevel').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname : link.attr('rel') }); + return false; + }); + }); + } + + /* Print out a empty page */ + if (this.files.length == 0) { + $('#fm_action').attr('disabled', true); + $('#checkall').attr('disabled', true); + $body.append('No files were found!<\/td><\/tr>'); + } + else { + $('#fm_action').attr('disabled', ''); + $('#checkall').attr('disabled', ''); + + /* Print files of page n */ + for (var i=beg; i<\/td>' + + '
File Folder<\/a><\/div><\/td>' + + '' + this.files[i][maps.name] + '<\/a><\/td>' + + '' + (this.files[i][maps.type] == 1 ? ' ' : friendly_size(this.files[i][maps.size])) + '<\/td>' + + '' + this.files[i][maps.desc] + '<\/td>' + + '' + this.files[i][maps.sdate] + '<\/td>'; + + tr += this.config.is_win + ? '\n<\/td><\/tr>\n' + : '' + this.files[i][maps.owner] + '<\/td>' + this.files[i][maps.sperm] + '<\/a><\/td><\/tr>\n<\/td><\/tr>\n'; + + $body.append(tr); + count++; + } + } + + /* display README content if enabled */ + if (this.readme != '') { + if (this.config.readme == 2) { + $body.after('

README\'s content

\n' + this.readme + '
'); + } + else if (this.config.readme == 1) { + $body.before('
README\'s content\n' + this.readme + '
'); + } + } + + /* Set an action for File Folder icons/links */ + var fm = this; + $('.link-folder[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for File icons */ + $('.icon').find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.printForm('preview', function (response) { + if (response.success) { + fm.preview(response.data.file); + } + else { + fm.showMessage(response); + } + }, { f : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for File links */ + $('.name').find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.loading('start'); + fm.form.find('input[name="cmd-result"]').remove(); + fm.printForm('edit', function(response) { + if (response.success) { + if (response.data.compressed == 1) { + fm.actionDialog({ action : 'uncompress', json : response }); + } + else if (response.data.file) { + fm.preview(response.data.file); + } + else { + fm.editor('edit', link.attr('rel'), response.data.type, response.data.html); + } + } + else { + fm.showMessage(response); + } + + fm.loading('end'); + }, { f : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for permission links */ + $('td[class="permission"]').find('a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.parsePerm(link.attr('rel')); + return false; + }); + }); + + /* Print out the sorting image */ + $('.foldertab th a[rel] img').remove(); + $('.foldertab th a[rel="' + this.paging.sb + '"]').append(' '); + + /* Set actions for checkboxes */ + var $foldertab = $('.foldertab'); + $foldertab.find('input[name="checkall"]').attr('checked', false); + + $foldertab.find('input[type="checkbox"]').each(function() { + $(this).change(function() { + if ($(this).val() == 'checkall') { + $foldertab.find('input[type="checkbox"]').attr('checked', $(this).attr('checked') ? true : false); + } + else { + var flag = true; + var fname; var selected = 0; + $foldertab.find('input[name="cinput"]').each(function() { + if ($(this).attr('checked')) { + selected++; + fname = $(this).val(); + } + else { + flag = false; + } + }); + if (selected == 1 && fm.current.action == 'chmod') fm.parsePerm(fname); + $foldertab.find('input[name="checkall"]').attr('checked', flag); + } + fm.fileStats(); + }); + }); +} + +/* + sort method handle sorting files + source : should be an array + sb : sort by column index + so : sort order. It should be asc/desc +*/ +FileMan.prototype.sort = function(source, sb, so) { + this.paging.current_page = 1; + if (typeof(source) == 'undefined') return; + if (typeof(source) == 'object' || source.length > 0) { + + /* Need to seperate folders and files before sorting */ + var afolders = new Array(); var afiles = new Array(); + var maps = this.maps; + for (var i=0; i 0) afolders.qsort(0, afolders.length, maps[sb], so); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps[sb], so); + + if (so == 'desc') { + for (var i=0; i' + selected + ' files, ' + friendly_size(size) + ''); +} + +/* Create path bread-crumbs */ +FileMan.prototype.breadCrumbs = function() { + var bread_crumbs = '
' + ($('#uaccess').length > 0 ? (this.config.root_path + '<\/a>') : ('Root<\/a>: ')); + for (var i=0; i' + this.paths[i].folder + '<\/a>'; + } + $('#bread-crumbs').html(bread_crumbs); + + var fm = this; + $('#bread-crumbs a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname: link.attr('rel'), breadcrumbs : true }); + return false; + }); + }); +} + +/* Reset command variables */ +FileMan.prototype.resetCommand = function() { + this.current.command = null; + this.current.action = null; + $('#cmd').val(''); + $('#fm_action').attr('selectedIndex', 0); +} + +/* resetForm method: reset all inputs */ +FileMan.prototype.resetForm = function(command) { + $('#cmd-' + command + ' *').each(function() { + var type = $(this).attr('type'); + if (type && type.search(/text|password|file/) == 0) $(this).val(''); + else if (type == 'checkbox' || type == 'radio') $(this).attr('checked', false); + else if (this.tagName == 'SELECT') $(this).attr('selectedIndex', 0); + }); + if (command == 'upload') document.getElementById('myform').reset(); +} + +/* showStatus method */ +FileMan.prototype.showStatus = function(status) { + var contentfooter = $('#contentfooter'); + if (status) { + contentfooter.find('.status').html(status); + contentfooter.find('.summary').addClass('hide'); + } + else { + this.fileStats(); + contentfooter.find('.summary').removeClass().addClass('summary').html('Total ' + this.paging.num_hits + ' files, ' + friendly_size(this.paging.size) + ''); + } +} + +/* + parsePerm method gets permission info of a file + fname : should be filename +*/ +FileMan.prototype.parsePerm = function(fname) { + $('#fm_action').val('chmod').change(); + + /* Loading file info */ + var beg = this.paging.current_page == 1 ? 0 : ((this.paging.current_page - 1) * this.paging.max_hits); + var count = 0; + var file = new Array(); + for (var i=beg; i= 16) { + $('#ar').attr('checked', sperm.substr(0,1) == 'r' ? true : false); + $('#aw').attr('checked', sperm.substr(1,1) == 'w' ? true : false); + $('#ax').attr('checked', sperm.substr(2,1) == 'x' ? true : false); + $('#ur').attr('checked', sperm.substr(4,1) == 'r' ? true : false); + $('#uw').attr('checked', sperm.substr(5,1) == 'w' ? true : false); + $('#ux').attr('checked', sperm.substr(6,1) == 'x' ? true : false); + $('#gr').attr('checked', sperm.substr(8,1) == 'r' ? true : false); + $('#gw').attr('checked', sperm.substr(9,1) == 'w' ? true : false); + $('#gx').attr('checked', sperm.substr(10,1) == 'x' ? true : false); + $('#or').attr('checked', sperm.substr(12,1) == 'r' ? true : false); + $('#ow').attr('checked', sperm.substr(13,1) == 'w' ? true : false); + $('#ox').attr('checked', sperm.substr(14,1) == 'x' ? true : false); + } + else { + $('#ur').attr('checked', sperm.substr(0,1) == 'r' ? true : false); + $('#uw').attr('checked', sperm.substr(1,1) == 'w' ? true : false); + $('#ux').attr('checked', sperm.substr(2,1) == 'x' ? true : false); + $('#gr').attr('checked', sperm.substr(4,1) == 'r' ? true : false); + $('#gw').attr('checked', sperm.substr(5,1) == 'w' ? true : false); + $('#gx').attr('checked', sperm.substr(6,1) == 'x' ? true : false); + $('#or').attr('checked', sperm.substr(8,1) == 'r' ? true : false); + $('#ow').attr('checked', sperm.substr(9,1) == 'w' ? true : false); + $('#ox').attr('checked', sperm.substr(10,1)== 'x' ? true : false); + } + + $('#chmod_input').val(file[this.maps.perm]); +} + +/* + chmod command +*/ +FileMan.prototype.chmod = function(octal) { + if (octal && octal.length > 0) { + var perm_map = { 0: 'u',1 : 'g',2 : 'o' }; + var nums = octal.split(""); + var count = 0; + for (var i=0; i'); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : files.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'name', so : 'asc' }, + action : function(nh) { fm.printCompressed(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + return false; + }); + }); + +/* Set actions for checkboxes */ + var $foldertab = $('#command-dialog .foldertab'); + $foldertab.find('input[type="checkbox"]').each(function() { + $(this).click(function() { + if ($(this).val() == 'checkall') { + $foldertab.find('input[type="checkbox"]').attr('checked', $(this).attr('checked') ? true : false); + } + else { + var flag = true; + $foldertab.find('input[name="compress"]').each(function() { + if ($(this).attr('checked')) return; + flag = false; + return false; + }); + + $foldertab.find('input[name="checkall"]').attr('checked', flag); + } + fm.fileStats({ inputs : $inputs, nh : fm.cdata.nh, files : fm.cdata.files }); + }); + }); + + /* Handle paging */ + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : files.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'name', so : 'asc' }, + action : function(nh) { fm.printCompressed(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + $('#command-dialog input[name="button-browse"]').click(function() { + fm.browse({ + title : 'Select Directory', + filter : 1, + hidden_query : fm.hiddens.hidden_query, + id : 'uncompress_input' + }); + }); + + this.fileStats({ inputs : $('#command-dialog .foldertab').find('input[name="compress"]'), nh : this.cdata.nh, files : this.cdata.files }); + $('#contentfooter .summary').removeClass().addClass('summary').html('Total ' + files.length + ' files, ' + friendly_size(this.cdata.size) + ''); +} + +/* + This method handles sorting compressed's content +*/ +FileMan.prototype.sortCompressed = function(sb) { + if (this.cdata.files.length == 0) return; + + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + this.cdata.nh = 1; + + /* Need to seperate folders and files before sorting */ + var afolders = new Array(); var afiles = new Array(); + var maps = this.maps; + var files = this.cdata.files; + var size = 0; + + for (var i=0; i 0) afolders.qsort(0, afolders.length, maps[sb], so); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps[sb], so); + + if (so == 'desc') { + for (var i=0; i<\/td>' + + '
<\/div><\/td>' + + '' +files[i][maps.name] + '<\/td>' + + '' + (files[i][maps.type] == 1 ? ' ' : friendly_size(files[i][maps.size])) + '<\/td>' + + '' + files[i][maps.desc] + '<\/td>' + + '' + files[i][maps.sdate] + '<\/td>'; + + tr += this.config.is_win + ? '\n<\/td><\/tr>\n' + : '' + files[i][maps.owner] + '<\/td>' + files[i][maps.sperm] + '<\/td><\/tr>\n<\/td><\/tr>\n'; + + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +FileMan.prototype.editorConfirm = function(func) { + var fm = this; + this.modalConfirm({ + html : 'Do you want to save your changes?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.fileEditor.callback = function() { + if (typeof(func) == 'function') func(); + } + fm.form.submit(); + }, + no : function($modal) { + $modal.html('').jqmHide(); + fm.fileEditor = new Object(); + if (typeof(func) == 'function') func(); + }, + cancel : function($modal) { + $modal.html('').jqmHide(); + } + }); +} + +FileMan.prototype.newfile = function() { + var fm = this; + if (this.fileEditor.beingEdited) { + this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { fm.newfile(); }); + } + + this.form.find('input[name="cmd-result"]').remove(); + this.printForm('file', function(response) { + if (response.success) { + /* Remove command-dialog if exists */ + var $command_dialog = $('#command-dialog'); + if ($command_dialog.length > 0) { + fm.fadeOut($command_dialog, function() { + $command_dialog.remove(); + fm.editor('file', '', '', response.data.html); + }); + } + else { + fm.editor('file', '', '', response.data.html); + } + } + else { + fm.showMessage(response); + } + }); +} +/* + File command + command : should be newfile/edit + filename : shoule be file name +*/ +FileMan.prototype.editor = function(command, filename, filetype, html) { + var content = $('#content').append(html).find('textarea').val(); + this.config.tinyMCE.plugins = (filename != '' && content.search(/||<body/i) == -1) + ? "style,table,advhr,advimage,advlink,preview,media,searchreplace" + : "style,table,advhr,advimage,advlink,preview,media,searchreplace,fullpage"; + + /* Remove these objects if they already exist */ + $('#edit_input').val(filename || ''); + this.form.find('input[name="file"]').remove(); + this.form.find('input[name="overwrite_confirmed"]').remove(); + + if (filename) { + this.form.append('<input type="hidden" name="file" value="' + filename + '" />'); + this.showStatus(filename + ' (<span>' + this.config.work_path + '</span>)'); + } + else { + this.showStatus('[No Name]'); + } + + /* Editor switch mode action */ + var $switch_mode = $('.switch-mode'); + var $editor_mode = $('#editor_mode'); + + if (filetype == 'html' || filetype == '') { + this.fadeIn($switch_mode.val('Switch To ' + ($editor_mode.val() == 'html' ? 'TEXT' : 'HTML'))); + } + else { + this.fadeOut($switch_mode); + } + + var fm = this; + this.fileEditor.beingEdited = false; + $switch_mode.click(function() { + var mode = $editor_mode.val(); + if (mode == 'html') { + var content = fm.tinyMCEContent(); + tinyMCE.activeEditor.hide(); + fm.fadeIn($('textarea[name="editor"]').val(content).css('height', $('#command-dialog').height() - 5 + 'px')); + } + else { + var editor = $('#command-dialog textarea[name="editor"]'); + editor.css('height', editor.height() - 8 + 'px'); + + if (tinyMCE.activeEditor && tinyMCE.activeEditor.isHidden()) { + tinyMCE.activeEditor.show(); + } + else { + tinyMCE.init(fm.config.tinyMCE); + } + } + $editor_mode.val(mode == 'html' ? 'text' : 'html'); + $switch_mode.val('Switch To ' + (mode == 'html' ? 'HTML' : 'TEXT')); + }); + + this.commandDialog({ command : command, value : filename }); +} + +/* + This method handles preview/download a file. + file : File information. It should be a hash + download : if it's passed it, file will be sent to browser +*/ +FileMan.prototype.preview = function(file, download) { + if (typeof(file) != 'object') return; + if (!download && file.type.search(/image|text|html/) == 0) { + var content = file.type.search(/html|text/) == 0 + ? ('<pre>' + file.content + '</pre>') + : ('<div class="preview-image"><img src="' + this.config.cgi_url + '?cmd=fdownload;f=' + file.name + this.hiddens.hidden_query + '" title="' + file.name + '" /></div>'); + + var html = '<div class="toolbar clear"><h3 class="header">Preview a File</h3>' + + '<div><b>' + file.name + '</b></div></div>' + + '<div class="contentframe">' + content + '</div>'; + this.actionDialog({ action : 'preview', json : { data : { html : html }} }); + } + else { + var src = this.config.cgi_url + '?cmd=fdownload;f=' + file.name + if (file.source) src += ';type=' + file.source; + if (file.mode) src += ';mode=' + file.mode; + src += this.hiddens.hidden_query; + + if ($('.contentframe iframe[name="preview"]').length == 0) { + $('.contentframe').append('<iframe name="preview" src="' + src + '" class="hide"></iframe>'); + } + else { + $('.contentframe iframe[name="preview"]').attr('src', src); + } + } +} + +/* + printForm: print out a command form +*/ +FileMan.prototype.printForm = function(action, func, args) { + var html = '<form id="tmpform" action="' + this.config.cgi_url + '" method="post" class="hide">' + + '<input type="hidden" name="cmd" value="' + action +'" /><input type="hidden" name="ajax" value="1" /><input type="hidden" name="form" value="1" />'; + + if (action == 'command') { + html += '<input type="hidden" name="prompt" value="1" />'; + $('#cmd-command input[name="working_dir"]').val(''); + } + + if (args && typeof(args) == 'object') { + for (var i in args) { + if (typeof(args[i]) == 'object') { + for (j=0; j<args[i].length;j++) { + html += '<input type="hidden" name="' + i + '" value="' + args[i][j] + '" />'; + } + } + else { + html += '<input type="hidden" name="' + i + '" value="' + args[i] + '" />'; + } + } + } + + html += this.hiddens.hidden_objects + '</form>'; + + var $form = $('#home').append(html).find('#tmpform'); + var fm = this; + $form.submit(function() { + $(this).ajaxSubmit({ + dataType : 'json', + success : function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (typeof(func) == 'function') { + func(response); + } + $form.remove(); + } + }); + return false; + }); + + $form.submit(); +} + +/* + advanceSearch command +*/ +FileMan.prototype.advanceSearch = function() { + var fm = this; + this.printForm('search', function(response) { + var $modal = $('#modal-dialog'); + var mwidth = 650; + var mleft = parseInt(($(window).width() - mwidth) / 2); + var mtop = parseInt(($(window).height() - 400) / 2); + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', mtop + 'px') + .html(response.data.html).jqmShow().find('input[name="search_input"]').focus(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $modal.jqmHide(); + fm.form.find('input[name="search_input"]').focus(); + }); + + if (response.success) { + $modal.find('form').ajaxForm({ + dataType : 'json', + success : function(res) { + if (res.success) { + if (res.data.hits == 0) { + $modal.find('form p.error').show().text(res.message); + } + else { + fm.commandResponse(res); + $modal.jqmHide(); + } + } + else { + $modal.find('form p.error').show().text(res.message); + $modal.find('input[name="search_input"]').focus(); + } + } + }); + + $modal.find('.date-pick').datePicker({ clickInput : true, startDate: fm.startDate() }); + $('#fromdate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#todate').dpSetStartDate(d.addDays(1).asString()); + } + }).dpSetDisabled(true); + + $('#todate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#fromdate').dpSetEndDate(d.addDays(-1).asString()); + } + }).dpSetDisabled(true); + + $modal.find('input[name="search_mod"]').each(function() { + var obj = $(this); + obj.click(function() { + var flag = obj.val() == 'date' ? false : true; + $('#fromdate').dpSetDisabled(flag); + $('#todate').dpSetDisabled(flag); + }); + }); + } + else { + this.showMessage(response); + } + }); + return false; +} + +FileMan.prototype.userAction = function(action) { + if (!action || action == '') return; + + if (action == 'user_add') return this.actionForm(action); + + var selected = $('#command-dialog').find('input[name="cuser"][checked]'); + if (selected.length == 0) { + $('#user_action').attr('selectedIndex', 0); + this.showMessage({ success : false, message : "No user was selected." }); + return; + } + + /* Return the modify form instead if one user is selected */ + if (action.search(/user_access|user_permission/) == 0) { + var cuser = new Array; + selected.each(function() { + cuser.push($(this).val()); + }); + this.actionForm(action, { cuser : cuser }); + } + else { + this.current.action = action; + $('#cmd').val(action); + + var fm = this; + this.modalConfirm({ + html : 'Do you want to delete selected user(s)?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#user_action').val(''); + $modal.html('').jqmHide(); + } + }); + } +} + +FileMan.prototype.userManagement = function(json) { + if (json.data.users.length == 0) { + $('#user_action').attr('disabled', true); + return; + } + + this.cdata = { + map : { type : 0, username : 1, password : 2, name : 3, email : 4, added : 5, permission : 6, access : 7, allowed_space : 8 }, + users : json.data.users, + so : 'desc', + nh : 1 + }; + this.sortUsers(); + var fm = this; + $('#command-dialog th a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.sortUsers(link.attr('rel')); + + var so = fm.cdata.so || 'asc'; + $('#command-dialog th a[rel]').find('img').remove(); + $('#command-dialog th a[rel="' + link.attr('rel') + '"]').append(' <img src="' + fm.config.image_url + '/icons/' + (so == 'desc' ? 'descending.gif' : 'ascending.gif') + '" title="' + (so == 'desc' ? 'V' : '^') + '" \/>'); + return false; + }); + }); + $('#command-dialog select[name="user_action"]').change(function() { fm.userAction($(this).val()); }); + $('#command-dialog .contentframe .username a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.actionForm('user_modify', { u : link.attr('rel') }); + return false; + }); + }); +} + +FileMan.prototype.sortUsers = function(sb) { + if (!sb) sb = 'username'; + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + + var ausers = this.cdata.users; + var maps = this.cdata.map; + + ausers.qsort(0, ausers.length, maps[sb], so); + + this.cdata.users = ausers; + this.cdata.so = so; + this.printUsers(this.cdata.nh); +} + +FileMan.prototype.printUsers = function(nh) { + if (!nh) nh = 1; + + var ausers = this.cdata.users; + var maps = this.cdata.map; + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var body = $('#command-dialog .contentframe').find('table[class="foldertab"]'); + body.empty(); + + var count = 0; + for (var i=beg; i<ausers.length; i++) { + if (count == this.paging.max_hits) break; + var u = ausers[i]; + var access = new Array; + if (u[maps.access]) { + for (var j=0; j<u[maps.access].length; j++) { + var a = u[maps.access][j]; + access.push(a.disp); + } + } + var tr = '<tr><td class="selectbox"><input type="checkbox" name="cuser" value="' + u[maps.username] + '" /><\/td>' + + '<td class="username"><a href="#" rel="' + u[maps.username] + '">' + u[maps.username] + '</a><\/td>' + + '<td class="type">' + (u[maps.type] == 0 ? 'User' : 'Admin') + '<\/td>' + + '<td class="email">' + u[maps.email] + '<\/td>' + + '<td class="access"><pre>' + access.join("\n") + '</pre><\/td>'; + + tr += '<tr class="spacer"><td colspan="6"><\/td><\/tr>\n'; + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +/* + browse which allows you to select files, directories from a list + args : should be a hash of + - title : title of the windows + - filter : what you want to show up in the list. 1: folder only, 2: folder and text file + - multiple : allows multiple files selected + - id : the object ID you want to return to +*/ +FileMan.prototype.browse = function(args) { + if (!args) args = new Object(); + args['modal'] = true; + + this.cdata.changed= false; + + var $modal = $('#modal-dialog'); + var mwidth = 450; + var mleft = parseInt(($(window).width() - mwidth) / 2); + var html = '<form action="' + this.config.cgi_url + '" method="post">\n<h1 class="clear">\n<img src="' + this.config.image_url + '/icons/close.gif" title="Close" class="close" />\n<span>' + args.title + '</span>\n</h1><div class="modal-content">'; + if (args.filter == 2) html +='<p>Location: <input type="text" name="location" value="" class="text longtext" readonly \/>'; + html += '<p class="error hide"></p>\n<div class="currentpath"><span id="modal-breadcrumbs"></span></div>'; + +/* Root select box. */ + if (args.multiple) html += '<div class="rootpath"><input type="checkbox" id="location_root" value="1" /><label for="location_root">Root Directory</label></div>'; + + html += '<table class="foldertab">\n<tr>'; + +/* Allow multiple directories selected */ + if (args.multiple) html += '<th class="selectbox"> <\/th>'; + + html += '<th class="icon"><\/th>\n<th class="name">Name</th>\n<th class="scrollbar"><\/th><\/tr><\/table>\n' + + '<div class="contentframe">\n<table class="foldertab"><\/table><\/div>' + + '<div class="buttonbar clear"><span><input type="hidden" name="select_path" value="" \/><input type="button" name="button-cancel" value="Cancel" class="submit" /> <input type="button" name="button-select" value="Select" class="submit" \/><\/span>'; + html += '<input type="input" name="makedir_input" value="" class="text shorttext" \/><input type="submit" name="button-makedir" value="Create Folder" class="button" \/>'; + html += '</div></div><div id="hiddens" class="hide"><\/div><input type="hidden" name="cmd" value="makedir" \/><\/form>\n'; + + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '120px') + .html(html).jqmShow(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $modal.find('input[name="button-cancel"]').click(); + }); + + var fm = this; + $modal.find('input[name="button-cancel"]').click(function() { + $modal.html('').jqmHide(); + if (fm.cdata.changed) fm.cd(); + }); + + if (args.id) { + $modal.find('input[name="button-select"]').click(function() { + if (args.multiple) { + var accesses = ''; + if ($modal.find('#location_root').attr('checked')) { + accesses = '/'; + } + else { + for (var i=0; i<fm.cdata.accesses.length; i++) { + if (fm.cdata.accesses[i] == '' && fm.cdata.accesses[i] != fm.config.root_path) continue; + accesses += fm.cdata.accesses[i] + (i == fm.cdata.accesses.length - 1 ? '' : '\n'); + } + } + $('#' + args.id).val(accesses); + } + else { + var val = $modal.find('input[name="select_path"]').val(); + if (args.filter == 2) { + var loc = $modal.find('input[name="location"]').val() ; + if (loc != '') { + val += val == '/' ? loc : ('/' + loc); + $('#' + args.id).val(val); + } + else { + return; + } + } + else { + $('#' + args.id).val(val); + } + } + $modal.html('').jqmHide(); + }); + } + this.browseFiles($modal, args); +} + +/* + browseFiles: listing files and directories + $modal : shoule be modal object + args : should be a hash of all paramters +*/ +FileMan.prototype.browseFiles = function($modal, args) { + var dname = args.dname; + var hidden_query = args.hidden_query || ''; + + var fm = this; + var maps = this.maps; + var url = '?cmd=cd' + (args.filter > 0 ? (';filter=' + args.filter) : '') + hidden_query + (typeof(dname) != 'undefined' ? ';f=' + dname : ''); + if (args.multiple) url += ';multiple=1'; + this.ls(args, function(response) { + if (response.success) { + var source = response.data.files; + var hiddens = response.data.hiddens; + var paths = new Array(); + var parent = ''; + var work_path = ''; + + if (response.data.paths) { + paths = response.data.paths.loop; + parent = response.data.paths.parent; + work_path = response.data.paths.work_path; + } + + var afolders = new Array(); var afiles = new Array(); + for (var i=0; i<source.length; i++) { + if (source[i][maps.type] == 1) afolders.push(source[i]); + else afiles.push(source[i]); + } + + if (afolders.length > 0) afolders.qsort(0, afolders.length, maps['name'], 'asc'); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps['name'], 'asc'); + + for (var i=0; i<afiles.length; i++) { + afolders.push(afiles[i]); + } + + var breadcrumbs = '<a href="#" rel="/" class="root link-breadcrumb">Root</a>:'; + for (var i=0; i<paths.length; i++) { + breadcrumbs += '/<a href="#" rel="' + (paths[i].path != '' ? paths[i].path + '/' : '') + paths[i].folder + '" class="link-breadcrumb">' + paths[i].folder + '<\/a>'; + } + $modal.find('#modal-breadcrumbs').html(breadcrumbs); + + var files = ''; + if (parent != '') { + files += '<tr>'; + if (args.multiple) files += '<td class="selectbox"> <\/td>'; + files += '<td class="icon"><div class="icon-uplevel"><a href="#" rel="' + parent + '" class="icon-linkable link-folder">File Folder<\/a><\/div><\/td>' + + '<td class="name"><a href="#" rel="' + parent + '" title="Up One Level" class="link-folder">...<\/a><\/td>' + + '<\/tr>\n<tr class="spacer"><td colspan="' + (args.multiple ? 4 : 3) + '"><\/td><\/tr>\n'; + } + + for (var i=0; i<afolders.length; i++) { + files += '<tr>'; + if (args.multiple) files += '<td class="selectbox"><input type="checkbox" name="cselect" value="' + work_path + '/' + afolders[i][maps.name] +'" /><\/td>'; + files += '<td class="icon"><div class="icon-' + afolders[i][maps.icon] + '"><a href="#" rel="' + afolders[i][maps.name] + '" title="File Folder" class="icon-linkable ' + (afolders[i][maps.type] == 1 ? 'link-folder' : 'link-file') + '"><\/a><\/div><\/td>' + + '<td class="name"><a href="#" rel="' + afolders[i][maps.name] + '" title="File Folder" class="' + (afolders[i][maps.type] == 1 ? 'link-folder' : 'link-file') + '">' + afolders[i][maps.name] + '<\/a><\/td>' + + '<\/tr>\n<tr class="spacer"><td colspan="' + (args.multiple ? 4 : 3) + '"><\/td><\/tr>\n'; + } + $modal.find('.contentframe table').empty().append(files); + $modal.find('#hiddens').empty().append(hiddens.hidden_objects); + + /* Sent action for links and inputs */ + $modal.find('.link-folder[rel]').each(function() { + var link = $(this); + link.click(function() { + args['dname'] = link.attr('rel'); + args['hidden_objects'] = hiddens.hidden_objects; + args['breadcrumbs'] = false; + fm.browseFiles($modal, args); + return false; + }); + }); + + $modal.find('.link-breadcrumb[rel]').each(function() { + var link = $(this); + link.click(function() { + args['dname'] = link.attr('rel'); + args['breadcrumbs'] = true; + args['hidden_objects'] = fm.hiddens.hidden_objects; + fm.browseFiles($modal, args); + return false; + }); + }); + + $modal.find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + $modal.find('input[name="location"]').val(link.attr('rel')); + }); + }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(data) { + if (data.success) { + args['hidden_query'] = hiddens.hidden_query; + fm.browseFiles($modal, args); + $modal.find('input[name="makedir_input"]').val('').focus(); + fm.cdata.changed = true; + } + else { + $modal.find('.error').removeClass('hide').html(data.message); + $modal.find('input[name="makedir_input"]').focus(); + } + } + }); + + $modal.find('input[name="location"]').val(''); + $modal.find('input[name="select_path"]').val(work_path); + + /* This applies for multiple selects */ + if (args.multiple) { + $modal.find('input[name="cselect"]').each(function() { + var input = $(this); + input.click(function() { + fm.updateAccess(input.val(), input.attr('checked')); + }); + }); + + $modal.find('#location_root').change(function() { + $modal.find('input[name="cselect"]').attr('disabled', $(this).attr('checked') ? true : false); + fm.cdata.accesses = new Array(); + }); + + /* Pre-select user access folders */ + var found_root = false; + var preselect = fm.cdata.accesses; + for (i=0; i<preselect.length; i++) { + var found = $modal.find('input[value="' + preselect[i] + '"]'); + if (found.length > 0) found.attr('checked', true); + else if (preselect[i] == '/') { + found_root = true; + break; + } + } + + if (found_root) $modal.find('#location_root').attr('checked', true).change(); + } + + } + else { + fm.showMessage(response); + } + }); +} + +/* Add/Remove a user access directory */ +FileMan.prototype.updateAccess = function(path, flag) { + if (!flag) { /* Remove a path from the selected list */ + var accesses = new Array(); + for (var i=0; i<this.cdata.accesses.length; i++) { + if (path == this.cdata.accesses[i]) continue; + accesses[accesses.length] = this.cdata.accesses[i]; + } + this.cdata.accesses = accesses; + } + else { /* Add a path into the list */ + var found = false; + for (var i=0; i<this.cdata.accesses.length; i++) { + if (path == this.cdata.accesses[i]) { + found = true; + break; + } + } + if (!found) this.cdata.accesses.push(path); + } +} + +/* Browse logs actions */ +FileMan.prototype.browseLogs = function(json) { + if (json.data.logs.length == 0) { + $('#log_action').attr('disabled', true); + return; + } + + this.cdata = { + map : { uid: 0, ip: 1, date: 2, action: 3, desc: 4, sdate : 5 }, + logs : json.data.logs, + so : 'asc', + nh : 1 + }; + + var fm = this; + $('#command-dialog th a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.sortLogs(link.attr('rel')); + var so = fm.cdata.so || 'asc'; + $('#command-dialog th a[rel]').find('img').remove(); + $('#command-dialog th a[rel="' + link.attr('rel') + '"]').append(' <img src="' + fm.config.image_url + '/icons/' + (so == 'desc' ? 'descending.gif' : 'ascending.gif') + '" title="' + (so == 'desc' ? 'V' : '^') + '" \/>'); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : json.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + return false; + }); + }); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : json.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + $('#log_action').change(function() { + var action = $(this).val(); + if (action == 'log_delete') { + fm.current.action = action; + $('#cmd').val(action); + fm.modalConfirm({ + html : 'Are you sure you want to clear the logs?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#log_action').val(''); + $modal.html('').jqmHide(); + } + }); + } + else if (action == 'log_search') { + fm.printForm('log', function (response) { + var $modal = $('#modal-dialog'); + var mwidth = 650; + var mleft = parseInt((fm.screen.width - mwidth) / 2); + + if (response.success) { + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px') + .html(response.data.html).jqmShow(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { $modal.jqmHide(); }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(res) { + if (res.success) { + $modal.jqmHide(); + fm.cdata.logs = res.data.logs; + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : res.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + fm.sortLogs(); + if (res.message) fm.showMessage(res); + } + else { + $modal.find('form p.error').show().text(res.message); + $modal.find('input[name="search_input"]').focus(); + } + } + }); + + $modal.find('.date-pick').datePicker({ clickInput : true, startDate : fm.startDate() }); + $('#fromdate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#todate').dpSetStartDate(d.addDays(1).asString()); + } + }); + + $('#todate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#fromdate').dpSetEndDate(d.addDays(-1).asString()); + } + }); + } + }, { search : 1 }); + } + $(this).val(''); + }); + fm.sortLogs(); +} + +FileMan.prototype.sortLogs = function(sb) { + if (!sb) sb = 'date'; + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + + var alogs = this.cdata.logs; + var maps = this.cdata.map; + + alogs.qsort(0, alogs.length, maps[sb], so); + + this.cdata.logs = alogs; + this.cdata.so = so; + this.cdata.nh = 1; + this.printLogs(this.cdata.nh); +} + +FileMan.prototype.printLogs = function(nh) { + if (!nh) nh = 1; + + var alogs = this.cdata.logs; + var maps = this.cdata.map; + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var body = $('#command-dialog .contentframe').find('table[class="foldertab"]'); + body.empty(); + + var count = 0; + for (var i=beg; i<alogs.length; i++) { + if (count == this.paging.max_hits) break; + var l = alogs[i]; + var tr = '<tr><td class="modified">' + l[maps.sdate] + '<\/td>' + + '<td class="owner">' + l[maps.uid] + '<\/td>' + + '<td class="permission">' + l[maps.ip] + '<\/td>' + + '<td class="action">' + l[maps.action] + '<\/td>' + + '<td class="name">' + l[maps.desc] + '<\/td>'; + + tr += '<tr class="spacer"><td colspan="6"><\/td><\/tr>\n'; + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +/* + protect command +*/ +FileMan.prototype.htaccess = function(users) { + $('#cmd-protect input[name="protect-delete-all"]').remove(); + + var select = $('#cmd-protect select'); + select.empty(); + + if (users && users.length > 0) { + users.qsort(0, users.length, 0, 'asc'); + select.append('<option value="">---</option>'); + for (var i=0; i<users.length; i++) { + select.append('<option value="' + users[i] + '">' + users[i] + '</option>'); + } + select.attr('disabled', false); + + var fm = this; + $('#cmd-protect input[name="button-delete"]').attr('disabled', false).click(function() { fm.htaccessDelete(); }); + $('#cmd-protect input[name="button-delete-all"]').attr('disabled', false).click(function() { fm.htaccessDelete(true); }); + } + else { + select.attr('disabled', true); + $('#cmd-protect input[name="button-delete"]').attr('disabled', true); + $('#cmd-protect input[name="button-delete-all"]').attr('disabled', true); + } +} + +/* + need a confirmation on delete htaccess users +*/ +FileMan.prototype.htaccessDelete = function(all) { + var msg; + if (all) { + msg = 'Are you sure you want to delete all users?'; + $('#cmd-protect').append('<input type="hidden" name="protect-delete-all" value="1" />'); + } + else if ($('#protect_user').val() == '') { + this.showMessage({ success : false, message : "No user was selected." }); + return; + } + else { + $('#cmd-protect input[name="protect-delete-all"]').remove(); + msg = 'Are you sure you want to delete "' + $('#protect_user').val() + '"?'; + $('#htaccess-delete').val(''); + } + + var fm = this; + this.modalConfirm({ + html : msg, + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#user_action').val(''); + $modal.html('').jqmHide(); + } + }); +} + +/* Help contents */ +FileMan.prototype.help = function() { + var width = 780; + var height = 600; + var attrs = 'resizable=no,status=yes,toolbar=no,menubar=no,location=no,width=' + width + ',height=' + height + ',left=400,top=10'; + var w = window.open(this.config.cgi_url + '?page=help.html' + this.hiddens.hidden_query, 'help', attrs); + w.focus(); +} + +/* About FileMan */ +FileMan.prototype.about = function() { + var $modal = $('#modal-dialog'); + var nleft = parseInt(($(window).width() - 400) / 2); + var ntop = parseInt((this.screen.height - 400)/ 2); + var html = '<div class="aboutcontent">' + + '<div><b>Version:<\/b> ' + this.config.version + '<\/div>' + + '<div><b>Registration Number:<\/b> ' + (this.config.regnum != '' ? this.config.regnum : 'Free') + '<\/div>' + + '<div class="copyright">©2001 - 2008. Powered By Gossamer Threads Inc.<br \/><b> <a href="http://www.gossamer-threads.com/scripts/fileman/license.htm" target="_blank">View License Information »<\/a><\/b><\/div>' + + '<div class="close"><a href="#">Close<\/a><\/div><\/div>'; + $modal.jqm().removeClass().addClass('modal-dialog modal-about ') + .css('left', nleft + 'px').css('top', ntop + 'px').css('width', '420px') + .html(html).jqmShow(); + + $modal.find('.close a').click(function() { + $modal.html('').jqmHide(); + return false; + }); +} + +FileMan.prototype.startDate = function() { + var format = this.config.date_format.split(/-|\\/); + var d = ''; + for (var i=0; i<format.length; i++) { + if (format[i] == 'yyyy') { + d += d != '' ? '-1996' : '1996'; + } + else { + d += d != '' ? '-01' : '01'; + } + + } + return d; +} + +/* + Animate method + $obj : should be jquery object + args : should be a hash of all properties that are used for animate. e.g. margin-top, height, width, etc... + func : should be a callback function +*/ +FileMan.prototype.animate = function($obj, args, speed, func) { + if (this.config.effect) { + var maps = { height : 'height', width : 'width', 'margin-top' : 'marginTop', 'margin-bottom' : 'marginBottom' }; + var opts = new Object(); + + for (var i in args) { + if (!maps[i]) continue; + opts[maps[i]] = args[i]; + } + $obj.animate(opts, speed || 'normal', function() { + if (typeof(func) == 'function') func(); + }) + } + else { + for (var i in args) { + $obj.css(i, args[i] + 'px'); + } + if (typeof(func) == 'function') func(); + } +} + +/* + slideUp method + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.slideUp = function($obj, func) { + if (this.config.effect) { + $obj.slideUp('normal', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.hide('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + slideDown method + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.slideDown = function($obj, func) { + if (this.config.effect) { + $obj.slideDown('normal', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.show('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + Show a object with/without an effection + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.fadeIn = function($obj, func) { + if (this.config.effect) { + $obj.fadeIn('fast', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.show('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + Hide a object with/without an effection + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.fadeOut = function($obj, func) { + if (this.config.effect) { + $obj.fadeOut('fast', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.hide('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* Unescape GT tags and manually the textarea with the content instead of using tinyMCE.activeEditor.save() method */ +FileMan.prototype.tinyMCEContent = function() { + var content = ''; + if (tinyMCE.activeEditor == null) return content; + + content = tinyMCE.activeEditor.getContent(); + content = content.replace(/%>/gi, '%>'); + content = content.replace(/<%/gi, '<%'); + return content; +} + +/* quick sort which allows you to sort an array of arrays +source: is an array +begin: should be a number. Which is the start point +end: should be a number. Which is the end point +column: should be sort column + */ +Array.prototype.qsort = function(begin, end, column, sort_order) { + if (end - 1 > begin) { + var pivot = begin + Math.floor(Math.random() * (end - begin)); + + pivot = this.partition(begin, end, pivot, column, sort_order); + + this.qsort(begin, pivot, column, sort_order); + this.qsort(pivot + 1, end, column, sort_order); + } +} + +Array.prototype.partition = function(begin, end, pivot, column, sort_order) { + var piv = this[pivot][column]; + this.swap(pivot, end - 1); + + var store = begin; + if (sort_order == 'desc') { + for (var i= begin; i<end - 1; ++i) { + if (this[i][column] > piv) { + this.swap(store, i); + ++store; + } + } + } + else { + for (var i= begin; i<end - 1; ++i) { + if (this[i][column] <= piv) { + this.swap(store, i); + ++store; + } + } + } + + this.swap(end - 1, store); + return store; +} + +Array.prototype.swap = function(a, b) { + var tmp = this[a]; + this[a] = this[b]; + this[b] = tmp; +} + +/* + page Object + args : is a hash of + - image_url : image URL + - paging : should be a hash of max_hits, so, sb +*/ +function page(args, $page) { + for (var i in args) { + this[i] = args[i]; + } + if (args.paging.max_hits >= args.paging.num_hits) { + $page.html(''); + return; + } + + var paging = args.paging; + var options = { + max_pages : 20, + boundary_pages : 1, + style : 1, + style_next : '<img src="' + args.image_url + '/paging-next.gif" alt=">" title="Next Page" />', + style_prev : '<img src="' + args.image_url + '/paging-prev.gif" alt="<" title="Previous Page" />', + style_first : '<img src="' + args.image_url + '/paging-first.gif" alt="|<" title="First Page" />', + style_last : '<img src="' + args.image_url + '/paging-last.gif" alt=">|" title="Last Page" />', + style_nonext : '<img src="' + args.image_url + '/paging-nonext.gif" alt="" />', + style_noprev : '<img src="' + args.image_url + '/paging-noprev.gif" alt="" />', + style_nofirst : '<img src="' + args.image_url + '/paging-nofirst.gif" alt="" />', + style_nolast : '<img src="' + args.image_url + '/paging-nolast.gif" alt="" />', + lang_of : ' of ', + paging_pre : '', + paging_post : '' + }; + + paging.num_pages = parseInt(paging.num_hits / paging.max_hits); + if (paging.num_hits % paging.max_hits > 0) paging.num_pages++ + + this.page = $page; + this.paging.num_pages = paging.num_pages; + this.paging.options = options; + this.print(true); + this.pagingAction(); +} + +page.prototype.print = function(fresh) { + var paging = this.paging; + var options = this.paging.options; + var start = 0; var end = 0; + if (paging.num_pages <= options.max_pages) { + start = 1; + end = paging.num_pages; + } + else if (paging.current_page >= paging.num_pages - options.max_pages / 2) { + end = paging.num_pages; + start = end - options.max_pages + 1; + } + else if (paging.current_page <= options.max_pages / 2) { + start = 1; + end = options.max_pages; + } + else { + start = paging.current_page - parseInt(options.max_pages / 2) + 1; + if (options.max_pages % 2 > 0) start--; + end = paging.current_page + parseInt(options.max_pages / 2); + } + + var left_boundary = 0; + var right_boundary = 0; + if (end >= paging.num_pages - options.boundary_pages - 1) end = paging.num_pages; + else right_boundary = 1; + + if (start <= options.boundary_pages + 2) start = 1; + else left_boundary = 1; + + var pages = new Array(); + if (left_boundary > 0) { + for (var i=0; i<options.boundary_pages;i++) pages.push(i + 1); + pages.push('...'); + } + for (var i=start;i<=end;i++) { + pages.push(i); + } + + if (right_boundary > 0) { + pages.push('...'); + for (var i=paging.num_pages - options.boundary_pages + 1; i<=paging.num_pages; i++) pages.push(i); + } + + paging.pages = pages; + var page_html = ''; + + if (fresh) { + page_html += options.paging_pre; + page_html += '<span id="page-first">' + options.style_nofirst + '<\/span> <span id="page-prev">' + options.style_noprev + '<\/span> '; + page_html += '<select>'; + } + + for (var i=0; i<pages.length; i++) { + if (pages[i] == '...') { + page_html += '<option value="" disabled="disabled">...<\/option>'; + } + else { + page_html += '<option value="' + pages[i] + '"'; + if (pages[i] == paging.current_page) page_html += ' selected="selected"'; + page_html += '>' + pages[i] + options.lang_of + paging.num_pages + '<\/option>'; + } + } + + var pg = this; + if (fresh) { + page_html += '<\/select> '; + page_html += '<span id="page-next">' + options.style_next + '<\/span> <span id="page-last">' + options.style_last + '<\/span>'; + page_html += options.paging_post; + this.page.html(page_html); + } + else { + this.page.find('select').empty().html(page_html); + } + + this.page.find('select').change(function() { + if (this.options[this.selectedIndex].innerHTML != '...' && typeof(pg.action) == 'function') { + pg.gotoPage(this.options[this.selectedIndex].value); + } + }); +} + +/* + Setting actions for paging: next, previous, etc... +*/ +page.prototype.pagingAction = function() { + var pg = this; + var parent_obj = this.parent ? this.parent : $('.toolbar'); + + if (this.paging.current_page == 1) { + if (parent_obj.find('#page-first').find(this.paging.options.style_nofirst).length == 0) parent_obj.find('#page-first').html(this.paging.options.style_nofirst); + if (parent_obj.find('#page-prev').find(this.paging.options.style_noprev).length == 0) parent_obj.find('#page-prev').html(this.paging.options.style_noprev); + } + else { + if (parent_obj.find('#page-first').find(this.paging.options.style_first).length == 0) { + parent_obj.find('#page-first').html(this.paging.options.style_first); + parent_obj.find('#page-first img').click(function() { pg.gotoPage(1); }); + } + if (parent_obj.find('#page-prev').find(this.paging.options.style_prev).length == 0) { + parent_obj.find('#page-prev').html(this.paging.options.style_prev); + parent_obj.find('#page-prev img').click(function() { pg.gotoPage(pg.paging.current_page - 1) }); + } + } + + if (this.paging.current_page == this.paging.num_pages) { + if (parent_obj.find('#page-last').find(this.paging.options.style_nolast).length == 0) parent_obj.find('#page-last').html(this.paging.options.style_nolast); + if (parent_obj.find('#page-prev').find(this.paging.options.style_nonext).length == 0) parent_obj.find('#page-next').html(this.paging.options.style_nonext); + } + else { + if (parent_obj.find('#page-last').find(this.paging.options.style_last).length == 0) { + parent_obj.find('#page-last').html(this.paging.options.style_last); + parent_obj.find('#page-last img').click(function() { pg.gotoPage(pg.paging.num_pages); }); + } + if (parent_obj.find('#page-next').find(this.paging.options.style_next).length == 0) { + parent_obj.find('#page-next').html(this.paging.options.style_next); + parent_obj.find('#page-next img').click(function() { + pg.gotoPage(pg.paging.current_page + 1); + }); + } + } + this.page.find('img').css('cursor', 'pointer'); +} + +/* + gotoPage method +*/ +page.prototype.gotoPage = function(nh) { + if (nh > this.paging.num_pages) return; + + this.paging.current_page = parseInt(nh); + + if (this.paging.num_pages > this.paging.options.max_pages) this.print(); + this.pagingAction(); + + this.page.find('option[value="' + nh +'"]').attr('selected', true); + if (typeof(this.action) == 'function') this.action(nh); +} + +/* Global functions */ +function friendly_size(num, force_kb, total_size) { + if (num < 100) return num + ' bytes'; + var force_mb = total_size > 999999 ? 1 : 0; + var unit; + if((num > 999999 || force_mb) && !force_kb) { + num = num/(1024*1024); + num = num.toString(); + var testnum = num.replace( /^(\d+\.\d).*/, '$1' ); + if(testnum == '0.0') testnum = num.replace( /^(\d+\.\d\d).*/, '$1' ); + if(testnum == '0.00') testnum = num.replace( /^(\d+\.\d\d\d).*/, '$1' ); + num = testnum; + unit = 'MB'; + } + else { + var kb = num/1024; + var decimal = kb - parseInt(kb); + num = parseInt(kb); + if (decimal > 0) { + var str = decimal.toFixed(3).substr(1, 3); + num += '' + str; + } + unit = 'KB'; + } + return num + ' ' + unit; +} + +function getScreenHeight() { /* $(window).height() does not working properly on window resizing */ + if (window.innerHeight) return window.innerHeight; + else if (document.documentElement.clientHeight) return document.documentElement.clientHeight; + else if (window.clientHeight) return window.clientHeight; + else if (document.body.clientHeight) return document.body.clientHeight; + else return 0; +} + +function getScreenWidth() { + if (window.innerWidth) return window.innerWidth; + else if (document.documentElement.clientWidth) return document.documentElement.clientWidth; + else if (window.clientWidth) return window.clientWidth; + else if (document.body.clientWidth) return document.body.clientWidth; + else return 0; +} + +function randomString() { + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; + var string_length = 8; + var randomstring = ''; + for (var i=0; i<string_length; i++) { + var rnum = Math.floor(Math.random() * chars.length); + randomstring += chars.substring(rnum,rnum+1); + } + + return randomstring; +} + +function format_time(num) { + if(num >= 60 * 60){ + var secs_left = num % (60 * 60); + var mins_left = secs_left / 60; + mins_left = mins_left.toString(); + mins_left = mins_left.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + mins_left = mins_left.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = num/(60*60); + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num + ':' + mins_left + ':00'; + } + else if(num >= 60) { + var secs_left = num % 60; + secs_left = secs_left.toString().replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = num/60; + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = '00:' + num + ':' + secs_left; + } + else { + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + num = '00:00:' + num; + } + return num; +} + +function htmlEscape(text) { + text = text.replace(/&/g, '&'); + text = text.replace(/</g, '<'); + text = text.replace(/>/g, '>'); + text = text.replace(/"/g, '"'); + return text; +} + diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.cluetip.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.cluetip.js new file mode 100644 index 0000000..8372791 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.cluetip.js @@ -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); diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.datePicker.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.datePicker.js new file mode 100644 index 0000000..bd5103d --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.datePicker.js @@ -0,0 +1,1056 @@ +/** + * Copyright (c) 2007 Kelvin Luck (http://www.kelvinluck.com/) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * $Id: jquery.datePicker.js,v 1.1 2008/07/21 22:54:09 bao Exp $ + **/ + +(function($){ + + $.fn.extend({ +/** + * Render a calendar table into any matched elements. + * + * @param Object s (optional) Customize your calendars. + * @option Number month The month to render (NOTE that months are zero based). Default is today's month. + * @option Number year The year to render. Default is today's year. + * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback. + * @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT. + * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. + * @type jQuery + * @name renderCalendar + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#calendar-me').renderCalendar({month:0, year:2007}); + * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. + * + * @example + * var testCallback = function($td, thisDate, month, year) + * { + * if ($td.is('.current-month') && thisDate.getDay() == 4) { + * var d = thisDate.getDate(); + * $td.bind( + * 'click', + * function() + * { + * alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year); + * } + * ).addClass('thursday'); + * } else if (thisDate.getDay() == 5) { + * $td.html('Friday the ' + $td.html() + 'th'); + * } + * } + * $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback}); + * + * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text. + **/ + renderCalendar : function(s) + { + var dc = function(a) + { + return document.createElement(a); + }; + + s = $.extend( + { + month : null, + year : null, + renderCallback : null, + showHeader : $.dpConst.SHOW_HEADER_SHORT, + dpController : null, + hoverClass : 'dp-hover' + } + , s + ); + + if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) { + var headRow = $(dc('tr')); + for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) { + var weekday = i%7; + var day = Date.dayNames[weekday]; + headRow.append( + jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day) + ); + } + }; + + var calendarTable = $(dc('table')) + .attr( + { + 'cellspacing':2, + 'className':'jCalendar' + } + ) + .append( + (s.showHeader != $.dpConst.SHOW_HEADER_NONE ? + $(dc('thead')) + .append(headRow) + : + dc('thead') + ) + ); + var tbody = $(dc('tbody')); + + var today = (new Date()).zeroTime(); + + var month = s.month == undefined ? today.getMonth() : s.month; + var year = s.year || today.getFullYear(); + + var currentDate = new Date(year, month, 1); + + + var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1; + if (firstDayOffset > 1) firstDayOffset -= 7; + var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7); + currentDate.addDays(firstDayOffset-1); + + var doHover = function() + { + if (s.hoverClass) { + $(this).addClass(s.hoverClass); + } + }; + var unHover = function() + { + if (s.hoverClass) { + $(this).removeClass(s.hoverClass); + } + }; + + var w = 0; + while (w++<weeksToDraw) { + var r = jQuery(dc('tr')); + for (var i=0; i<7; i++) { + var thisMonth = currentDate.getMonth() == month; + var d = $(dc('td')) + .text(currentDate.getDate() + '') + .attr('className', (thisMonth ? 'current-month ' : 'other-month ') + + (currentDate.isWeekend() ? 'weekend ' : 'weekday ') + + (thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '') + ) + .hover(doHover, unHover) + ; + if (s.renderCallback) { + s.renderCallback(d, currentDate, month, year); + } + r.append(d); + currentDate.addDays(1); + } + tbody.append(r); + } + calendarTable.append(tbody); + + return this.each( + function() + { + $(this).empty().append(calendarTable); + } + ); + }, +/** + * Create a datePicker associated with each of the matched elements. + * + * The matched element will receive a few custom events with the following signatures: + * + * dateSelected(event, date, $td, status) + * Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false) + * + * dpClosed(event, selected) + * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects. + * + * dpMonthChanged(event, displayedMonth, displayedYear) + * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month. + * + * dpDisplayed(event, $datePickerDiv) + * Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker. + * + * @param Object s (optional) Customize your date pickers. + * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month. + * @option Number year The year to render when the date picker is opened. Default is today's year. + * @option String startDate The first date date can be selected. + * @option String endDate The last date that can be selected. + * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup) + * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true. + * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true. + * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true. + * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false. + * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false. + * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear. + * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP. + * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT. + * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0. + * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0. + * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback. + * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. + * @type jQuery + * @name datePicker + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('input.date-picker').datePicker(); + * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format). + * + * @example demo/index.html + * @desc See the projects homepage for many more complex examples... + **/ + datePicker : function(s) + { + if (!$.event._dpCache) $.event._dpCache = []; + + // initialise the date picker controller with the relevant settings... + s = $.extend( + { + month : undefined, + year : undefined, + startDate : undefined, + endDate : undefined, + inline : false, + renderCallback : [], + createButton : true, + showYearNavigation : true, + closeOnSelect : true, + displayClose : false, + selectMultiple : false, + clickInput : false, + verticalPosition : $.dpConst.POS_TOP, + horizontalPosition : $.dpConst.POS_LEFT, + verticalOffset : 0, + horizontalOffset : 0, + hoverClass : 'dp-hover' + } + , s + ); + + return this.each( + function() + { + var $this = $(this); + var alreadyExists = true; + + if (!this._dpId) { + this._dpId = $.event.guid++; + $.event._dpCache[this._dpId] = new DatePicker(this); + alreadyExists = false; + } + + if (s.inline) { + s.createButton = false; + s.displayClose = false; + s.closeOnSelect = false; + $this.empty(); + } + + var controller = $.event._dpCache[this._dpId]; + + controller.init(s); + + if (!alreadyExists && s.createButton) { + // create it! + controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>') + .bind( + 'click', + function() + { + $this.dpDisplay(this); + this.blur(); + return false; + } + ); + $this.after(controller.button); + } + + if (!alreadyExists && $this.is(':text')) { + $this + .bind( + 'dateSelected', + function(e, selectedDate, $td) + { + this.value = selectedDate.asString(); + } + ).bind( + 'change', + function() + { + var d = Date.fromString(this.value); + if (d) { + controller.setSelected(d, true, true); + } + } + ); + if (s.clickInput) { + $this.bind( + 'click', + function() + { + $this.dpDisplay(); + } + ); + } + var d = Date.fromString(this.value); + if (this.value != '' && d) { + controller.setSelected(d, true, true); + } + } + + $this.addClass('dp-applied'); + + } + ) + }, +/** + * Disables or enables this date picker + * + * @param Boolean s Whether to disable (true) or enable (false) this datePicker + * @type jQuery + * @name dpSetDisabled + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetDisabled(true); + * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field. + **/ + dpSetDisabled : function(s) + { + return _w.call(this, 'setDisabled', s); + }, +/** + * Updates the first selectable date for any date pickers on any matched elements. + * + * @param String d A string representing the first selectable date (formatted according to Date.format). + * @type jQuery + * @name dpSetStartDate + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetStartDate('01/01/2000'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium. + **/ + dpSetStartDate : function(d) + { + return _w.call(this, 'setStartDate', d); + }, +/** + * Updates the last selectable date for any date pickers on any matched elements. + * + * @param String d A string representing the last selectable date (formatted according to Date.format). + * @type jQuery + * @name dpSetEndDate + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetEndDate('01/01/2010'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010. + **/ + dpSetEndDate : function(d) + { + return _w.call(this, 'setEndDate', d); + }, +/** + * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element. + * + * @type Array + * @name dpGetSelected + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * alert($('.date-picker').dpGetSelected()); + * @desc Will alert an empty array (as nothing is selected yet) + **/ + dpGetSelected : function() + { + var c = _getController(this[0]); + if (c) { + return c.getSelected(); + } + return null; + }, +/** + * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker. + * + * @param String d A string representing the date you want to select (formatted according to Date.format). + * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true. + * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true. + * @type jQuery + * @name dpSetSelected + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetSelected('01/01/2010'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. + **/ + dpSetSelected : function(d, v, m) + { + if (v == undefined) v=true; + if (m == undefined) m=true; + return _w.call(this, 'setSelected', Date.fromString(d), v, m); + }, +/** + * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead. + * + * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month. + * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year. + * @type jQuery + * @name dpSetDisplayedMonth + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetDisplayedMonth(10, 2008); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. + **/ + dpSetDisplayedMonth : function(m, y) + { + return _w.call(this, 'setDisplayedMonth', Number(m), Number(y)); + }, +/** + * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed. + * + * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker. + * @type jQuery + * @name dpDisplay + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpDisplay(); + * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up. + **/ + dpDisplay : function(e) + { + return _w.call(this, 'display', e); + }, +/** + * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page + * + * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. + * @type jQuery + * @name dpSetRenderCallback + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year) + * { + * // do stuff as each td is rendered dependant on the date in the td and the displayed month and year + * }); + * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed. + **/ + dpSetRenderCallback : function(a) + { + return _w.call(this, 'setRenderCallback', a); + }, +/** + * Sets the position that the datePicker will pop up (relative to it's associated element) + * + * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM + * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT + * @type jQuery + * @name dpSetPosition + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT); + * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element. + **/ + dpSetPosition : function(v, h) + { + return _w.call(this, 'setPosition', v, h); + }, +/** + * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition) + * + * @param Number v The vertical offset of the created date picker. + * @param Number h The horizontal offset of the created date picker. + * @type jQuery + * @name dpSetOffset + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetOffset(-20, 200); + * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position. + **/ + dpSetOffset : function(v, h) + { + return _w.call(this, 'setOffset', v, h); + }, +/** + * Closes the open date picker associated with this element. + * + * @type jQuery + * @name dpClose + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-pick') + * .datePicker() + * .bind( + * 'focus', + * function() + * { + * $(this).dpDisplay(); + * } + * ).bind( + * 'blur', + * function() + * { + * $(this).dpClose(); + * } + * ); + * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred. + **/ + dpClose : function() + { + return _w.call(this, '_closeCalendar', false, this[0]); + }, + // private function called on unload to clean up any expandos etc and prevent memory links... + _dpDestroy : function() + { + // TODO - implement this? + } + }); + + // private internal function to cut down on the amount of code needed where we forward + // dp* methods on the jQuery object on to the relevant DatePicker controllers... + var _w = function(f, a1, a2, a3) + { + return this.each( + function() + { + var c = _getController(this); + if (c) { + c[f](a1, a2, a3); + } + } + ); + }; + + function DatePicker(ele) + { + this.ele = ele; + + // initial values... + this.displayedMonth = null; + this.displayedYear = null; + this.startDate = null; + this.endDate = null; + this.showYearNavigation = null; + this.closeOnSelect = null; + this.displayClose = null; + this.selectMultiple = null; + this.verticalPosition = null; + this.horizontalPosition = null; + this.verticalOffset = null; + this.horizontalOffset = null; + this.button = null; + this.renderCallback = []; + this.selectedDates = {}; + this.inline = null; + this.context = '#dp-popup'; + }; + $.extend( + DatePicker.prototype, + { + init : function(s) + { + this.setStartDate(s.startDate); + this.setEndDate(s.endDate); + this.setDisplayedMonth(Number(s.month), Number(s.year)); + this.setRenderCallback(s.renderCallback); + this.showYearNavigation = s.showYearNavigation; + this.closeOnSelect = s.closeOnSelect; + this.displayClose = s.displayClose; + this.selectMultiple = s.selectMultiple; + this.verticalPosition = s.verticalPosition; + this.horizontalPosition = s.horizontalPosition; + this.hoverClass = s.hoverClass; + this.setOffset(s.verticalOffset, s.horizontalOffset); + this.inline = s.inline; + if (this.inline) { + this.context = this.ele; + this.display(); + } + }, + setStartDate : function(d) + { + if (d) { + this.startDate = Date.fromString(d); + } + if (!this.startDate) { + this.startDate = (new Date()).zeroTime(); + } + this.setDisplayedMonth(this.displayedMonth, this.displayedYear); + }, + setEndDate : function(d) + { + if (d) { + this.endDate = Date.fromString(d); + } + if (!this.endDate) { + this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy + } + if (this.endDate.getTime() < this.startDate.getTime()) { + this.endDate = this.startDate; + } + this.setDisplayedMonth(this.displayedMonth, this.displayedYear); + }, + setPosition : function(v, h) + { + this.verticalPosition = v; + this.horizontalPosition = h; + }, + setOffset : function(v, h) + { + this.verticalOffset = parseInt(v) || 0; + this.horizontalOffset = parseInt(h) || 0; + }, + setDisabled : function(s) + { + $e = $(this.ele); + $e[s ? 'addClass' : 'removeClass']('dp-disabled'); + if (this.button) { + $but = $(this.button); + $but[s ? 'addClass' : 'removeClass']('dp-disabled'); + $but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE); + } + if ($e.is(':text')) { + $e.attr('disabled', s ? 'disabled' : ''); + } + }, + setDisplayedMonth : function(m, y) + { + if (this.startDate == undefined || this.endDate == undefined) { + return; + } + var s = new Date(this.startDate.getTime()); + s.setDate(1); + var e = new Date(this.endDate.getTime()); + e.setDate(1); + + var t; + if ((!m && !y) || (isNaN(m) && isNaN(y))) { + // no month or year passed - default to current month + t = new Date().zeroTime(); + t.setDate(1); + } else if (isNaN(m)) { + // just year passed in - presume we want the displayedMonth + t = new Date(y, this.displayedMonth, 1); + } else if (isNaN(y)) { + // just month passed in - presume we want the displayedYear + t = new Date(this.displayedYear, m, 1); + } else { + // year and month passed in - that's the date we want! + t = new Date(y, m, 1) + } + + // check if the desired date is within the range of our defined startDate and endDate + if (t.getTime() < s.getTime()) { + t = s; + } else if (t.getTime() > e.getTime()) { + t = e; + } + this.displayedMonth = t.getMonth(); + this.displayedYear = t.getFullYear(); + }, + setSelected : function(d, v, moveToMonth) + { + if (this.selectMultiple == false) { + this.selectedDates = {}; + $('td.selected', this.context).removeClass('selected'); + } + if (moveToMonth) { + this.setDisplayedMonth(d.getMonth(), d.getFullYear()); + } + this.selectedDates[d.toString()] = v; + }, + isSelected : function(d) + { + return this.selectedDates[d.toString()]; + }, + getSelected : function() + { + var r = []; + for(s in this.selectedDates) { + if (this.selectedDates[s] == true) { + r.push(Date.parse(s)); + } + } + return r; + }, + display : function(eleAlignTo) + { + if ($(this.ele).is('.dp-disabled')) return; + + eleAlignTo = eleAlignTo || this.ele; + var c = this; + var $ele = $(eleAlignTo); + var eleOffset = $ele.offset(); + + var $createIn; + var attrs; + var attrsCalendarHolder; + var cssRules; + + if (c.inline) { + $createIn = $(this.ele); + attrs = { + 'id' : 'calendar-' + this.ele._dpId, + 'className' : 'dp-popup dp-popup-inline' + }; + cssRules = { + }; + } else { + $createIn = $('body'); + attrs = { + 'id' : 'dp-popup', + 'className' : 'dp-popup' + }; + cssRules = { + 'top' : eleOffset.top + c.verticalOffset, + 'left' : eleOffset.left + c.horizontalOffset + }; + + var _checkMouse = function(e) + { + var el = e.target; + var cal = $('#dp-popup')[0]; + + while (true){ + if (el == cal) { + return true; + } else if (el == document) { + c._closeCalendar(); + return false; + } else { + el = $(el).parent()[0]; + } + } + }; + this._checkMouse = _checkMouse; + + this._closeCalendar(true); + } + + + $createIn + .append( + $('<div></div>') + .attr(attrs) + .css(cssRules) + .append( + $('<h2></h2>'), + $('<div class="dp-nav-prev"></div>') + .append( + $('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '"><<</a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 0, -1); + } + ), + $('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '"><</a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, -1, 0); + } + ) + ), + $('<div class="dp-nav-next"></div>') + .append( + $('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '">>></a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 0, 1); + } + ), + $('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '">></a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 1, 0); + } + ) + ), + $('<div></div>') + .attr('className', 'dp-calendar') + ) + .bgIframe() + ); + + var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup'); + + if (this.showYearNavigation == false) { + $('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none'); + } + if (this.displayClose) { + $pop.append( + $('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>') + .bind( + 'click', + function() + { + c._closeCalendar(); + return false; + } + ) + ); + } + c._renderCalendar(); + + $(this.ele).trigger('dpDisplayed', $pop); + + if (!c.inline) { + if (this.verticalPosition == $.dpConst.POS_BOTTOM) { + $pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset); + } + if (this.horizontalPosition == $.dpConst.POS_RIGHT) { + $pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset); + } + $(document).bind('mousedown', this._checkMouse); + } + }, + setRenderCallback : function(a) + { + if (a && typeof(a) == 'function') { + a = [a]; + } + this.renderCallback = this.renderCallback.concat(a); + }, + cellRender : function ($td, thisDate, month, year) { + var c = this.dpController; + var d = new Date(thisDate.getTime()); + + // add our click handlers to deal with it when the days are clicked... + + $td.bind( + 'click', + function() + { + var $this = $(this); + if (!$this.is('.disabled')) { + c.setSelected(d, !$this.is('.selected') || !c.selectMultiple); + var s = c.isSelected(d); + $(c.ele).trigger('dateSelected', [d, $td, s]); + $(c.ele).trigger('change'); + if (c.closeOnSelect) { + c._closeCalendar(); + } else { + $this[s ? 'addClass' : 'removeClass']('selected'); + } + } + } + ); + + if (c.isSelected(d)) { + $td.addClass('selected'); + } + + // call any extra renderCallbacks that were passed in + for (var i=0; i<c.renderCallback.length; i++) { + c.renderCallback[i].apply(this, arguments); + } + + + }, + // ele is the clicked button - only proceed if it doesn't have the class disabled... + // m and y are -1, 0 or 1 depending which direction we want to go in... + _displayNewMonth : function(ele, m, y) + { + if (!$(ele).is('.disabled')) { + this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y); + this._clearCalendar(); + this._renderCalendar(); + $(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]); + } + ele.blur(); + return false; + }, + _renderCalendar : function() + { + // set the title... + $('h2', this.context).html(Date.monthNames[this.displayedMonth] + ' ' + this.displayedYear); + + // render the calendar... + $('.dp-calendar', this.context).renderCalendar( + { + month : this.displayedMonth, + year : this.displayedYear, + renderCallback : this.cellRender, + dpController : this, + hoverClass : this.hoverClass + } + ); + + // update the status of the control buttons and disable dates before startDate or after endDate... + // TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying? + if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) { + $('.dp-nav-prev-year', this.context).addClass('disabled'); + $('.dp-nav-prev-month', this.context).addClass('disabled'); + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > 20) { + $this.addClass('disabled'); + } + } + ); + var d = this.startDate.getDate(); + $('.dp-calendar td.current-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < d) { + $this.addClass('disabled'); + } + } + ); + } else { + $('.dp-nav-prev-year', this.context).removeClass('disabled'); + $('.dp-nav-prev-month', this.context).removeClass('disabled'); + var d = this.startDate.getDate(); + if (d > 20) { + // check if the startDate is last month as we might need to add some disabled classes... + var sd = new Date(this.startDate.getTime()); + sd.addMonths(1); + if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) { + $('dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < d) { + $this.addClass('disabled'); + } + } + ); + } + } + } + if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) { + $('.dp-nav-next-year', this.context).addClass('disabled'); + $('.dp-nav-next-month', this.context).addClass('disabled'); + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < 14) { + $this.addClass('disabled'); + } + } + ); + var d = this.endDate.getDate(); + $('.dp-calendar td.current-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > d) { + $this.addClass('disabled'); + } + } + ); + } else { + $('.dp-nav-next-year', this.context).removeClass('disabled'); + $('.dp-nav-next-month', this.context).removeClass('disabled'); + var d = this.endDate.getDate(); + if (d < 13) { + // check if the endDate is next month as we might need to add some disabled classes... + var ed = new Date(this.endDate.getTime()); + ed.addMonths(-1); + if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) { + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > d) { + $this.addClass('disabled'); + } + } + ); + } + } + } + }, + _closeCalendar : function(programatic, ele) + { + if (!ele || ele == this.ele) + { + $(document).unbind('mousedown', this._checkMouse); + this._clearCalendar(); + $('#dp-popup a').unbind(); + $('#dp-popup').empty().remove(); + if (!programatic) { + $(this.ele).trigger('dpClosed', [this.getSelected()]); + } + } + }, + // empties the current dp-calendar div and makes sure that all events are unbound + // and expandos removed to avoid memory leaks... + _clearCalendar : function() + { + // TODO. + $('.dp-calendar td', this.context).unbind(); + $('.dp-calendar', this.context).empty(); + } + } + ); + + // static constants + $.dpConst = { + SHOW_HEADER_NONE : 0, + SHOW_HEADER_SHORT : 1, + SHOW_HEADER_LONG : 2, + POS_TOP : 0, + POS_BOTTOM : 1, + POS_LEFT : 0, + POS_RIGHT : 1 + }; + // localisable text + $.dpText = { + TEXT_PREV_YEAR : 'Previous year', + TEXT_PREV_MONTH : 'Previous month', + TEXT_NEXT_YEAR : 'Next year', + TEXT_NEXT_MONTH : 'Next month', + TEXT_CLOSE : 'Close', + TEXT_CHOOSE_DATE : 'Choose date' + }; + // version + $.dpVersion = '$Id: jquery.datePicker.js,v 1.1 2008/07/21 22:54:09 bao Exp $'; + + function _getController(ele) + { + if (ele._dpId) return $.event._dpCache[ele._dpId]; + return false; + }; + + // make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional + // comments to only include bgIframe where it is needed in IE without breaking this plugin). + if ($.fn.bgIframe == undefined) { + $.fn.bgIframe = function() {return this; }; + }; + + + // clean-up + $(window) + .bind('unload', function() { + var els = $.event._dpCache || []; + for (var i in els) { + $(els[i].ele)._dpDestroy(); + } + }); + + +})(jQuery); diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.form.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.form.js new file mode 100644 index 0000000..7bf52f7 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.form.js @@ -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); diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.hoverIntent.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.hoverIntent.js new file mode 100644 index 0000000..ac67e4d --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.hoverIntent.js @@ -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); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.jqModal.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.jqModal.js new file mode 100644 index 0000000..4257d81 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.jqModal.js @@ -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); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.min.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.min.js new file mode 100644 index 0000000..ba1ab6d --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.min.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.5 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008/11/14 20:52:55 $ + * $Rev: 5651 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.5",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else +return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else +script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else +for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else +for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(notxml&&!special&&name in elem){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);if(msie&&special&¬xml)return elem.getAttribute(name,2);return elem.getAttribute(name);}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else +while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/js/jquery.timers.js b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.timers.js new file mode 100644 index 0000000..454be57 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/js/jquery.timers.js @@ -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); + } + }); + + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/langs/en.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/langs/en.js new file mode 100644 index 0000000..ef3e18a --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/langs/en.js @@ -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." +}}}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin.js new file mode 100644 index 0000000..f335004 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin.js @@ -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);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js new file mode 100644 index 0000000..3d2f8b3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 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); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/js/rule.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/js/rule.js new file mode 100644 index 0000000..a60c35f --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/js/rule.js @@ -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); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js new file mode 100644 index 0000000..eec74db --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.advhr_dlg',{ +width:"Width", +size:"Height", +noshade:"No shadow" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/rule.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/rule.htm new file mode 100644 index 0000000..c42b9e1 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advhr/rule.htm @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advhr.advhr_desc} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + +
+ + +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin.js new file mode 100644 index 0000000..3af5057 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AdvancedImagePlugin',{init:function(ed,url){ed.addCommand('mceAdvImage',function(){if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({file:url+'/image.htm',width:480+parseInt(ed.getLang('advimage.delta_width',0)),height:385+parseInt(ed.getLang('advimage.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('image',{title:'advimage.image_desc',cmd:'mceAdvImage'});},getInfo:function(){return{longname:'Advanced image',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advimage',tinymce.plugins.AdvancedImagePlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js new file mode 100644 index 0000000..b5c9dd4 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js @@ -0,0 +1,47 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedImagePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvImage', function() { + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + file : url + '/image.htm', + width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)), + height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('image', { + title : 'advimage.image_desc', + cmd : 'mceAdvImage' + }); + }, + + getInfo : function() { + return { + longname : 'Advanced image', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/image.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/image.htm new file mode 100644 index 0000000..3cd7647 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/image.htm @@ -0,0 +1,238 @@ + + + + {#advimage_dlg.dialog_title} + + + + + + + + + + +
+ + +
+
+
+ {#advimage_dlg.general} + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+ +
+ {#advimage_dlg.preview} + +
+
+ +
+
+ {#advimage_dlg.tab_appearance} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ {#advimage_dlg.example_img} + Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam + nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum + edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam + erat volutpat. +
+
+ x + px +
  + + + + +
+
+
+
+ +
+
+ {#advimage_dlg.swap_image} + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+ + + + +
 
+
+ +
+ {#advimage_dlg.misc} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
 
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/img/sample.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/img/sample.gif new file mode 100644 index 0000000..53bf689 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/img/sample.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/js/image.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/js/image.js new file mode 100644 index 0000000..1d19ce8 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/js/image.js @@ -0,0 +1,441 @@ +var ImageDialog = { + preInit : function() { + var url; + + tinyMCEPopup.requireLangPack(); + + if (url = tinyMCEPopup.getParam("external_image_list_url")) + document.write(''); + }, + + init : function(ed) { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); + + tinyMCEPopup.resizeToInnerSize(); + this.fillClassList('class_list'); + this.fillFileList('src_list', 'tinyMCEImageList'); + this.fillFileList('over_list', 'tinyMCEImageList'); + this.fillFileList('out_list', 'tinyMCEImageList'); + TinyMCE_EditableSelects.init(); + + if (n.nodeName == 'IMG') { + nl.src.value = dom.getAttrib(n, 'src'); + nl.width.value = dom.getAttrib(n, 'width'); + nl.height.value = dom.getAttrib(n, 'height'); + nl.alt.value = dom.getAttrib(n, 'alt'); + nl.title.value = dom.getAttrib(n, 'title'); + nl.vspace.value = this.getAttrib(n, 'vspace'); + nl.hspace.value = this.getAttrib(n, 'hspace'); + nl.border.value = this.getAttrib(n, 'border'); + selectByValue(f, 'align', this.getAttrib(n, 'align')); + selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true); + nl.style.value = dom.getAttrib(n, 'style'); + nl.id.value = dom.getAttrib(n, 'id'); + nl.dir.value = dom.getAttrib(n, 'dir'); + nl.lang.value = dom.getAttrib(n, 'lang'); + nl.usemap.value = dom.getAttrib(n, 'usemap'); + nl.longdesc.value = dom.getAttrib(n, 'longdesc'); + nl.insert.value = ed.getLang('update'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) + nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout'))) + nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (ed.settings.inline_styles) { + // Move attribs to styles + if (dom.getAttrib(n, 'align')) + this.updateStyle('align'); + + if (dom.getAttrib(n, 'hspace')) + this.updateStyle('hspace'); + + if (dom.getAttrib(n, 'border')) + this.updateStyle('border'); + + if (dom.getAttrib(n, 'vspace')) + this.updateStyle('vspace'); + } + } + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image'); + if (isVisible('overbrowser')) + document.getElementById('onmouseoversrc').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image'); + if (isVisible('outbrowser')) + document.getElementById('onmouseoutsrc').style.width = '260px'; + + // If option enabled default contrain proportions to checked + if (ed.getParam("advimage_constrain_proportions", true)) + f.constrain.checked = true; + + // Check swap image if valid data + if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value) + this.setSwapImage(true); + else + this.setSwapImage(false); + + this.changeAppearance(); + this.showPreviewImage(nl.src.value, 1); + }, + + insert : function(file, title) { + var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { + if (!f.alt.value) { + tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + if (s) + t.insertAndClose(); + }); + + return; + } + } + + t.insertAndClose(); + }, + + insertAndClose : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + // Fixes crash in Safari + if (tinymce.isWebKit) + ed.getWin().focus(); + + if (!ed.settings.inline_styles) { + args = { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }; + } else { + // Remove deprecated values + args = { + vspace : '', + hspace : '', + border : '', + align : '' + }; + } + + tinymce.extend(args, { + src : nl.src.value, + width : nl.width.value, + height : nl.height.value, + alt : nl.alt.value, + title : nl.title.value, + 'class' : getSelectValue(f, 'class_list'), + style : nl.style.value, + id : nl.id.value, + dir : nl.dir.value, + lang : nl.lang.value, + usemap : nl.usemap.value, + longdesc : nl.longdesc.value + }); + + args.onmouseover = args.onmouseout = ''; + + if (f.onmousemovecheck.checked) { + if (nl.onmouseoversrc.value) + args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';"; + + if (nl.onmouseoutsrc.value) + args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';"; + } + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + setSwapImage : function(st) { + var f = document.forms[0]; + + f.onmousemovecheck.checked = st; + setBrowserDisabled('overbrowser', !st); + setBrowserDisabled('outbrowser', !st); + + if (f.over_list) + f.over_list.disabled = !st; + + if (f.out_list) + f.out_list.disabled = !st; + + f.onmouseoversrc.disabled = !st; + f.onmouseoutsrc.disabled = !st; + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.elements.width.value = f.elements.height.value = ''; + }, + + updateImageData : function(img, st) { + var f = document.forms[0]; + + if (!st) { + f.elements.width.value = img.width; + f.elements.height.value = img.height; + } + + this.preloadImg = img; + }, + + changeAppearance : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg'); + + if (img) { + if (ed.getParam('inline_styles')) { + ed.dom.setAttrib(img, 'style', f.style.value); + } else { + img.align = f.align.value; + img.border = f.border.value; + img.hspace = f.hspace.value; + img.vspace = f.vspace.value; + } + } + }, + + changeHeight : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; + f.height.value = tp.toFixed(0); + }, + + changeWidth : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; + f.width.value = tp.toFixed(0); + }, + + updateStyle : function(ty) { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); + + if (tinyMCEPopup.editor.settings.inline_styles) { + // Handle align + if (ty == 'align') { + dom.setStyle(img, 'float', ''); + dom.setStyle(img, 'vertical-align', ''); + + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') + dom.setStyle(img, 'float', v); + else + img.style.verticalAlign = v; + } + } + + // Handle border + if (ty == 'border') { + dom.setStyle(img, 'border', ''); + + v = f.border.value; + if (v || v == '0') { + if (v == '0') + img.style.border = '0'; + else + img.style.border = v + 'px solid black'; + } + } + + // Handle hspace + if (ty == 'hspace') { + dom.setStyle(img, 'marginLeft', ''); + dom.setStyle(img, 'marginRight', ''); + + v = f.hspace.value; + if (v) { + img.style.marginLeft = v + 'px'; + img.style.marginRight = v + 'px'; + } + } + + // Handle vspace + if (ty == 'vspace') { + dom.setStyle(img, 'marginTop', ''); + dom.setStyle(img, 'marginBottom', ''); + + v = f.vspace.value; + if (v) { + img.style.marginTop = v + 'px'; + img.style.marginBottom = v + 'px'; + } + } + + // Merge + dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText)); + } + }, + + changeMouseMove : function() { + }, + + showPreviewImage : function(u, st) { + if (!u) { + tinyMCEPopup.dom.setHTML('prev', ''); + return; + } + + if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true)) + this.resetImageData(); + + u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u); + + if (!st) + tinyMCEPopup.dom.setHTML('prev', ''); + else + tinyMCEPopup.dom.setHTML('prev', ''); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js new file mode 100644 index 0000000..ef81f78 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js @@ -0,0 +1,43 @@ +tinyMCE.addI18n('en.advimage_dlg',{ +tab_general:"General", +tab_appearance:"Appearance", +tab_advanced:"Advanced", +general:"General", +title:"Title", +preview:"Preview", +constrain_proportions:"Constrain proportions", +langdir:"Language direction", +langcode:"Language code", +long_desc:"Long description link", +style:"Style", +classes:"Classes", +ltr:"Left to right", +rtl:"Right to left", +id:"Id", +map:"Image map", +swap_image:"Swap image", +alt_image:"Alternative image", +mouseover:"for mouse over", +mouseout:"for mouse out", +misc:"Miscellaneous", +example_img:"Appearance preview image", +missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", +dialog_title:"Insert/edit image", +src:"Image URL", +alt:"Image description", +list:"Image list", +border:"Border", +dimensions:"Dimensions", +vspace:"Vertical space", +hspace:"Horizontal space", +align:"Alignment", +align_baseline:"Baseline", +align_top:"Top", +align_middle:"Middle", +align_bottom:"Bottom", +align_texttop:"Text top", +align_textbottom:"Text bottom", +align_left:"Left", +align_right:"Right", +image_list:"Image list" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin.js new file mode 100644 index 0000000..4899f7b --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AdvancedLinkPlugin',{init:function(ed,url){this.editor=ed;ed.addCommand('mceAdvLink',function(){var se=ed.selection;if(se.isCollapsed()&&!ed.dom.getParent(se.getNode(),'A'))return;ed.windowManager.open({file:url+'/link.htm',width:480+parseInt(ed.getLang('advlink.delta_width',0)),height:400+parseInt(ed.getLang('advlink.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('link',{title:'advlink.link_desc',cmd:'mceAdvLink'});ed.addShortcut('ctrl+k','advlink.advlink_desc','mceAdvLink');ed.onNodeChange.add(function(ed,cm,n,co){cm.setDisabled('link',co&&n.nodeName!='A');cm.setActive('link',n.nodeName=='A'&&!n.name);});},getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advlink',tinymce.plugins.AdvancedLinkPlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js new file mode 100644 index 0000000..2d7f0ee --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js @@ -0,0 +1,58 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { + init : function(ed, url) { + this.editor = ed; + + // Register commands + ed.addCommand('mceAdvLink', function() { + var se = ed.selection; + + // No selection and not in link + if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) + return; + + ed.windowManager.open({ + file : url + '/link.htm', + width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), + height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('link', { + title : 'advlink.link_desc', + cmd : 'mceAdvLink' + }); + + ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); + + ed.onNodeChange.add(function(ed, cm, n, co) { + cm.setDisabled('link', co && n.nodeName != 'A'); + cm.setActive('link', n.nodeName == 'A' && !n.name); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced link', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/js/advlink.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/js/advlink.js new file mode 100644 index 0000000..6ca8fc6 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/js/advlink.js @@ -0,0 +1,528 @@ +/* Functions for the advlink plugin popup */ + +tinyMCEPopup.requireLangPack(); + +var templates = { + "window.open" : "window.open('${url}','${target}','${options}')" +}; + +function preinit() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); +} + +function changeClass() { + var f = document.forms[0]; + + f.classes.value = getSelectValue(f, 'classlist'); +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + var formObj = document.forms[0]; + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + var action = "insert"; + var html; + + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); + document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); + document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); + document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); + document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); + + // Link list + html = getLinkListHTML('linklisthref','href'); + if (html == "") + document.getElementById("linklisthrefrow").style.display = 'none'; + else + document.getElementById("linklisthrefcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '260px'; + + if (isVisible('popupurlbrowser')) + document.getElementById('popupurl').style.width = '180px'; + + elm = inst.dom.getParent(elm, "A"); + if (elm != null && elm.nodeName == "A") + action = "update"; + + formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); + + setPopupControlsDisabled(true); + + if (action == "update") { + var href = inst.dom.getAttrib(elm, 'href'); + var onclick = inst.dom.getAttrib(elm, 'onclick'); + + // Setup form data + setFormValue('href', href); + setFormValue('title', inst.dom.getAttrib(elm, 'title')); + setFormValue('id', inst.dom.getAttrib(elm, 'id')); + setFormValue('style', inst.dom.getAttrib(elm, "style")); + setFormValue('rel', inst.dom.getAttrib(elm, 'rel')); + setFormValue('rev', inst.dom.getAttrib(elm, 'rev')); + setFormValue('charset', inst.dom.getAttrib(elm, 'charset')); + setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang')); + setFormValue('dir', inst.dom.getAttrib(elm, 'dir')); + setFormValue('lang', inst.dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('type', inst.dom.getAttrib(elm, 'type')); + setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); + setFormValue('target', inst.dom.getAttrib(elm, 'target')); + setFormValue('classes', inst.dom.getAttrib(elm, 'class')); + + // Parse onclick data + if (onclick != null && onclick.indexOf('window.open') != -1) + parseWindowOpen(onclick); + else + parseFunction(onclick); + + // Select by the values + selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir')); + selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel')); + selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev')); + selectByValue(formObj, 'linklisthref', href); + + if (href.charAt(0) == '#') + selectByValue(formObj, 'anchorlist', href); + + addClassesToList('classlist', 'advlink_styles'); + + selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); + selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); + } else + addClassesToList('classlist', 'advlink_styles'); +} + +function checkPrefix(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external'))) + n.value = 'http://' + n.value; +} + +function setFormValue(name, value) { + document.forms[0].elements[name].value = value; +} + +function parseWindowOpen(onclick) { + var formObj = document.forms[0]; + + // Preprocess center code + if (onclick.indexOf('return false;') != -1) { + formObj.popupreturn.checked = true; + onclick = onclick.replace('return false;', ''); + } else + formObj.popupreturn.checked = false; + + var onClickData = parseLink(onclick); + + if (onClickData != null) { + formObj.ispopup.checked = true; + setPopupControlsDisabled(false); + + var onClickWindowOptions = parseOptions(onClickData['options']); + var url = onClickData['url']; + + formObj.popupname.value = onClickData['target']; + formObj.popupurl.value = url; + formObj.popupwidth.value = getOption(onClickWindowOptions, 'width'); + formObj.popupheight.value = getOption(onClickWindowOptions, 'height'); + + formObj.popupleft.value = getOption(onClickWindowOptions, 'left'); + formObj.popuptop.value = getOption(onClickWindowOptions, 'top'); + + if (formObj.popupleft.value.indexOf('screen') != -1) + formObj.popupleft.value = "c"; + + if (formObj.popuptop.value.indexOf('screen') != -1) + formObj.popuptop.value = "c"; + + formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes"; + formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes"; + formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes"; + formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes"; + formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes"; + formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes"; + formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes"; + + buildOnClick(); + } +} + +function parseFunction(onclick) { + var formObj = document.forms[0]; + var onClickData = parseLink(onclick); + + // TODO: Add stuff here +} + +function getOption(opts, name) { + return typeof(opts[name]) == "undefined" ? "" : opts[name]; +} + +function setPopupControlsDisabled(state) { + var formObj = document.forms[0]; + + formObj.popupname.disabled = state; + formObj.popupurl.disabled = state; + formObj.popupwidth.disabled = state; + formObj.popupheight.disabled = state; + formObj.popupleft.disabled = state; + formObj.popuptop.disabled = state; + formObj.popuplocation.disabled = state; + formObj.popupscrollbars.disabled = state; + formObj.popupmenubar.disabled = state; + formObj.popupresizable.disabled = state; + formObj.popuptoolbar.disabled = state; + formObj.popupstatus.disabled = state; + formObj.popupreturn.disabled = state; + formObj.popupdependent.disabled = state; + + setBrowserDisabled('popupurlbrowser', state); +} + +function parseLink(link) { + link = link.replace(new RegExp(''', 'g'), "'"); + + var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1"); + + // Is function name a template function + var template = templates[fnName]; + if (template) { + // Build regexp + var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi")); + var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\("; + var replaceStr = ""; + for (var i=0; i'); + for (var i=0; i'; + html += ''; + + for (i=0; i' + name + ''; + } + + html += ''; + + return html; +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm, elementArray, i; + + elm = inst.selection.getNode(); + checkPrefix(document.forms[0].href); + + elm = inst.dom.getParent(elm, "A"); + + // Remove element if there is no href + if (!document.forms[0].href.value) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + i = inst.selection.getBookmark(); + inst.dom.remove(elm, 1); + inst.selection.moveToBookmark(i); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (elm == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); + for (i=0; i' + tinyMCELinkList[i][0] + ''; + + html += ''; + + return html; + + // tinyMCE.debug('-- image list start --', html, '-- image list end --'); +} + +function getTargetListHTML(elm_id, target_form_element) { + var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); + var html = ''; + + html += ''; + + return html; +} + +// While loading +preinit(); +tinyMCEPopup.onInit.add(init); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js new file mode 100644 index 0000000..8ef9c79 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js @@ -0,0 +1,52 @@ +tinyMCE.addI18n('en.advlink_dlg',{ +title:"Insert/edit link", +url:"Link URL", +target:"Target", +titlefield:"Title", +is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +list:"Link list", +general_tab:"General", +popup_tab:"Popup", +events_tab:"Events", +advanced_tab:"Advanced", +general_props:"General properties", +popup_props:"Popup properties", +event_props:"Events", +advanced_props:"Advanced properties", +popup_opts:"Options", +anchor_names:"Anchors", +target_same:"Open in this window / frame", +target_parent:"Open in parent window / frame", +target_top:"Open in top frame (replaces all frames)", +target_blank:"Open in new window", +popup:"Javascript popup", +popup_url:"Popup URL", +popup_name:"Window name", +popup_return:"Insert 'return false'", +popup_scrollbars:"Show scrollbars", +popup_statusbar:"Show status bar", +popup_toolbar:"Show toolbars", +popup_menubar:"Show menu bar", +popup_location:"Show location bar", +popup_resizable:"Make window resizable", +popup_dependent:"Dependent (Mozilla/Firefox only)", +popup_size:"Size", +popup_position:"Position (X/Y)", +id:"Id", +style:"Style", +classes:"Classes", +target_name:"Target name", +langdir:"Language direction", +target_langcode:"Target language", +langcode:"Language code", +encoding:"Target character encoding", +mime:"Target MIME type", +rel:"Relationship page to target", +rev:"Relationship target to page", +tabindex:"Tabindex", +accesskey:"Accesskey", +ltr:"Left to right", +rtl:"Right to left", +link_list:"Link list" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/link.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/link.htm new file mode 100644 index 0000000..bb8e654 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/advlink/link.htm @@ -0,0 +1,339 @@ + + + + {#advlink_dlg.title} + + + + + + + + + +
+ + +
+
+
+ {#advlink_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
 
 
 
+ +
+
+
+ + + +
+
+ {#advlink_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+ +
+
+ {#advlink_dlg.event_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin.js new file mode 100644 index 0000000..31423da --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});ed.addButton('fullpage',{title:'fullpage.desc',cmd:'mceFullPageProperties'});ed.onBeforeSetContent.add(t._setContent,t);ed.onSetContent.add(t._setBodyAttribs,t);ed.onGetContent.add(t._getContent,t);},getInfo:function(){return{longname:'Fullpage',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js new file mode 100644 index 0000000..985eb1a --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js @@ -0,0 +1,140 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:26 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.FullPagePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceFullPageProperties', function() { + ed.windowManager.open({ + file : url + '/fullpage.htm', + width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)), + height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + head_html : t.head + }); + }); + + // Register buttons + ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'}); + + ed.onBeforeSetContent.add(t._setContent, t); + ed.onSetContent.add(t._setBodyAttribs, t); + ed.onGetContent.add(t._getContent, t); + }, + + getInfo : function() { + return { + longname : 'Fullpage', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + _setBodyAttribs : function(ed, o) { + var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i); + + if (attr && attr[1]) { + bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); + + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; + + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); + + if (t) + v = t[1]; + } else + v = k; + + ed.dom.setAttrib(ed.getBody(), 'style', v); + } + } + }, + + _createSerializer : function() { + return new tinymce.dom.Serializer({ + dom : this.editor.dom, + apply_source_formatting : true + }); + }, + + _setContent : function(ed, o) { + var t = this, sp, ep, c = o.content, v, st = ''; + + // Parse out head, body and footer + c = c.replace(/<(\/?)BODY/gi, '<$1body'); + sp = c.indexOf('', sp); + t.head = c.substring(0, sp + 1); + + ep = c.indexOf('\n'; + + t.head += ed.getParam('fullpage_default_doctype', ''); + t.head += '\n\n\n' + ed.getParam('fullpage_default_title', 'Untitled document') + '\n'; + + if (v = ed.getParam('fullpage_default_encoding')) + t.head += '\n'; + + if (v = ed.getParam('fullpage_default_font_family')) + st += 'font-family: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_font_size')) + st += 'font-size: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_text_color')) + st += 'color: ' + v + ';'; + + t.head += '\n\n'; + t.foot = '\n\n'; + } + }, + + _getContent : function(ed, o) { + var t = this; + + o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot); + } + }); + + // Register plugin + tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/fullpage.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/fullpage.htm new file mode 100644 index 0000000..eabc823 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/fullpage.htm @@ -0,0 +1,577 @@ + + + + {#fullpage_dlg.title} + + + + + + + + +
+ + +
+
+
+ {#fullpage_dlg.meta_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
 
 
 
 
  + +
+
+ +
+ {#fullpage_dlg.langprops} + + + + + + + + + + + + + + + + + + + + + + +
+ +
  + +
 
+ +
 
+
+
+ +
+
+ {#fullpage_dlg.appearance_textprops} + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+
+ +
+ {#fullpage_dlg.appearance_bgprops} + + + + + + + + + + +
+ + + + + +
 
+
+ + + + + +
 
+
+
+ +
+ {#fullpage_dlg.appearance_marginprops} + + + + + + + + + + + + + + +
+
+ +
+ {#fullpage_dlg.appearance_linkprops} + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
 
+
+ + + + + +
 
+
  
+
+ +
+ {#fullpage_dlg.appearance_style} + + + + + + + + + + +
+ + + + +
 
+
+
+ +
+ + +
+ {#fullpage_dlg.head_elements} + +
+
+
+ + +
+
+ + +
+
+
+ +
+
+ +
+ {#fullpage_dlg.meta_element} + + + + + + + + + + + + + + +
+ + +
+ +
+ {#fullpage_dlg.title_element} + + + + + + +
+ + +
+ +
+ {#fullpage_dlg.script_element} + + + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+ +
+ +
+
+ + +
+ +
+ {#fullpage_dlg.style_element} + + + +
+ +
+
+ + + + + + + + + +
+
+ +
+ +
+
+ + +
+ +
+ {#fullpage_dlg.base_element} + + + + + + + + + + +
+ + +
+ + + +
+ {#fullpage_dlg.comment_element} + + + + +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/js/fullpage.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/js/fullpage.js new file mode 100644 index 0000000..d87af1e --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/fullpage/js/fullpage.js @@ -0,0 +1,462 @@ +tinyMCEPopup.requireLangPack(); + +var doc; + +var defaultDocTypes = + 'XHTML 1.0 Transitional=,' + + 'XHTML 1.0 Frameset=,' + + 'XHTML 1.0 Strict=,' + + 'XHTML 1.1=,' + + 'HTML 4.01 Transitional=,' + + 'HTML 4.01 Strict=,' + + 'HTML 4.01 Frameset='; + +var defaultEncodings = + 'Western european (iso-8859-1)=iso-8859-1,' + + 'Central European (iso-8859-2)=iso-8859-2,' + + 'Unicode (UTF-8)=utf-8,' + + 'Chinese traditional (Big5)=big5,' + + 'Cyrillic (iso-8859-5)=iso-8859-5,' + + 'Japanese (iso-2022-jp)=iso-2022-jp,' + + 'Greek (iso-8859-7)=iso-8859-7,' + + 'Korean (iso-2022-kr)=iso-2022-kr,' + + 'ASCII (us-ascii)=us-ascii'; + +var defaultMediaTypes = + 'all=all,' + + 'screen=screen,' + + 'print=print,' + + 'tty=tty,' + + 'tv=tv,' + + 'projection=projection,' + + 'handheld=handheld,' + + 'braille=braille,' + + 'aural=aural'; + +var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings'; +var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px'; + +function init() { + var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style; + + // Setup doctype select box + doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(','); + for (i=0; i 1) + addSelectValue(f, 'doctypes', p[0], p[1]); + } + + // Setup fonts select box + fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';'); + for (i=0; i 1) + addSelectValue(f, 'fontface', p[0], p[1]); + } + + // Setup fontsize select box + fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(','); + for (i=0; i 1) { + addSelectValue(f, 'element_style_media', p[0], p[1]); + addSelectValue(f, 'element_link_media', p[0], p[1]); + } + } + + // Setup encodings select box + encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(','); + for (i=0; i 1) { + addSelectValue(f, 'docencoding', p[0], p[1]); + addSelectValue(f, 'element_script_charset', p[0], p[1]); + addSelectValue(f, 'element_link_charset', p[0], p[1]); + } + } + + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color'); + //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color'); + document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color'); + document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color'); + document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor'); + document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage'); + document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage'); + document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage'); + document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage'); + + // Resize some elements + if (isVisible('stylesheetbrowser')) + document.getElementById('stylesheet').style.width = '220px'; + + if (isVisible('link_href_browser')) + document.getElementById('element_link_href').style.width = '230px'; + + if (isVisible('bgimage_browser')) + document.getElementById('bgimage').style.width = '210px'; + + // Add iframe + dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}}); + doc = dom.get('documentIframe').contentWindow.document; + h = tinyMCEPopup.getWindowArg('head_html'); + + // Preprocess the HTML disable scripts and urls + h = h.replace(/';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/editor_plugin_src.js new file mode 100644 index 0000000..c48dd8d --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/editor_plugin_src.js @@ -0,0 +1,365 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:27 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.MediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + function isMediaElm(n) { + return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); + }; + + ed.onPreInit.add(function() { + // Force in _value parameter this extra parameter is required for older Opera versions + ed.serializer.addRules('param[name|value|_value]'); + }); + + // Register commands + ed.addCommand('mceMedia', function() { + ed.windowManager.open({ + file : url + '/media.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); + }); + + ed.onInit.add(function() { + var lo = { + mceItemFlash : 'flash', + mceItemShockWave : 'shockwave', + mceItemWindowsMedia : 'windowsmedia', + mceItemQuickTime : 'quicktime', + mceItemRealMedia : 'realmedia' + }; + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.name == 'img') { + each(lo, function(v, k) { + if (ed.dom.hasClass(o.node, k)) { + o.name = v; + o.title = ed.dom.getAttrib(o.node, 'title'); + return false; + } + }); + } + }); + } + + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { + m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); + } + }); + } + }); + + ed.onBeforeSetContent.add(function(ed, o) { + var h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '' + }); + + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)\/>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/(object|embed)([^>]*)>/gi, ''); + h = h.replace(/]*)>/gi, function(a, b) {return ''}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); + + o.content = h; + }); + + ed.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + t._spansToImgs(o.node); + + each(dom.select('IMG', o.node), function(n) { + var p; + + if (isMediaElm(n)) { + p = t._parse(n.title); + dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); + dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); + } + }); + } + + if (o.get) { + each(dom.select('IMG', o.node), function(n) { + var ci, cb, mt; + + if (ed.getParam('media_use_script')) { + if (isMediaElm(n)) + n.className = n.className.replace(/mceItem/g, 'mceTemp'); + + return; + } + + switch (n.className) { + case 'mceItemFlash': + ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'application/x-shockwave-flash'; + break; + + case 'mceItemShockWave': + ci = '166b1bca-3f9c-11cf-8075-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + mt = 'application/x-director'; + break; + + case 'mceItemWindowsMedia': + ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; + cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + mt = 'application/x-mplayer2'; + break; + + case 'mceItemQuickTime': + ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; + cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + mt = 'video/quicktime'; + break; + + case 'mceItemRealMedia': + ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (ci) { + dom.replace(t._buildObj({ + classid : ci, + codebase : cb, + type : mt + }, n), n); + } + }); + } + }); + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/_value=/g, 'value='); + }); + + if (ed.getParam('media_use_script')) { + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + + return n ? ed.dom.decode(n[1]) : ''; + }; + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/]+>/g, function(im) { + var cl = getAttr(im, 'class'); + + if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { + at = t._parse(getAttr(im, 'title')); + at.width = getAttr(im, 'width'); + at.height = getAttr(im, 'height'); + im = ''; + } + + return im; + }); + }); + } + }, + + getInfo : function() { + return { + longname : 'Media', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _buildObj : function(o, n) { + var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); + + p.width = o.width = dom.getAttrib(n, 'width') || 100; + p.height = o.height = dom.getAttrib(n, 'height') || 100; + + ob = dom.create('span', { + mce_name : 'object', + classid : "clsid:" + o.classid, + codebase : o.codebase, + width : o.width, + height : o.height + }); + + if (p.src) + p.src = ed.convertURL(p.src, 'src', n); + + each (p, function(v, k) { + if (!/^(width|height|codebase|classid)$/.test(k)) { + // Use url instead of src in IE for Windows media + if (o.type == 'application/x-mplayer2' && k == 'src') + k = 'url'; + + dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); + } + }); + + dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p)); + + return ob; + }, + + _spansToImgs : function(p) { + var t = this, dom = t.editor.dom, im, ci; + + each(dom.select('span', p), function(n) { + // Convert object into image + if (dom.getAttrib(n, 'class') == 'mceItemObject') { + ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); + + switch (ci) { + case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': + case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': + case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + + return; + } + + // Convert embed into image + if (dom.getAttrib(n, 'class') == 'mceItemEmbed') { + switch (dom.getAttrib(n, 'type')) { + case 'application/x-shockwave-flash': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'application/x-director': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'application/x-mplayer2': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'video/quicktime': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'audio/x-pn-realaudio-plugin': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + } + }); + }, + + _createImg : function(cl, n) { + var im, dom = this.editor.dom, pa = {}, ti = ''; + + // Create image + im = dom.create('img', { + src : this.url + '/img/trans.gif', + width : dom.getAttrib(n, 'width') || 100, + height : dom.getAttrib(n, 'height') || 100, + 'class' : cl + }); + + // Setup base parameters + each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) { + var v = dom.getAttrib(n, na); + + if (v) + pa[na] = v; + }); + + // Add optional parameters + each(dom.select('span', n), function(n) { + if (dom.hasClass(n, 'mceItemParam')) + pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value'); + }); + + // Use src not movie + if (pa.movie) { + pa.src = pa.movie; + delete pa.movie; + } + + delete pa.width; + delete pa.height; + + im.title = this._serialize(pa); + + return im; + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + _serialize : function(o) { + return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); + } + }); + + // Register plugin + tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flash.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flash.gif new file mode 100644 index 0000000..cb192e6 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flash.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flv_player.swf b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flv_player.swf new file mode 100644 index 0000000..042c2ab Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/flv_player.swf differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/quicktime.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/quicktime.gif new file mode 100644 index 0000000..3b04991 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/quicktime.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/realmedia.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/realmedia.gif new file mode 100644 index 0000000..fdfe0b9 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/realmedia.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/shockwave.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/shockwave.gif new file mode 100644 index 0000000..5f235df Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/shockwave.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/trans.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/trans.gif new file mode 100644 index 0000000..3884865 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/trans.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/windowsmedia.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/windowsmedia.gif new file mode 100644 index 0000000..ab50f2d Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/img/windowsmedia.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/js/embed.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/js/embed.js new file mode 100644 index 0000000..6fe25de --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/media/js/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += ''; + + h += ''); + +function init() { + var pl = "", f, val; + var type = "flash", fe, i; + + ed = tinyMCEPopup.editor; + + tinyMCEPopup.resizeToInnerSize(); + f = document.forms[0] + + fe = ed.selection.getNode(); + if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + pl = fe.title; + + switch (ed.dom.getAttrib(fe, 'class')) { + case 'mceItemFlash': + type = 'flash'; + break; + + case 'mceItemFlashVideo': + type = 'flv'; + break; + + case 'mceItemShockWave': + type = 'shockwave'; + break; + + case 'mceItemWindowsMedia': + type = 'wmp'; + break; + + case 'mceItemQuickTime': + type = 'qt'; + break; + + case 'mceItemRealMedia': + type = 'rmp'; + break; + } + + document.forms[0].insert.value = ed.getLang('update', 'Insert', true); + } + + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var html = getMediaListHTML('medialist','src','media','media'); + if (html == "") + document.getElementById("linklistrow").style.display = 'none'; + else + document.getElementById("linklistcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('filebrowser')) + document.getElementById('src').style.width = '230px'; + + // Setup form + if (pl != "") { + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + switch (type) { + case "flash": + setBool(pl, 'flash', 'play'); + setBool(pl, 'flash', 'loop'); + setBool(pl, 'flash', 'menu'); + setBool(pl, 'flash', 'swliveconnect'); + setStr(pl, 'flash', 'quality'); + setStr(pl, 'flash', 'scale'); + setStr(pl, 'flash', 'salign'); + setStr(pl, 'flash', 'wmode'); + setStr(pl, 'flash', 'base'); + setStr(pl, 'flash', 'flashvars'); + break; + + case "qt": + setBool(pl, 'qt', 'loop'); + setBool(pl, 'qt', 'autoplay'); + setBool(pl, 'qt', 'cache'); + setBool(pl, 'qt', 'controller'); + setBool(pl, 'qt', 'correction'); + setBool(pl, 'qt', 'enablejavascript'); + setBool(pl, 'qt', 'kioskmode'); + setBool(pl, 'qt', 'autohref'); + setBool(pl, 'qt', 'playeveryframe'); + setBool(pl, 'qt', 'tarsetcache'); + setStr(pl, 'qt', 'scale'); + setStr(pl, 'qt', 'starttime'); + setStr(pl, 'qt', 'endtime'); + setStr(pl, 'qt', 'tarset'); + setStr(pl, 'qt', 'qtsrcchokespeed'); + setStr(pl, 'qt', 'volume'); + setStr(pl, 'qt', 'qtsrc'); + break; + + case "shockwave": + setBool(pl, 'shockwave', 'sound'); + setBool(pl, 'shockwave', 'progress'); + setBool(pl, 'shockwave', 'autostart'); + setBool(pl, 'shockwave', 'swliveconnect'); + setStr(pl, 'shockwave', 'swvolume'); + setStr(pl, 'shockwave', 'swstretchstyle'); + setStr(pl, 'shockwave', 'swstretchhalign'); + setStr(pl, 'shockwave', 'swstretchvalign'); + break; + + case "wmp": + setBool(pl, 'wmp', 'autostart'); + setBool(pl, 'wmp', 'enabled'); + setBool(pl, 'wmp', 'enablecontextmenu'); + setBool(pl, 'wmp', 'fullscreen'); + setBool(pl, 'wmp', 'invokeurls'); + setBool(pl, 'wmp', 'mute'); + setBool(pl, 'wmp', 'stretchtofit'); + setBool(pl, 'wmp', 'windowlessvideo'); + setStr(pl, 'wmp', 'balance'); + setStr(pl, 'wmp', 'baseurl'); + setStr(pl, 'wmp', 'captioningid'); + setStr(pl, 'wmp', 'currentmarker'); + setStr(pl, 'wmp', 'currentposition'); + setStr(pl, 'wmp', 'defaultframe'); + setStr(pl, 'wmp', 'playcount'); + setStr(pl, 'wmp', 'rate'); + setStr(pl, 'wmp', 'uimode'); + setStr(pl, 'wmp', 'volume'); + break; + + case "rmp": + setBool(pl, 'rmp', 'autostart'); + setBool(pl, 'rmp', 'loop'); + setBool(pl, 'rmp', 'autogotourl'); + setBool(pl, 'rmp', 'center'); + setBool(pl, 'rmp', 'imagestatus'); + setBool(pl, 'rmp', 'maintainaspect'); + setBool(pl, 'rmp', 'nojava'); + setBool(pl, 'rmp', 'prefetch'); + setBool(pl, 'rmp', 'shuffle'); + setStr(pl, 'rmp', 'console'); + setStr(pl, 'rmp', 'controls'); + setStr(pl, 'rmp', 'numloop'); + setStr(pl, 'rmp', 'scriptcallbacks'); + break; + } + + setStr(pl, null, 'src'); + setStr(pl, null, 'id'); + setStr(pl, null, 'name'); + setStr(pl, null, 'vspace'); + setStr(pl, null, 'hspace'); + setStr(pl, null, 'bgcolor'); + setStr(pl, null, 'align'); + setStr(pl, null, 'width'); + setStr(pl, null, 'height'); + + if ((val = ed.dom.getAttrib(fe, "width")) != "") + pl.width = f.width.value = val; + + if ((val = ed.dom.getAttrib(fe, "height")) != "") + pl.height = f.height.value = val; + + oldWidth = pl.width ? parseInt(pl.width) : 0; + oldHeight = pl.height ? parseInt(pl.height) : 0; + } else + oldWidth = oldHeight = 0; + + selectByValue(f, 'media_type', type); + changedType(type); + updateColor('bgcolor_pick', 'bgcolor'); + + TinyMCE_EditableSelects.init(); + generatePreview(); +} + +function insertMedia() { + var fe, f = document.forms[0], h; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(f)) { + alert(ed.getLang('invalid_data')); + return false; + } + + f.width.value = f.width.value == "" ? 100 : f.width.value; + f.height.value = f.height.value == "" ? 100 : f.height.value; + + fe = ed.selection.getNode(); + if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + fe.className = "mceItemFlash"; + break; + + case "flv": + fe.className = "mceItemFlashVideo"; + break; + + case "shockwave": + fe.className = "mceItemShockWave"; + break; + + case "qt": + fe.className = "mceItemQuickTime"; + break; + + case "wmp": + fe.className = "mceItemWindowsMedia"; + break; + + case "rmp": + fe.className = "mceItemRealMedia"; + break; + } + + if (fe.width != f.width.value || fe.height != f.height.height) + ed.execCommand('mceRepaint'); + + fe.title = serializeParameters(); + fe.width = f.width.value; + fe.height = f.height.value; + fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); + fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); + fe.align = f.align.options[f.align.selectedIndex].value; + } else { + h = ' 0) { + var html = ""; + + html += ''; + + return html; + } + + return ""; +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/watch\?v=(.+)(.*)/)) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + +function setBool(pl, p, n) { + if (typeof(pl[n]) == "undefined") + return; + + document.forms[0].elements[p + "_" + n].checked = pl[n]; +} + +function setStr(pl, p, n) { + var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; + + if (typeof(pl[n]) == "undefined") + return; + + if (e.type == "text") + e.value = pl[n]; + else + selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); +} + +function getBool(p, n, d, tv, fv) { + var v = document.forms[0].elements[p + "_" + n].checked; + + tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; + fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; + + return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); +} + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + if (n == 'src') + v = tinyMCEPopup.editor.convertURL(v, 'src', null); + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function getInt(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = ''; + + nw = parseInt(f.width.value); + nh = parseInt(f.height.value); + + if (f.width.value != "" && f.height.value != "") { + if (f.constrain.checked) { + if (c == 'width' && oldWidth != 0) { + wp = nw / oldWidth; + nh = Math.round(wp * nh); + f.height.value = nh; + } else if (c == 'height' && oldHeight != 0) { + hp = nh / oldHeight; + nw = Math.round(hp * nw); + f.width.value = nw; + } + } + } + + if (f.width.value != "") + oldWidth = nw; + + if (f.height.value != "") + oldHeight = nh; + + // After constrain + pl = serializeParameters(); + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'obj' : pl.id; + pl.name = !pl.name ? 'eobj' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') { + h += ''; + + for (n in pl) { + h += ''; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += ''; + } + } + + h += ' + + + {#media_dlg.title} + + + + + + + + + + +
+ + +
+
+
+ {#media_dlg.general} + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
 
+
 
+ + + + + + +
x   
+
+
+ +
+ {#media_dlg.preview} + +
+
+ +
+
+ {#media_dlg.advanced} + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
 
+
+
+ +
+ {#media_dlg.flash_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + + + + + + + +
+
+ +
+ {#media_dlg.flv_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.qt_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+  
+ + + + + +
 
+
+
+ +
+ {#media_dlg.wmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.rmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+   +
+
+ +
+ {#media_dlg.shockwave_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/blank.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/blank.htm new file mode 100644 index 0000000..f841206 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/blank.htm @@ -0,0 +1,22 @@ + + +blank_page + + + + + + + + + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/editor_plugin.js new file mode 100644 index 0000000..4a35002 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

');content=content.replace(/\r\r/g,'

');content=content.replace(/\n\n/g,'

');if((pos=content.indexOf('

'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
');content=content.replace(/\r/g,'
');content=content.replace(/\n/g,'
');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

$1

');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
","gi"),"

"+middot+"$1

");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

 <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

','

','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

  

');content=content.replace(//gi,'

');content=content.replace(/<\/h[1-6]>/gi,'

');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0) + ed.execCommand('delete'); + + if (html && html.length > 0) + ed.execCommand('mcePasteWord', false, html); + + return Event.cancel(e); + }, + + _insertText : function(content, bLinebreaks) { + content = this.editor.dom.encode(content); + + if (content && content.length > 0) { + if (bLinebreaks) { + // Special paragraph treatment + if (this.editor.getParam("paste_create_paragraphs", true)) { + var rl = this.editor.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i

'); + content = content.replace(/\r\r/g, '

'); + content = content.replace(/\n\n/g, '

'); + + // Has paragraphs + if ((pos = content.indexOf('

')) != -1) { + this.editor.execCommand("Delete"); + + var node = this.editor.selection.getNode(); + + // Get list of elements to break + var breakElms = []; + + do { + if (node.nodeType == 1) { + // Don't break tables and break at body + if (node.nodeName == "TD" || node.nodeName == "BODY") + break; + + breakElms[breakElms.length] = node; + } + } while(node = node.parentNode); + + var before = "", after = "

"; + before += content.substring(0, pos); + + for (var i=0; i"; + after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; + } + + before += "

"; + content = before + content.substring(pos+7) + after; + } + } + + if (this.editor.getParam("paste_create_linebreaks", true)) { + content = content.replace(/\r\n/g, '
'); + content = content.replace(/\r/g, '
'); + content = content.replace(/\n/g, '
'); + } + } + + this.editor.execCommand("mceInsertRawHTML", false, content); + } + }, + + _insertWordContent : function(content) { + var t = this, ed = t.editor; + + if (content && content.length > 0) { + // Cleanup Word content + var bull = String.fromCharCode(8226); + var middot = String.fromCharCode(183); + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'before', content); + + var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i(.*?)<\/p>', 'gi'), '

$1

'); + } + + content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); + content = content.replace(new RegExp(bull + "(.*?)
", "gi"), "

" + middot + "$1

"); + content = content.replace(new RegExp('', 'gi'), "" + bull); // Covert to bull list + content = content.replace(/<\/o:p>/gi, ""); + content = content.replace(new RegExp('
]*>/gi, ""); + + if (this.editor.getParam("paste_remove_styles", true)) + content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); + + content = content.replace(/<\/?font[^>]*>/gi, ""); + + // Strips class attributes. + switch (this.editor.getParam("paste_strip_class_attributes", "all")) { + case "all": + content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); + break; + + case "mso": + content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); + break; + } + + content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI()); + content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); + content = content.replace(/<\\?\?xml[^>]*>/gi, ""); + content = content.replace(/<\/?\w+:[^>]*>/gi, ""); + content = content.replace(/-- page break --\s*

 <\/p>/gi, ""); // Remove pagebreaks + content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks + + // content = content.replace(/\/? */gi, "");   + // content = content.replace(/

 <\/p>/gi, ''); + + if (!this.editor.getParam('force_p_newlines')) { + content = content.replace('', '' ,'gi'); + content = content.replace('

', '

' ,'gi'); + } + + if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) { + content = content.replace(/<\/?p[^>]*>/gi, ""); + } + + content = content.replace(/<\/?div[^>]*>/gi, ""); + + // Convert all middlot lists to UL lists + if (this.editor.getParam("paste_convert_middot_lists", true)) { + var div = ed.dom.create("div", null, content); + + // Convert all middot paragraphs to li elements + var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList"); + + while (this._convertMiddots(div, "--list--")) ; // bull + while (this._convertMiddots(div, middot, className)) ; // Middot + while (this._convertMiddots(div, bull)) ; // bull + + content = div.innerHTML; + } + + // Replace all headers with strong and fix some other issues + if (this.editor.getParam("paste_convert_headers_to_strong", false)) { + content = content.replace(/ <\/h[1-6]>/gi, '

  

'); + content = content.replace(//gi, '

'); + content = content.replace(/<\/h[1-6]>/gi, '

'); + content = content.replace(/ <\/b>/gi, '  '); + content = content.replace(/^( )*/gi, ''); + } + + content = content.replace(/--list--/gi, ""); // Remove --list-- + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'after', content); + + // Insert cleaned content + this.editor.execCommand("mceInsertContent", false, content); + + if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) { + var ed = this.editor; + + window.setTimeout(function() { + ed.execCommand("mceCleanup"); + }, 1); // Do normal cleanup detached from this thread + } + } + }, + + _reEscape : function(s) { + var l = "?.\\*[](){}+^$:"; + var o = ""; + + for (var i=0; i + + {#paste.paste_text_desc} + + + + + + +
+
{#paste.paste_text_desc}
+ +
+ +
+ +
+ +
{#paste_dlg.text_title}
+ + + +
+
+ +
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/pasteword.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/pasteword.htm new file mode 100644 index 0000000..f96d478 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/paste/pasteword.htm @@ -0,0 +1,29 @@ + + + + {#paste.paste_word_desc} + + + + + + +
+
{#paste.paste_word_desc}
+ +
{#paste_dlg.word_title}
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/preview/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/preview/editor_plugin.js new file mode 100644 index 0000000..766ebf8 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/preview/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.Preview',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePreview',t._preview,t);ed.addButton('preview',{title:'preview.preview_desc',cmd:'mcePreview'});},getInfo:function(){return{longname:'Preview',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_preview:function(){var ed=this.editor,win,html,c,pos,pos2,css,i,page=ed.getParam("plugin_preview_pageurl",null),w=ed.getParam("plugin_preview_width","550"),h=ed.getParam("plugin_preview_height","600");if(page){ed.windowManager.open({file:ed.getParam("plugin_preview_pageurl",null),width:w,height:h},{resizable:"yes",scrollbars:"yes",inline:1});}else{win=window.open("","mcePreview","menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width="+w+",height="+h);html="";c=ed.getContent();pos=c.indexOf('',pos);pos2=c.lastIndexOf('');c=c.substring(pos+1,pos2);}html+=ed.getParam('doctype');html+='';html+='';html+=''+ed.getLang('preview.preview_desc')+'';html+='';html+='';for(i=0;i';html+='';html+='';html+=c;html+='';html+='';win.document.write(html);win.document.close();}},_onLoad:function(w,d){var t=this,nl,i,el=[],sv,ne;t._doc=d;w.writeFlash=t._writeFlash;w.writeShockWave=t._writeShockWave;w.writeQuickTime=t._writeQuickTime;w.writeRealMedia=t._writeRealMedia;w.writeWindowsMedia=t._writeWindowsMedia;w.writeEmbed=t._writeEmbed;nl=d.getElementsByTagName("script");for(i=0;i';for(n in p)h+='';h+='', pos); + pos2 = c.lastIndexOf(''); + c = c.substring(pos + 1, pos2); + } + + html += ed.getParam('doctype'); + html += ''; + html += ''; + html += '' + ed.getLang('preview.preview_desc') + ''; + html += ''; + html += ''; + + for (i=0; i'; + + html += ''; + html += ''; + html += c; + html += ''; + html += ''; + + win.document.write(html); + win.document.close(); + } + }, + + _onLoad : function(w, d) { + var t = this, nl, i, el = [], sv, ne; + + t._doc = d; + w.writeFlash = t._writeFlash; + w.writeShockWave = t._writeShockWave; + w.writeQuickTime = t._writeQuickTime; + w.writeRealMedia = t._writeRealMedia; + w.writeWindowsMedia = t._writeWindowsMedia; + w.writeEmbed = t._writeEmbed; + + nl = d.getElementsByTagName("script"); + for (i=0; i'; + + h += ''; + + h += ' \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin.js new file mode 100644 index 0000000..f722c2f --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'XX');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g,'');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin_src.js new file mode 100644 index 0000000..26989ff --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/safari/editor_plugin_src.js @@ -0,0 +1,460 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit; + + tinymce.create('tinymce.plugins.Safari', { + init : function(ed) { + var t = this, dom; + + // Ignore on non webkit + if (!tinymce.isWebKit) + return; + + t.editor = ed; + t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; + t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + // Safari will crash if the build in createlink command is used +/* ed.addCommand('CreateLink', function(u, v) { + ed.execCommand("mceInsertContent", false, '' + ed.selection.getContent() + ''); + });*/ + + ed.onPaste.add(function(ed, e) { + function removeStyles(e) { + e = e.target; + + if (e.nodeType == 1) { + e.style.cssText = ''; + + each(ed.dom.select('*', e), function(e) { + e.style.cssText = ''; + }); + } + }; + + Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles); + + window.setTimeout(function() { + Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles); + }, 0); + }); + + ed.onKeyUp.add(function(ed, e) { + var h, b; + + // If backspace or delete key + if (e.keyCode == 46 || e.keyCode == 8) { + b = ed.getBody(); + h = b.innerHTML; + + // If there is no text content or images or hr elements then remove everything + if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) + ed.setContent('', {format : 'raw'}); + } + }); + + // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 + ed.addCommand('FormatBlock', function(u, v) { + var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); + + if (e) + dom.replace(dom.create(v), e, 1); + else + ed.getDoc().execCommand("FormatBlock", false, v); + }); + + // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 + ed.addCommand('mceInsertContent', function(u, v) { + ed.getDoc().execCommand("InsertText", false, 'mce_marker'); + ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + 'XX'); + ed.selection.select(ed.dom.get('_mce_tmp')); + ed.getDoc().execCommand("Delete", false, ' '); + }); + + // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973 + ed.onKeyPress.add(function(ed, e) { + if (e.keyCode == 13 && (e.shiftKey || ed.settings.force_br_newlines && ed.selection.getNode().nodeName != 'LI')) { + t._insertBR(ed); + Event.cancel(e); + } + }); + + // Safari returns incorrect values + ed.addQueryValueHandler('FontSize', function(u, v) { + var e, v; + + // Check for the real font size at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Check for the real font size at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontSize'); + }); + + // Safari returns incorrect values + ed.addQueryValueHandler('FontName', function(u, v) { + var e, v; + + // Check for the real font name at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Check for the real font name at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontName'); + }); + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName == 'IMG') { + t.selElm = e; + ed.selection.select(e); + } else + t.selElm = null; + }); + +/* ed.onBeforeExecCommand.add(function(ed, c, b) { + var r = t.bookmarkRng; + + // Restore selection + if (r) { + ed.selection.setRng(r); + t.bookmarkRng = null; + //console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + });*/ + + ed.onInit.add(function() { + t._fixWebKitSpans(); + +/* ed.windowManager.onOpen.add(function() { + var r = ed.selection.getRng(); + + // Store selection if valid + if (r.startContainer != ed.getDoc()) { + t.bookmarkRng = r.cloneRange(); + //console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + }); + + ed.windowManager.onClose.add(function() { + t.bookmarkRng = null; + });*/ + + if (isOldWebKit) + t._patchSafari2x(ed); + }); + + ed.onSetContent.add(function() { + dom = ed.dom; + + // Convert strong,b,em,u,strike to spans + each(['strong','b','em','u','strike','sub','sup','a'], function(v) { + each(grep(dom.select(v)).reverse(), function(n) { + var nn = n.nodeName.toLowerCase(), st; + + // Convert anchors into images + if (nn == 'a') { + if (n.name) + dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); + + return; + } + + switch (nn) { + case 'b': + case 'strong': + if (nn == 'b') + nn = 'strong'; + + st = 'font-weight: bold;'; + break; + + case 'em': + st = 'font-style: italic;'; + break; + + case 'u': + st = 'text-decoration: underline;'; + break; + + case 'sub': + st = 'vertical-align: sub;'; + break; + + case 'sup': + st = 'vertical-align: super;'; + break; + + case 'strike': + st = 'text-decoration: line-through;'; + break; + } + + dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); + }); + }); + }); + + ed.onPreProcess.add(function(ed, o) { + dom = ed.dom; + + each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { + var v, bg; + + if (o.get) { + if (dom.hasClass(n, 'Apple-style-span')) { + bg = n.style.backgroundColor; + + switch (dom.getAttrib(n, 'mce_name')) { + case 'font': + if (!ed.settings.convert_fonts_to_spans) + dom.setAttrib(n, 'style', ''); + break; + + case 'strong': + case 'em': + case 'sub': + case 'sup': + dom.setAttrib(n, 'style', ''); + break; + + case 'strike': + case 'u': + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + else + dom.setAttrib(n, 'mce_name', ''); + + break; + + default: + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + } + + + if (bg) + n.style.backgroundColor = bg; + } + } + + if (dom.hasClass(n, 'mceItemRemoved')) + dom.remove(n, 1); + }); + }); + + ed.onPostProcess.add(function(ed, o) { + // Safari adds BR at end of all block elements + o.content = o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g, ''); + + // Safari adds id="undefined" to HR elements + o.content = o.content.replace(/ id=\"undefined\"/g, ''); + }); + }, + + getInfo : function() { + return { + longname : 'Safari compatibility', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Internal methods + + _fixWebKitSpans : function() { + var t = this, ed = t.editor; + + if (!isOldWebKit) { + // Use mutator events on new WebKit + Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e && e.nodeType == 1) + t._fixAppleSpan(e); + }); + } else { + // Do post command processing in old WebKit since the browser crashes on Mutator events :( + ed.onExecCommand.add(function() { + each(ed.dom.select('span'), function(n) { + t._fixAppleSpan(n); + }); + + ed.nodeChanged(); + }); + } + }, + + _fixAppleSpan : function(e) { + var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; + + if (dom.getAttrib(e, 'mce_fixed')) + return; + + // Handle Apple style spans + if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { + st = e.style; + + if (!s.convert_fonts_to_spans) { + if (st.fontSize) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); + } + + if (st.fontFamily) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'face', st.fontFamily); + } + + if (st.color) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'color', dom.toHex(st.color)); + } + + if (st.backgroundColor) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setStyle(e, 'background-color', st.backgroundColor); + } + } else { + if (st.fontSize) + dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); + } + + if (st.fontWeight == 'bold') + dom.setAttrib(e, 'mce_name', 'strong'); + + if (st.fontStyle == 'italic') + dom.setAttrib(e, 'mce_name', 'em'); + + if (st.textDecoration == 'underline') + dom.setAttrib(e, 'mce_name', 'u'); + + if (st.textDecoration == 'line-through') + dom.setAttrib(e, 'mce_name', 'strike'); + + if (st.verticalAlign == 'super') + dom.setAttrib(e, 'mce_name', 'sup'); + + if (st.verticalAlign == 'sub') + dom.setAttrib(e, 'mce_name', 'sub'); + + dom.setAttrib(e, 'mce_fixed', '1'); + } + }, + + _patchSafari2x : function(ed) { + var t = this, setContent, getNode, dom = ed.dom, lr; + + // Inline dialogs + if (ed.windowManager.onBeforeOpen) { + ed.windowManager.onBeforeOpen.add(function() { + r = ed.selection.getRng(); + }); + } + + // Fake select on 2.x + ed.selection.select = function(n) { + this.getSel().setBaseAndExtent(n, 0, n, 1); + }; + + getNode = ed.selection.getNode; + ed.selection.getNode = function() { + return t.selElm || getNode.call(this); + }; + + // Fake range on Safari 2.x + ed.selection.getRng = function() { + var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di; + + // Fake range on Safari 2.x + if (s.anchorNode) { + r = d.createRange(); + + try { + // Setup before range + rb = d.createRange(); + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(1); + + // Setup after range + ra = d.createRange(); + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(1); + + // Setup start/end points by comparing locations + di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset); + r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset); + + lr = r; + } catch (ex) { + // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!! + } + } + + return r || lr; + }; + + // Fix setContent so it works + setContent = ed.selection.setContent; + ed.selection.setContent = function(h, s) { + var r = this.getRng(), b; + + try { + setContent.call(this, h, s); + } catch (ex) { + // Workaround for Safari 2.x + b = dom.create('body'); + b.innerHTML = h; + + each(b.childNodes, function(n) { + r.insertNode(n.cloneNode(true)); + }); + } + }; + }, + + _insertBR : function(ed) { + var dom = ed.dom, s = ed.selection, r = s.getRng(), br; + + // Insert BR element + r.insertNode(br = dom.create('br')); + + // Place caret after BR + r.setStartAfter(br); + r.setEndAfter(br); + s.setRng(r); + + // Could not place caret after BR then insert an nbsp entity and move the caret + if (s.getSel().focusNode == br.previousSibling) { + s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br)); + s.collapse(1); + } + + // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117 + ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y); + } + }); + + // Register plugin + tinymce.PluginManager.add('safari', tinymce.plugins.Safari); +})(); + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js new file mode 100644 index 0000000..7fd913b --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js new file mode 100644 index 0000000..7633d62 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.SearchReplacePlugin', { + init : function(ed, url) { + function open(m) { + ed.windowManager.open({ + file : url + '/searchreplace.htm', + width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), + height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)), + inline : 1, + auto_focus : 0 + }, { + mode : m, + search_string : ed.selection.getContent({format : 'text'}), + plugin_url : url + }); + }; + + // Register commands + ed.addCommand('mceSearch', function() { + open('search'); + }); + + ed.addCommand('mceReplace', function() { + open('replace'); + }); + + // Register buttons + ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); + ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); + + ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); + }, + + getInfo : function() { + return { + longname : 'Search/Replace', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js new file mode 100644 index 0000000..492298e --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js @@ -0,0 +1,117 @@ +tinyMCEPopup.requireLangPack(); + +var SearchReplaceDialog = { + init : function(ed) { + var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); + + this.switchMode(m); + + f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); + + // Focus input field + f[m + '_panel_searchstring'].focus(); + }, + + switchMode : function(m) { + var f, lm = this.lastMode; + + if (lm != m) { + f = document.forms[0]; + + if (lm) { + f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; + f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; + f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; + f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; + } + + mcTabs.displayTab(m + '_tab', m + '_panel'); + document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; + document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; + this.lastMode = m; + } + }, + + searchNext : function(a) { + var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; + + // Get input + f = document.forms[0]; + s = f[m + '_panel_searchstring'].value; + b = f[m + '_panel_backwardsu'].checked; + ca = f[m + '_panel_casesensitivebox'].checked; + rs = f['replace_panel_replacestring'].value; + + function fix() { + // Correct Firefox graphics glitches + r = se.getRng().cloneRange(); + ed.getDoc().execCommand('SelectAll', false, null); + se.setRng(r); + }; + + function replace() { + if (tinymce.isIE) + ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE + else + ed.getDoc().execCommand('InsertHTML', false, rs); + }; + + // IE flags + if (ca) + fl = fl | 4; + + switch (a) { + case 'all': + if (tinymce.isIE) { + while (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + replace(); + fo = 1; + } + + tinyMCEPopup.storeSelection(); + } else { + while (w.find(s, ca, b, false, false, false, false)) { + replace(); + fo = 1; + } + } + + if (fo) + wm.alert(ed.getLang('searchreplace_dlg.allreplaced')); + else + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + + return; + + case 'current': + replace(); + break; + } + + se.collapse(b); + r = se.getRng(); + + // Whats the point + if (!s) + return; + + if (tinymce.isIE) { + if (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + } else + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + + tinyMCEPopup.storeSelection(); + } else { + if (!w.find(s, ca, b, false, false, false, false)) + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + else + fix(); + } + } +}; + +tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js new file mode 100644 index 0000000..3dd3453 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js @@ -0,0 +1,16 @@ +tinyMCE.addI18n('en.searchreplace_dlg',{ +searchnext_desc:"Find again", +notfound:"The search has been completed. The search string could not be found.", +search_title:"Find", +replace_title:"Find/Replace", +allreplaced:"All occurrences of the search string were replaced.", +findwhat:"Find what", +replacewith:"Replace with", +direction:"Direction", +up:"Up", +down:"Down", +mcase:"Match case", +findnext:"Find next", +replace:"Replace", +replaceall:"Replace all" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm new file mode 100644 index 0000000..90e80d0 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm @@ -0,0 +1,105 @@ + + + + {#searchreplace_dlg.replace_title} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + +
+
+
+ +
+ +
+
+ + + +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin.js new file mode 100644 index 0000000..6ebaa91 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.StylePlugin',{init:function(ed,url){ed.addCommand('mceStyleProps',function(){ed.windowManager.open({file:url+'/props.htm',width:480+parseInt(ed.getLang('style.delta_width',0)),height:320+parseInt(ed.getLang('style.delta_height',0)),inline:1},{plugin_url:url,style_text:ed.selection.getNode().style.cssText});});ed.addCommand('mceSetElementStyle',function(ui,v){if(e=ed.selection.getNode()){ed.dom.setAttrib(e,'style',v);ed.execCommand('mceRepaint');}});ed.onNodeChange.add(function(ed,cm,n){cm.setDisabled('styleprops',n.nodeName==='BODY');});ed.addButton('styleprops',{title:'style.desc',cmd:'mceStyleProps'});},getInfo:function(){return{longname:'Style',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('style',tinymce.plugins.StylePlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin_src.js new file mode 100644 index 0000000..507c841 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/editor_plugin_src.js @@ -0,0 +1,52 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.StylePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceStyleProps', function() { + ed.windowManager.open({ + file : url + '/props.htm', + width : 480 + parseInt(ed.getLang('style.delta_width', 0)), + height : 320 + parseInt(ed.getLang('style.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + style_text : ed.selection.getNode().style.cssText + }); + }); + + ed.addCommand('mceSetElementStyle', function(ui, v) { + if (e = ed.selection.getNode()) { + ed.dom.setAttrib(e, 'style', v); + ed.execCommand('mceRepaint'); + } + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setDisabled('styleprops', n.nodeName === 'BODY'); + }); + + // Register buttons + ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); + }, + + getInfo : function() { + return { + longname : 'Style', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/js/props.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/js/props.js new file mode 100644 index 0000000..4fdfceb --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/js/props.js @@ -0,0 +1,641 @@ +tinyMCEPopup.requireLangPack(); + +var defaultFonts = "" + + "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Courier New, Courier, mono=Courier New, Courier, mono;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + + "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + + "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; + +var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; +var defaultMeasurement = "+pixels=px;points=pt;em;in;cm;mm;picas;ems;exs;%"; +var defaultSpacingMeasurement = "pixels=px;points=pt;in;cm;mm;picas;+ems;exs;%"; +var defaultIndentMeasurement = "pixels=px;+points=pt;in;cm;mm;picas;ems;exs;%"; +var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; +var defaultTextStyle = "normal;italic;oblique"; +var defaultVariant = "normal;small-caps"; +var defaultLineHeight = "normal"; +var defaultAttachment = "fixed;scroll"; +var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; +var defaultPosH = "left;center;right"; +var defaultPosV = "top;center;bottom"; +var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; +var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; +var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; +var defaultBorderWidth = "thin;medium;thick"; +var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; + +function init() { + var ce = document.getElementById('container'), h; + + ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); + + h = getBrowserHTML('background_image_browser','background_image','image','advimage'); + document.getElementById("background_image_browser").innerHTML = h; + + document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); + document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); + document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); + document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); + document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); + document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); + + fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); + fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); + fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); + fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); + fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); + fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); + fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); + fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); + fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); + + fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); + fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); + + fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); + fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); + fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); + fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); + fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); + fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); + fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); + + fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); + fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); + fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); + + fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); + + fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); + fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); + + fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); + fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); + + fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); + + fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); + + TinyMCE_EditableSelects.init(); + setupFormData(); + showDisabledControls(); +} + +function setupFormData() { + var ce = document.getElementById('container'), f = document.forms[0], s, b, i; + + // Setup text fields + + selectByValue(f, 'text_font', ce.style.fontFamily, true, true); + selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); + selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); + selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); + selectByValue(f, 'text_style', ce.style.fontStyle, true, true); + selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); + selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); + selectByValue(f, 'text_case', ce.style.textTransform, true, true); + selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); + f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); + updateColor('text_color_pick', 'text_color'); + f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); + f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); + f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); + f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); + + // Setup background fields + + f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); + updateColor('background_color_pick', 'background_color'); + f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); + selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); + selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); + selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); + selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); + selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); + + // Setup block fields + + selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); + selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); + selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); + selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); + selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); + selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); + f.block_text_indent.value = getNum(ce.style.textIndent); + selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); + selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); + selectByValue(f, 'block_display', ce.style.display, true, true); + + // Setup box fields + + f.box_width.value = getNum(ce.style.width); + selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); + + f.box_height.value = getNum(ce.style.height); + selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); + + if (tinymce.isGecko) + selectByValue(f, 'box_float', ce.style.cssFloat, true, true); + else + selectByValue(f, 'box_float', ce.style.styleFloat, true, true); + + selectByValue(f, 'box_clear', ce.style.clear, true, true); + + setupBox(f, ce, 'box_padding', 'padding', ''); + setupBox(f, ce, 'box_margin', 'margin', ''); + + // Setup border fields + + setupBox(f, ce, 'border_style', 'border', 'Style'); + setupBox(f, ce, 'border_width', 'border', 'Width'); + setupBox(f, ce, 'border_color', 'border', 'Color'); + + updateColor('border_color_top_pick', 'border_color_top'); + updateColor('border_color_right_pick', 'border_color_right'); + updateColor('border_color_bottom_pick', 'border_color_bottom'); + updateColor('border_color_left_pick', 'border_color_left'); + + f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); + f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); + f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); + f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); + + // Setup list fields + + selectByValue(f, 'list_type', ce.style.listStyleType, true, true); + selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); + f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + + // Setup box fields + + selectByValue(f, 'positioning_type', ce.style.position, true, true); + selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); + selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); + f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; + + f.positioning_width.value = getNum(ce.style.width); + selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); + + f.positioning_height.value = getNum(ce.style.height); + selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); + + setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); + + s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); + s = s.replace(/,/g, ' '); + + if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = getNum(getVal(s, 1)); + selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); + f.positioning_clip_bottom.value = getNum(getVal(s, 2)); + selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); + f.positioning_clip_left.value = getNum(getVal(s, 3)); + selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); + } else { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; + } + +// setupBox(f, ce, '', 'border', 'Color'); +} + +function getMeasurement(s) { + return s.replace(/^([0-9]+)(.*)$/, "$2"); +} + +function getNum(s) { + if (new RegExp('^[0-9]+[a-z%]+$', 'gi').test(s)) + return s.replace(/[^0-9]/g, ''); + + return s; +} + +function inStr(s, n) { + return new RegExp(n, 'gi').test(s); +} + +function getVal(s, i) { + var a = s.split(' '); + + if (a.length > 1) + return a[i]; + + return ""; +} + +function setValue(f, n, v) { + if (f.elements[n].type == "text") + f.elements[n].value = v; + else + selectByValue(f, n, v, true, true); +} + +function setupBox(f, ce, fp, pr, sf, b) { + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (isSame(ce, pr, sf, b)) { + f.elements[fp + "_same"].checked = true; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + f.elements[fp + "_right"].value = ""; + f.elements[fp + "_right"].disabled = true; + f.elements[fp + "_bottom"].value = ""; + f.elements[fp + "_bottom"].disabled = true; + f.elements[fp + "_left"].value = ""; + f.elements[fp + "_left"].disabled = true; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + f.elements[fp + "_left_measurement"].disabled = true; + f.elements[fp + "_bottom_measurement"].disabled = true; + f.elements[fp + "_right_measurement"].disabled = true; + } + } else { + f.elements[fp + "_same"].checked = false; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); + f.elements[fp + "_right"].disabled = false; + + setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); + f.elements[fp + "_bottom"].disabled = false; + + setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left"].disabled = false; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); + selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); + selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left_measurement"].disabled = false; + f.elements[fp + "_bottom_measurement"].disabled = false; + f.elements[fp + "_right_measurement"].disabled = false; + } + } +} + +function isSame(e, pr, sf, b) { + var a = [], i, x; + + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (typeof(sf) == "undefined" || sf == null) + sf = ""; + + a[0] = e.style[pr + b[0] + sf]; + a[1] = e.style[pr + b[1] + sf]; + a[2] = e.style[pr + b[2] + sf]; + a[3] = e.style[pr + b[3] + sf]; + + for (i=0; i 0 ? s.substring(1) : s; + + if (f.text_none.checked) + s = "none"; + + ce.style.textDecoration = s; + + // Build background styles + + ce.style.backgroundColor = f.background_color.value; + ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; + ce.style.backgroundRepeat = f.background_repeat.value; + ce.style.backgroundAttachment = f.background_attachment.value; + + if (f.background_hpos.value != "") { + s = ""; + s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; + s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); + ce.style.backgroundPosition = s; + } + + // Build block styles + + ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); + ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); + ce.style.verticalAlign = f.block_vertical_alignment.value; + ce.style.textAlign = f.block_text_align.value; + ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); + ce.style.whiteSpace = f.block_whitespace.value; + ce.style.display = f.block_display.value; + + // Build box styles + + ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); + ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); + ce.style.styleFloat = f.box_float.value; + + if (tinymce.isGecko) + ce.style.cssFloat = f.box_float.value; + + ce.style.clear = f.box_clear.value; + + if (!f.box_padding_same.checked) { + ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); + ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); + ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); + } else + ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + + if (!f.box_margin_same.checked) { + ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); + ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); + ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); + } else + ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + + // Build border styles + + if (!f.border_style_same.checked) { + ce.style.borderTopStyle = f.border_style_top.value; + ce.style.borderRightStyle = f.border_style_right.value; + ce.style.borderBottomStyle = f.border_style_bottom.value; + ce.style.borderLeftStyle = f.border_style_left.value; + } else + ce.style.borderStyle = f.border_style_top.value; + + if (!f.border_width_same.checked) { + ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); + ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); + ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); + ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); + } else + ce.style.borderWidth = f.border_width_top.value; + + if (!f.border_color_same.checked) { + ce.style.borderTopColor = f.border_color_top.value; + ce.style.borderRightColor = f.border_color_right.value; + ce.style.borderBottomColor = f.border_color_bottom.value; + ce.style.borderLeftColor = f.border_color_left.value; + } else + ce.style.borderColor = f.border_color_top.value; + + // Build list styles + + ce.style.listStyleType = f.list_type.value; + ce.style.listStylePosition = f.list_position.value; + ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; + + // Build positioning styles + + ce.style.position = f.positioning_type.value; + ce.style.visibility = f.positioning_visibility.value; + + if (ce.style.width == "") + ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); + + if (ce.style.height == "") + ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); + + ce.style.zIndex = f.positioning_zindex.value; + ce.style.overflow = f.positioning_overflow.value; + + if (!f.positioning_placement_same.checked) { + ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); + ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); + ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); + } else { + s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.top = s; + ce.style.right = s; + ce.style.bottom = s; + ce.style.left = s; + } + + if (!f.positioning_clip_same.checked) { + s = "rect("; + s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); + s += ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } else { + s = "rect("; + t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; + s += t + " "; + s += t + " "; + s += t + " "; + s += t + ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } + + ce.style.cssText = ce.style.cssText; +} + +function isNum(s) { + return new RegExp('[0-9]+', 'g').test(s); +} + +function showDisabledControls() { + var f = document.forms, i, a; + + for (i=0; i 1) { + addSelectValue(f, s, p[0], p[1]); + + if (se) + selectByValue(f, s, p[1]); + } else { + addSelectValue(f, s, p[0], p[0]); + + if (se) + selectByValue(f, s, p[0]); + } + } +} + +function toggleSame(ce, pre) { + var el = document.forms[0].elements, i; + + if (ce.checked) { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = true; + el[pre + "_bottom"].disabled = true; + el[pre + "_left"].disabled = true; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = true; + el[pre + "_bottom_measurement"].disabled = true; + el[pre + "_left_measurement"].disabled = true; + } + } else { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = false; + el[pre + "_bottom"].disabled = false; + el[pre + "_left"].disabled = false; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = false; + el[pre + "_bottom_measurement"].disabled = false; + el[pre + "_left_measurement"].disabled = false; + } + } + + showDisabledControls(); +} + +function synch(fr, to) { + var f = document.forms[0]; + + f.elements[to].value = f.elements[fr].value; + + if (f.elements[fr + "_measurement"]) + selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/langs/en_dlg.js new file mode 100644 index 0000000..d9d7762 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/langs/en_dlg.js @@ -0,0 +1,63 @@ +tinyMCE.addI18n('en.style_dlg',{ +title:"Edit CSS Style", +apply:"Apply", +text_tab:"Text", +background_tab:"Background", +block_tab:"Block", +box_tab:"Box", +border_tab:"Border", +list_tab:"List", +positioning_tab:"Positioning", +text_props:"Text", +text_font:"Font", +text_size:"Size", +text_weight:"Weight", +text_style:"Style", +text_variant:"Variant", +text_lineheight:"Line height", +text_case:"Case", +text_color:"Color", +text_decoration:"Decoration", +text_overline:"overline", +text_underline:"underline", +text_striketrough:"strikethrough", +text_blink:"blink", +text_none:"none", +background_color:"Background color", +background_image:"Background image", +background_repeat:"Repeat", +background_attachment:"Attachment", +background_hpos:"Horizontal position", +background_vpos:"Vertical position", +block_wordspacing:"Word spacing", +block_letterspacing:"Letter spacing", +block_vertical_alignment:"Vertical alignment", +block_text_align:"Text align", +block_text_indent:"Text indent", +block_whitespace:"Whitespace", +block_display:"Display", +box_width:"Width", +box_height:"Height", +box_float:"Float", +box_clear:"Clear", +padding:"Padding", +same:"Same for all", +top:"Top", +right:"Right", +bottom:"Bottom", +left:"Left", +margin:"Margin", +style:"Style", +width:"Width", +height:"Height", +color:"Color", +list_type:"Type", +bullet_image:"Bullet image", +position:"Position", +positioning_type:"Type", +visibility:"Visibility", +zindex:"Z-index", +overflow:"Overflow", +placement:"Placement", +clip:"Clip" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/props.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/props.htm new file mode 100644 index 0000000..54538e3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/style/props.htm @@ -0,0 +1,731 @@ + + + + {#style_dlg.title} + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
 
+
+ +
+ + + +
+ + + + + + +
+ +  
+
+ +
+ + + + + +
 
+
{#style_dlg.text_decoration} + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
 
+
+ + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + +
+ + + + + + +
 
+
   
+ + + + + + +
 
+
   
+
+
+ {#style_dlg.padding} + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+
+ +
+
+ {#style_dlg.margin} + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  {#style_dlg.style} {#style_dlg.width} {#style_dlg.color}
      
{#style_dlg.top}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.right}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.bottom}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.left}   + + + + + + +
 
+
  + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
   
+ + + + + + +
 
+
   
+ + + + + + +
 
+
   
+ +
+
+ {#style_dlg.placement} + + + + + + + + + + + + + + + + + + + + + + +
 
{#style_dlg.top} + + + + + + +
 
+
{#style_dlg.right} + + + + + + +
 
+
{#style_dlg.bottom} + + + + + + +
 
+
{#style_dlg.left} + + + + + + +
 
+
+
+
+ +
+
+ {#style_dlg.clip} + + + + + + + + + + + + + + + + + + + + + + +
 
{#style_dlg.top} + + + + + + +
 
+
{#style_dlg.right} + + + + + + +
 
+
{#style_dlg.bottom} + + + + + + +
 
+
{#style_dlg.left} + + + + + + +
 
+
+
+
+
+
+
+ +
+
+
+ +
 
+
+
+ +
+ +
+
+
+ +
+
+
+ + + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/cell.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/cell.htm new file mode 100644 index 0000000..c931731 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/cell.htm @@ -0,0 +1,184 @@ + + + + {#table_dlg.cell_title} + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin.js new file mode 100644 index 0000000..085882a --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin.js @@ -0,0 +1 @@ +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TablePlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;each([['table','table.desc','mceInsertTable',true],['delete_table','table.del','mceTableDelete'],['delete_col','table.delete_col_desc','mceTableDeleteCol'],['delete_row','table.delete_row_desc','mceTableDeleteRow'],['col_after','table.col_after_desc','mceTableInsertColAfter'],['col_before','table.col_before_desc','mceTableInsertColBefore'],['row_after','table.row_after_desc','mceTableInsertRowAfter'],['row_before','table.row_before_desc','mceTableInsertRowBefore'],['row_props','table.row_desc','mceTableRowProps',true],['cell_props','table.cell_desc','mceTableCellProps',true],['split_cells','table.split_cells_desc','mceTableSplitCells',true],['merge_cells','table.merge_cells_desc','mceTableMergeCells',true]],function(c){ed.addButton(c[0],{title:c[1],cmd:c[2],ui:c[3]});});ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){var sm,se=ed.selection,el=se.getNode()||ed.getBody();if(ed.dom.getParent(e,'td')||ed.dom.getParent(e,'th')){m.removeAll();if(el.nodeName=='A'&&!ed.dom.getAttrib(el,'name')){m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});m.addSeparator();}if(el.nodeName=='IMG'&&el.className.indexOf('mceItem')==-1){m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();}m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true,value:{action:'insert'}});m.add({title:'table.props_desc',icon:'table_props',cmd:'mceInsertTable',ui:true});m.add({title:'table.del',icon:'delete_table',cmd:'mceTableDelete',ui:true});m.addSeparator();sm=m.addMenu({title:'table.cell'});sm.add({title:'table.cell_desc',icon:'cell_props',cmd:'mceTableCellProps',ui:true});sm.add({title:'table.split_cells_desc',icon:'split_cells',cmd:'mceTableSplitCells',ui:true});sm.add({title:'table.merge_cells_desc',icon:'merge_cells',cmd:'mceTableMergeCells',ui:true});sm=m.addMenu({title:'table.row'});sm.add({title:'table.row_desc',icon:'row_props',cmd:'mceTableRowProps',ui:true});sm.add({title:'table.row_before_desc',icon:'row_before',cmd:'mceTableInsertRowBefore'});sm.add({title:'table.row_after_desc',icon:'row_after',cmd:'mceTableInsertRowAfter'});sm.add({title:'table.delete_row_desc',icon:'delete_row',cmd:'mceTableDeleteRow'});sm.addSeparator();sm.add({title:'table.cut_row_desc',icon:'cut',cmd:'mceTableCutRow'});sm.add({title:'table.copy_row_desc',icon:'copy',cmd:'mceTableCopyRow'});sm.add({title:'table.paste_row_before_desc',icon:'paste',cmd:'mceTablePasteRowBefore'});sm.add({title:'table.paste_row_after_desc',icon:'paste',cmd:'mceTablePasteRowAfter'});sm=m.addMenu({title:'table.col'});sm.add({title:'table.col_before_desc',icon:'col_before',cmd:'mceTableInsertColBefore'});sm.add({title:'table.col_after_desc',icon:'col_after',cmd:'mceTableInsertColAfter'});sm.add({title:'table.delete_col_desc',icon:'delete_col',cmd:'mceTableDeleteCol'});}else m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true});});}});ed.onKeyDown.add(function(ed,e){if(e.keyCode==9&&ed.dom.getParent(ed.selection.getNode(),'TABLE')){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(ed.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(e);}ed.undoManager.add();}});if(!tinymce.isIE){if(ed.getParam('table_selection',true)){ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='TABLE')ed.selection.select(e);});}}ed.onNodeChange.add(function(ed,cm,n){var p=ed.dom.getParent(n,'td,th,caption');cm.setActive('table',n.nodeName==='TABLE'||!!p);if(p&&p.nodeName==='CAPTION')p=null;cm.setDisabled('delete_table',!p);cm.setDisabled('delete_col',!p);cm.setDisabled('delete_table',!p);cm.setDisabled('delete_row',!p);cm.setDisabled('col_after',!p);cm.setDisabled('col_before',!p);cm.setDisabled('row_after',!p);cm.setDisabled('row_before',!p);cm.setDisabled('row_props',!p);cm.setDisabled('cell_props',!p);cm.setDisabled('split_cells',!p||(parseInt(ed.dom.getAttrib(p,'colspan','1'))<2&&parseInt(ed.dom.getAttrib(p,'rowspan','1'))<2));cm.setDisabled('merge_cells',!p);});if(!tinymce.isIE){ed.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?'<$1$2> ':'<$1$2>
');});}},execCommand:function(cmd,ui,val){var ed=this.editor,b;switch(cmd){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":ed.execCommand('mceBeginUndoLevel');this._doExecCommand(cmd,ui,val);ed.execCommand('mceEndUndoLevel');return true;}return false;},getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_doExecCommand:function(command,user_interface,value){var inst=this.editor,ed=inst,url=this.url;var focusElm=inst.selection.getNode();var trElm=inst.dom.getParent(focusElm,"tr");var tdElm=inst.dom.getParent(focusElm,"td,th");var tableElm=inst.dom.getParent(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function select(dx,dy){var td;grid=getTableGrid(tableElm);dx=dx||0;dy=dy||0;dx=Math.max(cpos.cellindex+dx,0);dy=Math.max(cpos.rowindex+dy,0);inst.execCommand('mceRepaint');td=getCell(grid,dy,dx);if(td){inst.selection.select(td.firstChild||td);inst.selection.collapse(1);}};function makeTD(){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';}function getColRowSpan(td){var colspan=inst.dom.getAttrib(td,"colspan");var rowspan=inst.dom.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){var x,y;for(y=0;y1){for(var i=x;i1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i';if(tinymce.isIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=inst.dom.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i';}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableMoveToNextRow":var nextCell=getNextCell(tableElm,tdElm);if(!nextCell){inst.execCommand("mceTableInsertRowAfter",tdElm);nextCell=getNextCell(tableElm,tdElm);}inst.selection.select(nextCell);inst.selection.collapse(true);return true;case"mceTableRowProps":if(trElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/row.htm',width:400+parseInt(inst.getLang('table.rowprops_delta_width',0)),height:295+parseInt(inst.getLang('table.rowprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/cell.htm',width:400+parseInt(inst.getLang('table.cellprops_delta_width',0)),height:295+parseInt(inst.getLang('table.cellprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceInsertTable":if(user_interface){inst.windowManager.open({url:url+'/table.htm',width:400+parseInt(inst.getLang('table.table_delta_width',0)),height:320+parseInt(inst.getLang('table.table_delta_height',0)),inline:1},{plugin_url:url,action:value?value.action:0});}return true;case"mceTableDelete":var table=inst.dom.getParent(inst.selection.getNode(),"table");if(table){table.parentNode.removeChild(table);inst.execCommand('mceRepaint');}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);select(0,1);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}select(0,1);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);select(0,-1);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
';newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}select();break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
';newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}select(1);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if((grid.length>1&&grid[0].length<=1)&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}select(-1);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i';trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");break;case"mceTableMergeCells":var rows=[];var sel=inst.selection.getSel();var grid=getTableGrid(tableElm);if(tinymce.isIE||sel.rangeCount==1){if(user_interface){var sp=getColRowSpan(tdElm);inst.windowManager.open({url:url+'/merge_cells.htm',width:240+parseInt(inst.getLang('table.merge_cells_delta_width',0)),height:110+parseInt(inst.getLang('table.merge_cells_delta_height',0)),inline:1},{action:"update",numcols:sp.colspan,numrows:sp.rowspan,plugin_url:url});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y0)rows[rows.length]=rowCells;var td=getCell(grid,cpos.rowindex,cpos.cellindex);each(ed.dom.select('br',td),function(e,i){if(i>0&&ed.dom.getAttrib('mce_bogus'))ed.dom.remove(e);});}}}else{var cells=[];var sel=inst.selection.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i0)rows[rows.length]=rowCells;}var curRow=[];var lastTR=null;for(var y=0;ycolSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;xrowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}each(ed.dom.select('br',tdElm),function(e,i){if(i>0&&ed.dom.getAttrib(e,'mce_bogus'))ed.dom.remove(e);});break;}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");inst.addVisual(tableElm);inst.nodeChanged();}return true;}return false;}});tinymce.PluginManager.add('table',tinymce.plugins.TablePlugin);})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin_src.js new file mode 100644 index 0000000..65727ef --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/editor_plugin_src.js @@ -0,0 +1,1115 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:29 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TablePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register buttons + each([ + ['table', 'table.desc', 'mceInsertTable', true], + ['delete_table', 'table.del', 'mceTableDelete'], + ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'], + ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'], + ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'], + ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'], + ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'], + ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'], + ['row_props', 'table.row_desc', 'mceTableRowProps', true], + ['cell_props', 'table.cell_desc', 'mceTableCellProps', true], + ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true], + ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true] + ], function(c) { + ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]}); + }); + + ed.onInit.add(function() { + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + var sm, se = ed.selection, el = se.getNode() || ed.getBody(); + + if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) { + m.removeAll(); + + if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) { + m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); + m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); + m.addSeparator(); + } + + if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) { + m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); + m.addSeparator(); + } + + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}}); + m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true}); + m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true}); + m.addSeparator(); + + // Cell menu + sm = m.addMenu({title : 'table.cell'}); + sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true}); + sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true}); + sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true}); + + // Row menu + sm = m.addMenu({title : 'table.row'}); + sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true}); + sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'}); + sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'}); + sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'}); + sm.addSeparator(); + sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'}); + sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'}); + sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}); + sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}); + + // Column menu + sm = m.addMenu({title : 'table.col'}); + sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'}); + sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'}); + sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'}); + } else + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true}); + }); + } + }); + + // Add undo level when new rows are created using the tab key + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) { + if (!tinymce.isGecko && !tinymce.isOpera) { + tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true); + return tinymce.dom.Event.cancel(e); + } + + ed.undoManager.add(); + } + }); + + // Select whole table is a table border is clicked + if (!tinymce.isIE) { + if (ed.getParam('table_selection', true)) { + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'TABLE') + ed.selection.select(e); + }); + } + } + + ed.onNodeChange.add(function(ed, cm, n) { + var p = ed.dom.getParent(n, 'td,th,caption'); + + cm.setActive('table', n.nodeName === 'TABLE' || !!p); + if (p && p.nodeName === 'CAPTION') + p = null; + + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_col', !p); + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_row', !p); + cm.setDisabled('col_after', !p); + cm.setDisabled('col_before', !p); + cm.setDisabled('row_after', !p); + cm.setDisabled('row_before', !p); + cm.setDisabled('row_props', !p); + cm.setDisabled('cell_props', !p); + cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2)); + cm.setDisabled('merge_cells', !p); + }); + + // Padd empty table cells + if (!tinymce.isIE) { + ed.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> ' : '<$1$2>
'); + }); + } + }, + + execCommand : function(cmd, ui, val) { + var ed = this.editor, b; + + // Is table command + switch (cmd) { + case "mceTableMoveToNextRow": + case "mceInsertTable": + case "mceTableRowProps": + case "mceTableCellProps": + case "mceTableSplitCells": + case "mceTableMergeCells": + case "mceTableInsertRowBefore": + case "mceTableInsertRowAfter": + case "mceTableDeleteRow": + case "mceTableInsertColBefore": + case "mceTableInsertColAfter": + case "mceTableDeleteCol": + case "mceTableCutRow": + case "mceTableCopyRow": + case "mceTablePasteRowBefore": + case "mceTablePasteRowAfter": + case "mceTableDelete": + ed.execCommand('mceBeginUndoLevel'); + this._doExecCommand(cmd, ui, val); + ed.execCommand('mceEndUndoLevel'); + + return true; + } + + // Pass to next handler in chain + return false; + }, + + getInfo : function() { + return { + longname : 'Tables', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + /** + * Executes the table commands. + */ + _doExecCommand : function(command, user_interface, value) { + var inst = this.editor, ed = inst, url = this.url; + var focusElm = inst.selection.getNode(); + var trElm = inst.dom.getParent(focusElm, "tr"); + var tdElm = inst.dom.getParent(focusElm, "td,th"); + var tableElm = inst.dom.getParent(focusElm, "table"); + var doc = inst.contentWindow.document; + var tableBorder = tableElm ? tableElm.getAttribute("border") : ""; + + // Get first TD if no TD found + if (trElm && tdElm == null) + tdElm = trElm.cells[0]; + + function inArray(ar, v) { + for (var i=0; i 0 && inArray(ar[i], v)) + return true; + + // Found value + if (ar[i] == v) + return true; + } + + return false; + } + + function select(dx, dy) { + var td; + + grid = getTableGrid(tableElm); + dx = dx || 0; + dy = dy || 0; + dx = Math.max(cpos.cellindex + dx, 0); + dy = Math.max(cpos.rowindex + dy, 0); + + // Recalculate grid and select + inst.execCommand('mceRepaint'); + td = getCell(grid, dy, dx); + + if (td) { + inst.selection.select(td.firstChild || td); + inst.selection.collapse(1); + } + }; + + function makeTD() { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + } + + function getColRowSpan(td) { + var colspan = inst.dom.getAttrib(td, "colspan"); + var rowspan = inst.dom.getAttrib(td, "rowspan"); + + colspan = colspan == "" ? 1 : parseInt(colspan); + rowspan = rowspan == "" ? 1 : parseInt(rowspan); + + return {colspan : colspan, rowspan : rowspan}; + } + + function getCellPos(grid, td) { + var x, y; + + for (y=0; y 1) { // Remove due to colspan + for (var i=x; i 1) + td.rowSpan = sd.rowspan + 1; + + lastElm = td; + } + + deleteMarked(tableElm); + } + } + + function prevElm(node, name) { + while ((node = node.previousSibling) != null) { + if (node.nodeName == name) + return node; + } + + return null; + } + + function nextElm(node, names) { + var namesAr = names.split(','); + + while ((node = node.nextSibling) != null) { + for (var i=0; i 1) { + do { + var nexttd = nextElm(td, "TD,TH"); + + if (td._delete) + td.parentNode.removeChild(td); + } while ((td = nexttd) != null); + } + } while ((tr = next) != null); + } + + function addRows(td_elm, tr_elm, rowspan) { + // Add rows + td_elm.rowSpan = 1; + var trNext = nextElm(tr_elm, "TR"); + for (var i=1; i 1) { + var newTD = cells[x].cloneNode(true); + var sd = getColRowSpan(cells[x]); + + newTD.rowSpan = sd.rowspan - 1; + + var nextTD = nextTR.cells[x]; + + if (nextTD == null) + nextTR.appendChild(newTD); + else + nextTR.insertBefore(newTD, nextTD); + } + } + + // Delete cells + var lastTDElm = null; + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd.rowspan > 1) { + tdElm.rowSpan = sd.rowspan - 1; + } else { + trElm = tdElm.parentNode; + + if (trElm.parentNode) + trElm._delete = true; + } + + lastTDElm = tdElm; + } + } + + deleteMarked(tableElm); + + select(0, -1); + break; + + case "mceTableInsertColBefore": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + + newTD.rowSpan = tdElm.rowSpan; + + tdElm.parentNode.insertBefore(newTD, tdElm); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(); + break; + + case "mceTableInsertColAfter": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + + newTD.rowSpan = tdElm.rowSpan; + + var nextTD = nextElm(tdElm, "TD,TH"); + if (nextTD == null) + tdElm.parentNode.appendChild(newTD); + else + nextTD.parentNode.insertBefore(newTD, nextTD); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(1); + break; + + case "mceTableDeleteCol": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + // Only one col, remove whole table + if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') { + inst.dom.remove(inst.dom.getParent(tableElm, "table")); + return true; + } + + // Delete cells + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] > 1) + tdElm.colSpan = sd['colspan'] - 1; + else { + if (tdElm.parentNode) + tdElm.parentNode.removeChild(tdElm); + } + + lastTDElm = tdElm; + } + } + + select(-1); + break; + + case "mceTableSplitCells": + if (!trElm || !tdElm) + return true; + + var spandata = getColRowSpan(tdElm); + + var colspan = spandata["colspan"]; + var rowspan = spandata["rowspan"]; + + // Needs splitting + if (colspan > 1 || rowspan > 1) { + // Generate cols + tdElm.colSpan = 1; + for (var i=1; i 1) + addRows(newTD, trElm, rowspan); + } + + addRows(tdElm, trElm, rowspan); + } + + // Apply visual aids + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + break; + + case "mceTableMergeCells": + var rows = []; + var sel = inst.selection.getSel(); + var grid = getTableGrid(tableElm); + + if (tinymce.isIE || sel.rangeCount == 1) { + if (user_interface) { + // Setup template + var sp = getColRowSpan(tdElm); + + inst.windowManager.open({ + url : url + '/merge_cells.htm', + width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)), + height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)), + inline : 1 + }, { + action : "update", + numcols : sp.colspan, + numrows : sp.rowspan, + plugin_url : url + }); + + return true; + } else { + var numRows = parseInt(value['numrows']); + var numCols = parseInt(value['numcols']); + var cpos = getCellPos(grid, tdElm); + + if (("" + numRows) == "NaN") + numRows = 1; + + if (("" + numCols) == "NaN") + numCols = 1; + + // Get rows and cells + var tRows = tableElm.rows; + for (var y=cpos.rowindex; y 0) + rows[rows.length] = rowCells; + + var td = getCell(grid, cpos.rowindex, cpos.cellindex); + each(ed.dom.select('br', td), function(e, i) { + if (i > 0 && ed.dom.getAttrib('mce_bogus')) + ed.dom.remove(e); + }); + } + + //return true; + } + } else { + var cells = []; + var sel = inst.selection.getSel(); + var lastTR = null; + var curRow = null; + var x1 = -1, y1 = -1, x2, y2; + + // Only one cell selected, whats the point? + if (sel.rangeCount < 2) + return true; + + // Get all selected cells + for (var i=0; i 0) + rows[rows.length] = rowCells; + } + + // Find selected cells in grid and box + var curRow = []; + var lastTR = null; + for (var y=0; y colSpan) + colSpan = rowColSpan; + + lastRowSpan = -1; + } + + // Validate vertical and get total rowspan + var lastColSpan = -1; + for (var x=0; x rowSpan) + rowSpan = colRowSpan; + + lastColSpan = -1; + } + + // Setup td + tdElm = rows[0][0]; + tdElm.rowSpan = rowSpan; + tdElm.colSpan = colSpan; + + // Merge cells + for (var y=0; y 0)) + tdElm.innerHTML += html; + + // Not current cell + if (rows[y][x] != tdElm && !rows[y][x]._deleted) { + var cpos = getCellPos(grid, rows[y][x]); + var tr = rows[y][x].parentNode; + + tr.removeChild(rows[y][x]); + rows[y][x]._deleted = true; + + // Empty TR, remove it + if (!tr.hasChildNodes()) { + tr.parentNode.removeChild(tr); + + var lastCell = null; + for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) { + if (cellElm != lastCell && cellElm.rowSpan > 1) + cellElm.rowSpan--; + + lastCell = cellElm; + } + + if (tdElm.rowSpan > 1) + tdElm.rowSpan--; + } + } + } + } + + // Remove all but one bogus br + each(ed.dom.select('br', tdElm), function(e, i) { + if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus')) + ed.dom.remove(e); + }); + + break; + } + + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + inst.addVisual(tableElm); + inst.nodeChanged(); + } + + return true; + } + + // Pass to next handler in chain + return false; + } + }); + + // Register plugin + tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin); +})(); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/js/cell.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/js/cell.js new file mode 100644 index 0000000..feb7061 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/js/cell.js @@ -0,0 +1,259 @@ +tinyMCEPopup.requireLangPack(); + +var ed; + +function init() { + ed = tinyMCEPopup.editor; + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor') + + var inst = ed; + var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th"); + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style")); + + // Get table cell data + var celltype = tdElm.nodeName.toLowerCase(); + var align = ed.dom.getAttrib(tdElm, 'align'); + var valign = ed.dom.getAttrib(tdElm, 'valign'); + var width = trimSize(getStyle(tdElm, 'width', 'width')); + var height = trimSize(getStyle(tdElm, 'height', 'height')); + var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor')); + var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor')); + var className = ed.dom.getAttrib(tdElm, 'class'); + var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");; + var id = ed.dom.getAttrib(tdElm, 'id'); + var lang = ed.dom.getAttrib(tdElm, 'lang'); + var dir = ed.dom.getAttrib(tdElm, 'dir'); + var scope = ed.dom.getAttrib(tdElm, 'scope'); + + // Setup form + addClassesToList('class', 'table_cell_styles'); + TinyMCE_EditableSelects.init(); + + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.backgroundimage.value = backgroundimage; + formObj.width.value = width; + formObj.height.value = height; + formObj.id.value = id; + formObj.lang.value = lang; + formObj.style.value = ed.dom.serializeStyle(st); + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'valign', valign); + selectByValue(formObj, 'class', className, true, true); + selectByValue(formObj, 'celltype', celltype); + selectByValue(formObj, 'dir', dir); + selectByValue(formObj, 'scope', scope); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); +} + +function updateAction() { + var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0]; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + tdElm = ed.dom.getParent(el, "td,th"); + trElm = ed.dom.getParent(el, "tr"); + tableElm = ed.dom.getParent(el, "table"); + + ed.execCommand('mceBeginUndoLevel'); + + switch (getSelectValue(formObj, 'action')) { + case "cell": + var celltype = getSelectValue(formObj, 'celltype'); + var scope = getSelectValue(formObj, 'scope'); + + if (ed.getParam("accessibility_warnings")) { + if (celltype == "th" && scope == "") + var answer = confirm(ed.getLang('table_dlg.missing_scope', '', true)); + else + var answer = true; + + if (!answer) + return; + } + + updateCell(tdElm); + break; + + case "row": + var cell = trElm.firstChild; + + if (cell.nodeName != "TD" && cell.nodeName != "TH") + cell = nextCell(cell); + + do { + cell = updateCell(cell, true); + } while ((cell = nextCell(cell)) != null); + + break; + + case "all": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i colLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); + return false; + } else if (rowLimit && rows > rowLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); + return false; + } else if (cellLimit && cols * rows > cellLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); + return false; + } + + // Update table + if (action == "update") { + inst.execCommand('mceBeginUndoLevel'); + + dom.setAttrib(elm, 'cellPadding', cellpadding, true); + dom.setAttrib(elm, 'cellSpacing', cellspacing, true); + dom.setAttrib(elm, 'border', border); + dom.setAttrib(elm, 'align', align); + dom.setAttrib(elm, 'frame', frame); + dom.setAttrib(elm, 'rules', rules); + dom.setAttrib(elm, 'class', className); + dom.setAttrib(elm, 'style', style); + dom.setAttrib(elm, 'id', id); + dom.setAttrib(elm, 'summary', summary); + dom.setAttrib(elm, 'dir', dir); + dom.setAttrib(elm, 'lang', lang); + + capEl = inst.dom.select('caption', elm)[0]; + + if (capEl && !caption) + capEl.parentNode.removeChild(capEl); + + if (!capEl && caption) { + capEl = elm.ownerDocument.createElement('caption'); + + if (!tinymce.isIE) + capEl.innerHTML = '
'; + + elm.insertBefore(capEl, elm.firstChild); + } + + if (width && /(pt|em|cm)$/.test(width)) { + dom.setStyle(elm, 'width', width); + dom.setAttrib(elm, 'width', ''); + } else { + dom.setAttrib(elm, 'width', width, true); + dom.setStyle(elm, 'width', ''); + } + + // Remove these since they are not valid XHTML + dom.setAttrib(elm, 'borderColor', ''); + dom.setAttrib(elm, 'bgColor', ''); + dom.setAttrib(elm, 'background', ''); + + if (height) { + dom.setStyle(elm, 'height', height); + dom.setAttrib(elm, 'height', ''); + } + + if (background != '') + elm.style.backgroundImage = "url('" + background + "')"; + else + elm.style.backgroundImage = ''; + +/* if (tinyMCEPopup.getParam("inline_styles")) { + if (width != '') + elm.style.width = getCSSSize(width); + }*/ + + if (bordercolor != "") { + elm.style.borderColor = bordercolor; + elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; + elm.style.borderWidth = border == "" ? "1px" : border; + } else + elm.style.borderColor = ''; + + elm.style.backgroundColor = bgcolor; + elm.style.height = getCSSSize(height); + + inst.addVisual(); + + // Fix for stange MSIE align bug + //elm.outerHTML = elm.outerHTML; + + inst.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + + // Repaint if dimensions changed + if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) + inst.execCommand('mceRepaint'); + + tinyMCEPopup.close(); + return true; + } + + // Create new table + html += '/g, '>'); + + return ' ' + attrib + '="' + value + '"'; +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', ''); + var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = ""; + var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame; + var inst = tinyMCEPopup.editor, dom = inst.dom; + var formObj = document.forms[0]; + var elm = dom.getParent(inst.selection.getNode(), "table"); + + action = tinyMCEPopup.getWindowArg('action'); + + if (!action) + action = elm ? "update" : "insert"; + + if (elm && action != "insert") { + var rowsAr = elm.rows; + var cols = 0; + for (var i=0; i cols) + cols = rowsAr[i].cells.length; + + cols = cols; + rows = rowsAr.length; + + st = dom.parseStyle(dom.getAttrib(elm, "style")); + border = trimSize(getStyle(elm, 'border', 'borderWidth')); + cellpadding = dom.getAttrib(elm, 'cellpadding', ""); + cellspacing = dom.getAttrib(elm, 'cellspacing', ""); + width = trimSize(getStyle(elm, 'width', 'width')); + height = trimSize(getStyle(elm, 'height', 'height')); + bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor')); + bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor')); + align = dom.getAttrib(elm, 'align', align); + frame = dom.getAttrib(elm, 'frame'); + rules = dom.getAttrib(elm, 'rules'); + className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, '')); + id = dom.getAttrib(elm, 'id'); + summary = dom.getAttrib(elm, 'summary'); + style = dom.serializeStyle(st); + dir = dom.getAttrib(elm, 'dir'); + lang = dom.getAttrib(elm, 'lang'); + background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + formObj.caption.checked = elm.getElementsByTagName('caption').length > 0; + + orgTableWidth = width; + orgTableHeight = height; + + action = "update"; + formObj.insert.value = inst.getLang('update'); + } + + addClassesToList('class', "table_styles"); + TinyMCE_EditableSelects.init(); + + // Update form + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'frame', frame); + selectByValue(formObj, 'rules', rules); + selectByValue(formObj, 'class', className, true, true); + formObj.cols.value = cols; + formObj.rows.value = rows; + formObj.border.value = border; + formObj.cellpadding.value = cellpadding; + formObj.cellspacing.value = cellspacing; + formObj.width.value = width; + formObj.height.value = height; + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.id.value = id; + formObj.summary.value = summary; + formObj.style.value = style; + formObj.dir.value = dir; + formObj.lang.value = lang; + formObj.backgroundimage.value = background; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + // Disable some fields in update mode + if (action == "update") { + formObj.cols.disabled = true; + formObj.rows.disabled = true; + } +} + +function changedSize() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + +/* var width = formObj.width.value; + if (width != "") + st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : ""; + else + st['width'] = "";*/ + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBackgroundImage() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBorder() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + // Update border width if the element has a color + if (formObj.border.value != "" && formObj.bordercolor.value != "") + st['border-width'] = formObj.border.value + "px"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + + if (formObj.bordercolor.value != "") { + st['border-color'] = formObj.bordercolor.value; + + // Add border-width if it's missing + if (!st['border-width']) + st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px"; + } + + formObj.style.value = dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['width']) + formObj.width.value = trimSize(st['width']); + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } + + if (st['border-color']) { + formObj.bordercolor.value = st['border-color']; + updateColor('bordercolor_pick','bordercolor'); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/langs/en_dlg.js new file mode 100644 index 0000000..a33c987 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/langs/en_dlg.js @@ -0,0 +1,74 @@ +tinyMCE.addI18n('en.table_dlg',{ +general_tab:"General", +advanced_tab:"Advanced", +general_props:"General properties", +advanced_props:"Advanced properties", +rowtype:"Row in table part", +title:"Insert/Modify table", +width:"Width", +height:"Height", +cols:"Cols", +rows:"Rows", +cellspacing:"Cellspacing", +cellpadding:"Cellpadding", +border:"Border", +align:"Alignment", +align_default:"Default", +align_left:"Left", +align_right:"Right", +align_middle:"Center", +row_title:"Table row properties", +cell_title:"Table cell properties", +cell_type:"Cell type", +valign:"Vertical alignment", +align_top:"Top", +align_bottom:"Bottom", +bordercolor:"Border color", +bgcolor:"Background color", +merge_cells_title:"Merge table cells", +id:"Id", +style:"Style", +langdir:"Language direction", +langcode:"Language code", +mime:"Target MIME type", +ltr:"Left to right", +rtl:"Right to left", +bgimage:"Background image", +summary:"Summary", +td:"Data", +th:"Header", +cell_cell:"Update current cell", +cell_row:"Update all cells in row", +cell_all:"Update all cells in table", +row_row:"Update current row", +row_odd:"Update odd rows in table", +row_even:"Update even rows in table", +row_all:"Update all rows in table", +thead:"Table Head", +tbody:"Table Body", +tfoot:"Table Foot", +scope:"Scope", +rowgroup:"Row Group", +colgroup:"Col Group", +col_limit:"You've exceeded the maximum number of columns of {$cols}.", +row_limit:"You've exceeded the maximum number of rows of {$rows}.", +cell_limit:"You've exceeded the maximum number of cells of {$cells}.", +missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.", +caption:"Table caption", +frame:"Frame", +frame_none:"none", +frame_groups:"groups", +frame_rows:"rows", +frame_cols:"cols", +frame_all:"all", +rules:"Rules", +rules_void:"void", +rules_above:"above", +rules_below:"below", +rules_hsides:"hsides", +rules_lhs:"lhs", +rules_rhs:"rhs", +rules_vsides:"vsides", +rules_box:"box", +rules_border:"border" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/merge_cells.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/merge_cells.htm new file mode 100644 index 0000000..f2dcbec --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/merge_cells.htm @@ -0,0 +1,38 @@ + + + + {#table_dlg.merge_cells_title} + + + + + + + +
+
+ {#table_dlg.merge_cells_title} + + + + + + + + + +
{#table_dlg.cols}:
{#table_dlg.rows}:
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/row.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/row.htm new file mode 100644 index 0000000..4a709d3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/row.htm @@ -0,0 +1,161 @@ + + + + {#table_dlg.row_title} + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/table.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/table.htm new file mode 100644 index 0000000..74982fa --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/plugins/table/table.htm @@ -0,0 +1,193 @@ + + + + {#table_dlg.title} + + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
 
+
+ +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/about.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/about.htm new file mode 100644 index 0000000..4e73b14 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/about.htm @@ -0,0 +1,56 @@ + + + + {#advanced_dlg.about_title} + + + + + + + +
+
+

{#advanced_dlg.about_title}

+

Version: ()

+

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

+

Copyright © 2003-2008, Moxiecode Systems AB, All rights reserved.

+

For more information about this software visit the TinyMCE website.

+ +
+ Got Moxie? + Hosted By Sourceforge + Also on freshmeat +
+
+ +
+
+

{#advanced_dlg.about_loaded}

+ +
+
+ +

 

+
+
+ +
+
+
+
+ +
+
+ +
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/anchor.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/anchor.htm new file mode 100644 index 0000000..054cde5 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/anchor.htm @@ -0,0 +1,32 @@ + + + + {#advanced_dlg.anchor_title} + + + + + +
+ + + + + + + + +
{#advanced_dlg.anchor_title}
{#advanced_dlg.anchor_name}:
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/charmap.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/charmap.htm new file mode 100644 index 0000000..8ca0113 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/charmap.htm @@ -0,0 +1,54 @@ + + + + {#advanced_dlg.charmap_title} + + + + + + + + + + + + + + + + + +
{#advanced_dlg.charmap_title}
+ + + + + + + + + +
 
 
+
+ + + + + + + + + + + + + + + + +
HTML-Code
 
 
NUM-Code
 
+
+ + + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/color_picker.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/color_picker.htm new file mode 100644 index 0000000..4cab768 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/color_picker.htm @@ -0,0 +1,76 @@ + + + + {#advanced_dlg.colorpicker_title} + + + + + + +
+ + +
+
+
+ {#advanced_dlg.colorpicker_picker_title} +
+ + +
+ +
+ +
+
+
+
+ +
+
+ {#advanced_dlg.colorpicker_palette_title} +
+ +
+ +
+
+
+ +
+
+ {#advanced_dlg.colorpicker_named_title} +
+ +
+ +
+ +
+ {#advanced_dlg.colorpicker_name} +
+
+
+
+ +
+
+ +
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template.js new file mode 100644 index 0000000..eea384f --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template.js @@ -0,0 +1 @@ +(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID,explode=tinymce.explode;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s,v;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));if(s.skin_variant)DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(e){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var t=this,ed=t.editor,c,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});if(c){each(ed.getParam('theme_advanced_font_sizes',t.settings.theme_advanced_font_sizes,'hash'),function(v,k){c.add(k!=v?k:lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'mceFontSize'+v});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},''),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(v.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=(s['theme_advanced_container_'+c+'_align']||da).toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},''));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},''));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},''));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':' ');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(''+ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}()); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template_src.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template_src.js new file mode 100644 index 0000000..9a5b479 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/editor_template_src.js @@ -0,0 +1,1052 @@ +/** + * $Id: editor_template_src.js,v 1.1 2008/07/28 21:59:07 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('advanced'); + + tinymce.create('tinymce.themes.AdvancedTheme', { + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + link : ['link_desc', 'mceLink'], + unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, + + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], + + init : function(ed, url) { + var t = this, s, v; + + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); + + // Default settings + t.settings = s = extend({ + theme_advanced_path : true, + theme_advanced_toolbar_location : 'bottom', + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", + theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_advanced_toolbar_align : "center", + theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_advanced_font_sizes : "1,2,3,4,5,6,7", + theme_advanced_more_colors : 1, + theme_advanced_row_height : 23, + theme_advanced_resize_horizontal : 1, + theme_advanced_resizing_use_cookie : 1 + }, ed.settings); + + if ((v = s.theme_advanced_path_location) && v != 'none') + s.theme_advanced_statusbar_location = s.theme_advanced_path_location; + + if (s.theme_advanced_statusbar_location == 'none') + s.theme_advanced_statusbar_location = 0; + + // Init editor + ed.onInit.add(function() { + ed.onNodeChange.add(t._nodeChanged, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); + }); + + ed.onSetProgressState.add(function(ed, b, ti) { + var co, id = ed.id, tb; + + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); + + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); + } else { + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); + } + }); + + DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css")); + + if (s.skin_variant) + DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css")); + }, + + createControl : function(n, cf) { + var cd, c; + + if (c = cf.createControl(n)) + return c; + + switch (n) { + case "styleselect": + return this._createStyleSelect(); + + case "formatselect": + return this._createBlockFormats(); + + case "fontselect": + return this._createFontSelect(); + + case "fontsizeselect": + return this._createFontSizeSelect(); + + case "forecolor": + return this._createForeColorMenu(); + + case "backcolor": + return this._createBackColorMenu(); + } + + if ((cd = this.controls[n])) + return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); + }, + + execCommand : function(cmd, ui, val) { + var f = this['_' + cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + + return false; + }, + + _importClasses : function(e) { + var ed = this.editor, c = ed.controlManager.get('styleselect'); + + if (c.getLength() == 0) { + each(ed.dom.getClasses(), function(o) { + c.add(o['class'], o['class']); + }); + } + }, + + _createStyleSelect : function(n) { + var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { + title : 'advanced.style_select', + onselect : function(v) { + if (c.selectedValue === v) { + ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); + c.select(); + return false; + } else + ed.execCommand('mceSetCSSClass', 0, v); + } + }); + + if (c) { + each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) { + if (v) + c.add(t.editor.translate(k), v); + }); + + c.onPostRender.add(function(ed, n) { + Event.add(n.id + '_text', 'focus', t._importClasses, t); + Event.add(n.id + '_text', 'mousedown', t._importClasses, t); + }); + } + + return c; + }, + + _createFontSelect : function() { + var c, t = this, ed = t.editor; + + c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); + if (c) { + each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { + c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); + }); + } + + return c; + }, + + _createFontSizeSelect : function() { + var t = this, ed = t.editor, c, lo = [ + "1 (8 pt)", + "2 (10 pt)", + "3 (12 pt)", + "4 (14 pt)", + "5 (18 pt)", + "6 (24 pt)", + "7 (36 pt)" + ], fz = [8, 10, 12, 14, 18, 24, 36]; + + c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'}); + if (c) { + each(ed.getParam('theme_advanced_font_sizes', t.settings.theme_advanced_font_sizes, 'hash'), function(v, k) { + c.add(k != v ? k : lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'mceFontSize' + v}); + }); + } + + return c; + }, + + _createBlockFormats : function() { + var c, fmts = { + p : 'advanced.paragraph', + address : 'advanced.address', + pre : 'advanced.pre', + h1 : 'advanced.h1', + h2 : 'advanced.h2', + h3 : 'advanced.h3', + h4 : 'advanced.h4', + h5 : 'advanced.h5', + h6 : 'advanced.h6', + div : 'advanced.div', + blockquote : 'advanced.blockquote', + code : 'advanced.code', + dt : 'advanced.dt', + dd : 'advanced.dd', + samp : 'advanced.samp' + }, t = this; + + c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'}); + if (c) { + each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { + c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + }); + } + + return c; + }, + + _createForeColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_text_colors) + o.colors = v; + + o.title = 'advanced.forecolor_desc'; + o.cmd = 'ForeColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('forecolor', o); + + return c; + }, + + _createBackColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_background_colors) + o.colors = v; + + o.title = 'advanced.backcolor_desc'; + o.cmd = 'HiliteColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('backcolor', o); + + return c; + }, + + renderUI : function(o) { + var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; + + n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); + + if (!DOM.boxModel) + n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); + + n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); + n = tb = DOM.add(n, 'tbody'); + + switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { + case "rowlayout": + ic = t._rowLayout(s, tb, o); + break; + + case "customlayout": + ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); + break; + + default: + ic = t._simpleLayout(s, tb, o, p); + } + + n = o.targetNode; + + // Add classes to first and last TRs + nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8 + DOM.addClass(nl[0], 'mceFirst'); + DOM.addClass(nl[nl.length - 1], 'mceLast'); + + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'mceFirst'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); + }); + + if (DOM.get(s.theme_advanced_toolbar_container)) + DOM.get(s.theme_advanced_toolbar_container).appendChild(p); + else + DOM.insertAfter(p, n); + + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; + + if (e.nodeName == 'A') { + t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); + + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; + + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); + + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); + } +*/ + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + Event.add(DOM.add(p, 'a', {href : '#'}, ''), 'focus', function() {tinyMCE.get(ed.id).focus();}); + + if (s.theme_advanced_toolbar_location == 'external') + o.deltaHeight = 0; + + t.deltaHeight = o.deltaHeight; + o.targetNode = null; + + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, + + getInfo : function() { + return { + longname : 'Advanced theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, + + resizeBy : function(dw, dh) { + var e = DOM.get(this.editor.id + '_tbl'); + + this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); + }, + + resizeTo : function(w, h) { + var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; + + // Boundery fix box + w = Math.max(s.theme_advanced_resizing_min_width || 100, w); + h = Math.max(s.theme_advanced_resizing_min_height || 100, h); + w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); + h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); + + // Calc difference between iframe and container + dh = e.clientHeight - ifr.clientHeight; + + // Resize iframe and container + DOM.setStyle(ifr, 'height', h - dh); + DOM.setStyles(e, {width : w, height : h}); + }, + + destroy : function() { + var id = this.editor.id; + + Event.clear(id + '_resize'); + Event.clear(id + '_path_row'); + Event.clear(id + '_external_close'); + }, + + // Internal functions + + _simpleLayout : function(s, tb, o, p) { + var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; + + // Create toolbar container at top + if (lo == 'top') + t._addToolbars(tb, o); + + // Create external toolbar + if (lo == 'external') { + n = c = DOM.create('div', {style : 'position:relative'}); + n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); + DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); + n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); + etb = DOM.add(n, 'tbody'); + + if (p.firstChild.className == 'mceOldBoxModel') + p.firstChild.appendChild(c); + else + p.insertBefore(c, p.firstChild); + + t._addToolbars(etb, o); + + ed.onMouseUp.add(function() { + var e = DOM.get(ed.id + '_external'); + DOM.show(e); + + DOM.hide(lastExtID); + + var f = Event.add(ed.id + '_external_close', 'click', function() { + DOM.hide(ed.id + '_external'); + Event.remove(ed.id + '_external_close', 'click', f); + }); + + DOM.show(e); + DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); + + // Fixes IE rendering bug + DOM.hide(e); + DOM.show(e); + e.style.filter = ''; + + lastExtID = ed.id + '_external'; + + e = null; + }); + } + + if (sl == 'top') + t._addStatusBar(tb, o); + + // Create iframe container + if (!s.theme_advanced_toolbar_container) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + } + + // Create toolbar container at bottom + if (lo == 'bottom') + t._addToolbars(tb, o); + + if (sl == 'bottom') + t._addStatusBar(tb, o); + + return ic; + }, + + _rowLayout : function(s, tb, o) { + var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; + + dc = s.theme_advanced_containers_default_class || ''; + da = s.theme_advanced_containers_default_align || 'center'; + + each(explode(s.theme_advanced_containers || ''), function(c, i) { + var v = s['theme_advanced_container_' + c] || ''; + + switch (v.toLowerCase()) { + case 'mceeditor': + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + break; + + case 'mceelementpath': + t._addStatusBar(tb, o); + break; + + default: + a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(tb, 'tr'), 'td', { + 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da + }); + + to = cf.createToolbar("toolbar" + i); + t._addControls(v, to); + DOM.setHTML(n, to.renderHTML()); + o.deltaHeight -= s.theme_advanced_row_height; + } + }); + + return ic; + }, + + _addControls : function(v, tb) { + var t = this, s = t.settings, di, cf = t.editor.controlManager; + + if (s.theme_advanced_disable && !t._disabled) { + di = {}; + + each(explode(s.theme_advanced_disable), function(v) { + di[v] = 1; + }); + + t._disabled = di; + } else + di = t._disabled; + + each(explode(v), function(n) { + var c; + + if (di && di[n]) + return; + + // Compatiblity with 2.x + if (n == 'tablecontrols') { + each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { + n = t.createControl(n, cf); + + if (n) + tb.add(n); + }); + + return; + } + + c = t.createControl(n, cf); + + if (c) + tb.add(c); + }); + }, + + _addToolbars : function(c, o) { + var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a; + + a = s.theme_advanced_toolbar_align.toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a}); + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_advanced_buttons' + i + '_add']) + v += ',' + s['theme_advanced_buttons' + i + '_add']; + + if (s['theme_advanced_buttons' + i + '_add_before']) + v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_advanced_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_advanced_resizing && !tinymce.isOldWebKit) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'}); + + if (s.theme_advanced_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, o.cw) + 'px'; + + c.style.height = Math.max(10, o.ch) + 'px'; + DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_advanced_resizing_min_width || 100; + mih = s.theme_advanced_resizing_min_height || 100; + maw = s.theme_advanced_resizing_max_width || 0xFFFF; + mah = s.theme_advanced_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(DOM.doc, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_advanced_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(DOM.doc, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(DOM.doc, 'mousemove', mf); + Event.remove(DOM.doc, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, r.w + r.dx) + 'px'; + + c.style.height = Math.max(10, r.h + r.dy) + 'px'; + ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_advanced_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); + } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) + c.select('' + ed.queryCommandValue('FontSize')); + + if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; + } + } + + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); + + if (p.hasChildNodes()) { + p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); + } + }, + + // Commands gets called by execCommand + + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, + + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/anchor.htm', + width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceCharMap : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/charmap.htm', + width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceHelp : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/about.htm', + width : 480, + height : 380, + inline : true + }, { + theme_url : this.url + }); + }, + + _mceColorPicker : function(u, v) { + var ed = this.editor; + + v = v || {}; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/color_picker.htm', + width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), + close_previous : false, + inline : true + }, { + input_color : v.color, + func : v.func, + theme_url : this.url + }); + }, + + _mceCodeEditor : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/source_editor.htm', + width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), + height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), + inline : true, + resizable : true, + maximizable : true + }, { + theme_url : this.url + }); + }, + + _mceImage : function(ui, val) { + var ed = this.editor; + + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/image.htm', + width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), + height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceLink : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/link.htm', + width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), + height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceNewDocument : function() { + var ed = this.editor; + + ed.windowManager.confirm('advanced.newdocument', function(s) { + if (s) + ed.execCommand('mceSetContent', false, ''); + }); + }, + + _mceForeColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.fgColor, + func : function(co) { + t.fgColor = co; + t.editor.execCommand('ForeColor', false, co); + } + }); + }, + + _mceBackColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.bgColor, + func : function(co) { + t.bgColor = co; + t.editor.execCommand('HiliteColor', false, co); + } + }); + }, + + _ufirst : function(s) { + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + }); + + tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); +}()); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/image.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/image.htm new file mode 100644 index 0000000..bd92b00 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/image.htm @@ -0,0 +1,86 @@ + + + + {#advanced_dlg.image_title} + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+ x +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg new file mode 100644 index 0000000..b4c542d Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/icons.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/icons.gif new file mode 100644 index 0000000..ccac36f Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/img/icons.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/about.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/about.js new file mode 100644 index 0000000..277550f --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/about.js @@ -0,0 +1,72 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout('insertHelpIFrame();', 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += ''; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += ''; + html += '
' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
'; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = ''; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/anchor.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/anchor.js new file mode 100644 index 0000000..76f4f7d --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/anchor.js @@ -0,0 +1,37 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/charmap.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/charmap.js new file mode 100644 index 0000000..d9fd8d3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/charmap.js @@ -0,0 +1,325 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = ''; + var cols=-1; + + for (i=0; i' + + '' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + + html += '
'; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/color_picker.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/color_picker.js new file mode 100644 index 0000000..c1a65db --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/color_picker.js @@ -0,0 +1,253 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '
'; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '' + + ''; + + for (i=0; i' + + '' + + ''; + if ((i+1) % 18 == 0) + h += ''; + } + + h += '
'; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/link.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/link.js new file mode 100644 index 0000000..c8cb642 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/link.js @@ -0,0 +1,155 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (e == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/source_editor.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/source_editor.js new file mode 100644 index 0000000..a6235a3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent(); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en.js new file mode 100644 index 0000000..52989e3 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('en.advanced',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en_dlg.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en_dlg.js new file mode 100644 index 0000000..80e4941 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.advanced_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/link.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/link.htm new file mode 100644 index 0000000..b647eed --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/link.htm @@ -0,0 +1,64 @@ + + + + {#advanced_dlg.link_title} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png new file mode 100644 index 0000000..7dd5841 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif new file mode 100644 index 0000000..2eafd79 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000..85e31df Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif new file mode 100644 index 0000000..adfdddc Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif new file mode 100644 index 0000000..5bb90fd Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif new file mode 100644 index 0000000..ce4be63 Binary files /dev/null and b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif differ diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/source_editor.htm b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/source_editor.htm new file mode 100644 index 0000000..5f047dc --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/themes/advanced/source_editor.htm @@ -0,0 +1,32 @@ + + + + {#advanced_dlg.code_title} + + + + + +
+
{#advanced_dlg.code_title}
+ +
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/forum.slowtwitch.com/www/static/fileman/tinymce/tiny_mce.js b/site/forum.slowtwitch.com/www/static/fileman/tinymce/tiny_mce.js new file mode 100644 index 0000000..72087e8 --- /dev/null +++ b/site/forum.slowtwitch.com/www/static/fileman/tinymce/tiny_mce.js @@ -0,0 +1 @@ +var tinymce={majorVersion:'3',minorVersion:'1.0.1',releaseDate:'2008-06-18',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base,p,v;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;t.query=tinyMCEPreInit.query;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i=items.length){for(i=0;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv="";if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:if(isIE&&n==='name'&&e.nodeName==='A'){v=e.name;break;}v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'tabindex':if(v===32768)v='';break;case'maxlength':if(v===2147483647)v='';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='
'+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='
'+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/

<\/p>|]+)><\/p>|/gi,' 

');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/]+)>|

/g,'');h=h.replace(/<\/p>/g,'');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/'/g,''');h=h.replace(/]+)\/>|/gi,'');if(s.keep_values){if(/|\/\/\s*-->|\]\]>|-->)\s*$/g,'');return s;};h=h.replace(/]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='';return''+b+'';});h=h.replace(/]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return''+b+'';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE)u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='

'+o.content+'
';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

( | |\s|\u00a0|)<\/p>[\r\n]*|
[\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

'):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

<\\\/p>||

\\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

[\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
\\s*<\\\/p>|

\\s*
\\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
\\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
');aft=ed.dom.add(sn,se.element,null,'
');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y'); + tinymce.ScriptLoader.markDone(u); + } + } + }, + + pickColor : function(e, element_id) { + this.execCommand('mceColorPicker', true, { + color : document.getElementById(element_id).value, + func : function(c) { + document.getElementById(element_id).value = c; + + try { + document.getElementById(element_id).onchange(); + } catch (ex) { + // Try fire event, ignore errors + } + } + }); + }, + + openBrowser : function(element_id, type, option) { + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); + }, + + close : function() { + var t = this; + + // To avoid domain relaxing issue in Opera + function close() { + t.editor.windowManager.close(window); + tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup + }; + + if (tinymce.isOpera) + t.getWin().setTimeout(close, 0); + else + close(); + }, + + // Internal functions + + _restoreSelection : function() { + var e = window.event.srcElement; + + if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) + tinyMCEPopup.restoreSelection(); + }, + +/* _restoreSelection : function() { + var e = window.event.srcElement; + + // If user focus a non text input or textarea + if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') + tinyMCEPopup.restoreSelection(); + },*/ + + _onDOMLoaded : function() { + var t = this, ti = document.title, bm, h; + + // Translate page + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = t.editor.getParam('directionality',''); + document.body.innerHTML = t.editor.translate(h); + document.title = ti = t.editor.translate(ti); + document.body.style.display = ''; + + // Restore selection in IE when focus is placed on a non textarea or input element of the type text + if (tinymce.isIE) + document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); + + t.restoreSelection(); + t.resizeToInnerSize(); + + // Set inline title + if (!t.isWindow) + t.editor.windowManager.setTitle(window, ti); + else + window.focus(); + + if (!tinymce.isIE && !t.isWindow) { + tinymce.dom.Event._add(document, 'focus', function() { + t.editor.windowManager.focus(t.id) + }); + } + + // Patch for accessibility + tinymce.each(t.dom.select('select'), function(e) { + e.onkeydown = tinyMCEPopup._accessHandler; + }); + + // Call onInit + // Init must be called before focus so the selection won't get lost by the focus call + tinymce.each(t.listeners, function(o) { + o.func.call(o.scope, t.editor); + }); + + // Move focus to window + if (t.getWindowArg('mce_auto_focus', true)) { + window.focus(); + + // Focus element with mceFocus class + tinymce.each(document.forms, function(f) { + tinymce.each(f.elements, function(e) { + if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) { + e.focus(); + return false; // Break loop + } + }); + }); + } + + document.onkeyup = tinyMCEPopup._closeWinKeyHandler; + }, + + _accessHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 13 || e.keyCode == 32) { + e = e.target || e.srcElement; + + if (e.onchange) + e.onchange(); + + return tinymce.dom.Event.cancel(e); + } + }, + + _closeWinKeyHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 27) + tinyMCEPopup.close(); + }, + + _wait : function() { + var t = this, ti; + + if (tinymce.isIE && document.location.protocol != 'https:') { + // Fake DOMContentLoaded on IE + document.write(' + +

+ + + + +
+
+
+ + + +
+
+
+
+
diff --git a/site/forum.slowtwitch.com/www/survey/include_common_footer.php b/site/forum.slowtwitch.com/www/survey/include_common_footer.php new file mode 100644 index 0000000..f35360f --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/include_common_footer.php @@ -0,0 +1,78 @@ +
+
+
+
+ + + +
+
+
+ + + + diff --git a/site/forum.slowtwitch.com/www/survey/include_common_head.php b/site/forum.slowtwitch.com/www/survey/include_common_head.php new file mode 100644 index 0000000..cda0af2 --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/include_common_head.php @@ -0,0 +1,86 @@ + + + + + +<? echo $site_name; ?>: <? echo $pagetitle; ?> + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/survey/include_status.php b/site/forum.slowtwitch.com/www/survey/include_status.php new file mode 100644 index 0000000..19267c4 --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/include_status.php @@ -0,0 +1,41 @@ + + + + + + + + + + +Home   "; +//echo "About   "; +//echo "Contact   "; + +if(is_logged_in($user)){ +$username = base64_decode($_SESSION['user']); +//echo "Welcome, $username:
Log out"; +}else{ +//echo "Register   "; +//echo "    "; +//echo ""; +//echo "You are not logged in:
Log in | Register"; +} +?> + +Survey Results"); } + } **/ + +?> + + + + + diff --git a/site/forum.slowtwitch.com/www/survey/include_survey.php b/site/forum.slowtwitch.com/www/survey/include_survey.php new file mode 100644 index 0000000..ed98c95 --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/include_survey.php @@ -0,0 +1,33 @@ +"); //onSubmit=\"return confirm('Are you ready to submit your answers?');\" + +while($question = mysql_fetch_array($questionList)) { + echo ("
\n"); + echo ("".$question['Question_Name'].":
\n"); + echo("".$question['Question_Description']."
\n"); + $answerList = mysql_query("SELECT * FROM gforum_SurveyAnswer WHERE Question_ID_FK = ". $question['Question_ID']." ORDER BY Answer_Name;"); + while($answer = mysql_fetch_array($answerList)) { + $temp = "qid".$question['Question_ID']; + $selected = ""; + if ($answer['Answer_ID'] == $_POST[$temp]) { $selected = "checked"; } + echo ("".$answer['Answer_Name']."
\n"); + } + //echo ("No Vote
"); + echo ("
\n"); +} + +$ip = $_SERVER['REMOTE_ADDR']; +echo ("\n"); +echo ("\n"); + +echo ("

"); +echo (""); + +?> \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/survey/include_survey_confirm.php b/site/forum.slowtwitch.com/www/survey/include_survey_confirm.php new file mode 100644 index 0000000..053eaa4 --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/include_survey_confirm.php @@ -0,0 +1,43 @@ +"); //onSubmit=\"return confirm('Are you ready to submit your answers?');\" + +echo ("

Please review your answers before submitting.

"); + +$tripwire = 0; +foreach($_POST as $questionID => $answerID) { + $questionID = ltrim($questionID,'qid'); + if (is_numeric($questionID)) { + $question = mysql_fetch_array(mysql_query("SELECT * FROM gforum_SurveyQuestion WHERE Question_ID = ".$questionID." LIMIT 1;")) or die(mysql_error()); + $answer = mysql_fetch_array(mysql_query("SELECT * FROM gforum_SurveyAnswer WHERE Answer_ID = ".$answerID." LIMIT 1;")) or die(mysql_error()); + echo ("
\n"); + echo ("".$question['Question_Name'].": \n"); + echo ($answer['Answer_Name']."
\n"); + echo ("\n"); + echo ("
\n"); + $tripwire = 1; + } +} + +if ($tripwire == 0) { + Header("Location: index.php?empty_set=1"); + die(); +} + +echo ("\n"); +echo ("\n"); + +echo (" +
"); + +foreach($_POST as $questionID => $answerID) { + echo("\n"); +} +echo(""); +echo ("
"); + +?> \ No newline at end of file diff --git a/site/forum.slowtwitch.com/www/survey/index.php b/site/forum.slowtwitch.com/www/survey/index.php new file mode 100644 index 0000000..d2a1755 --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/index.php @@ -0,0 +1,98 @@ + + + + + + +
+ + +
+ + + + + +

The Slowtwitch Annual Industry Awards 2008 Reader Survey

+ +
+ +

Directions For Taking the Survey

+

You must be logged in with a Slowtwitch forum username in order to complete this survey. If you are a forum user, and you use the "remember me" feature on the forum (requires cookies), you should be automatically logged in here. If you are not logged in, please follow the "Login" link to your left in order to do so. You will be redirected back to this page.

If you do not have a forum account, you may follow the "Register" link to your left to create one. Once you have created a forum username, please return to this page.

You do not have to answer all the questions, but you cannot come back and vote on questions you leave blank. If you don't have an opinion about a particular category, just leave that question blank. If you select an answer and then decide that you would rather not vote on that particular category, just click the reset button at the bottom to clear the form. This will reset all your answers, so please go back and complete only the categories you wish to vote on.

+

You will have a chance to confirm (and reconsider) your selections before submitting them to the official record.

+

There are no "write-in" options. If you disagree with our selections, you can voice that concern to us via email or on the forum. Your selections are limited to the choices here. You may either choose from among those choices or exercise your write to expression through abstention if you don't like our options.

This survey is based on your opinions; you do not need to have used every (or even any) of the products in a category to vote.

+

If you have a suggestion or critique that might allow us to better reach our aspirations, please contact us. Otherwise, please move ahead to the survey.

+

Awards Presentation

+

The presentation of these awards will take place during the week of September 22nd live (online) from the Interbike tradeshow in Las Vegas, NV.

+

Privacy Policy

+

The survey results are entirely anonymous. Your user id will be logged only to record your participation and will in no way be linked to your responses.

+ +
+
+ +

Voting is now closed.

+ +Welcome, $username [if this is not you, click here to log out]. Thank you for participating.

\n"; + if ($_GET['empty_set'] == 1) { + echo ("

You have not completed any categories.

"); + } + if ($_POST['uid'] && $_POST['edit'] != true) { + include("include_survey_confirm.php"); + } else { include("include_survey.php"); } + } else { + if ($_GET['thank_you'] == 1) { + echo ("

Thank you for completing our 2008 survey. Please check back later for the results. Click here to Log out

"); + } else { + echo ("

You have already taken this survey. Please check back later for the results.

"); + } + } +}else{ + echo (""); + echo ("

You are not logged in. Please Log in or Register

"); +}*/ +?> + +
+ +
+

Survey Results

"); include("results.php"); } + } +?> +
+ + + +
+ +
+ + + + diff --git a/site/forum.slowtwitch.com/www/survey/javascript.js b/site/forum.slowtwitch.com/www/survey/javascript.js new file mode 100644 index 0000000..066f17a --- /dev/null +++ b/site/forum.slowtwitch.com/www/survey/javascript.js @@ -0,0 +1,123 @@ +function validateEmail(emailAddress) { + var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress); + return match; +} + + + +function CheckRegisterForm(RegisterForm) + { + if (RegisterForm.username.value == "" ) { alert( "Please choose a username!" ); + RegisterForm.username.focus(); + return false; } + + if (RegisterForm.password.value == "" ) { alert( "Please choose a password!" ); + RegisterForm.password.focus(); + return false; } + + if (RegisterForm.email.value == "" ) { alert( "Please enter your email address." ); + RegisterForm.email.focus(); + return false; } + + checkEmail = RegisterForm.email.value + if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) + {alert("Your emails address is invalid!."); + RegisterForm.email.focus(); + return false; } + + + // return true; +} + + +function CheckTellForm(tellform) + { + if (tellform.name.value == "" ) { alert( "ĮáŅĖĮÁ ÃÏÎá ĮáÅÓã ČĮáßĮãá" ); + tellform.name.focus(); + return false; } + + if (tellform.email.value == "" ) { alert( "ÃÏÎá ĮáČŅíÏ ĮáÅáßĘŅæäí" ); + tellform.email.focus(); + return false; } + + checkEmail = tellform.email.value + if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) + {alert("ĮáČŅíÏ ĮáÅáßĘŅæäí ÎØÃ!."); + tellform.email.focus(); + return false; } + + + if (tellform.fname.value == "" ) { alert( "ÃÏÎá ÅÓã ÕÏíÞß" ); + tellform.fname.focus(); + return false; } + + + + if (tellform.femail.value == "" ) { alert( "ÃÏÎá ĮáČŅíÏ ĮáĮáßĘŅæäí ĮáÎĮÕ ČÕÏíÞß" ); + tellform.femail.focus(); + return false; } + + checkEmail = tellform.femail.value + if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) + {alert("ĮáČŅíÏ ĮáÅáßĘŅæäí ÎØÃ!."); + tellform.femail.focus(); + return false; } + + + + // return true; +} + + +var newwindow; +function pop(url) +{ + newwindow=window.open(url,'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=1, menubars=0, resizable=0, width=500, height=400'); + if (window.focus) {newwindow.focus()} +} + + function popimg(url) + { + newwindow=window.open(url,'name','height=500,width=650,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); + if (window.focus) {newwindow.focus()} + } + + + + +', + 'main_site_url' => 'http://www.slowtwitch.com', + 'mixed_calendar_loop' => 'sub { + my ($user_id, $username) = @_; + my (@racetags, @race_loop); + + my $db = $DB->table("User"); + my $sth = $db->select(["user_racetags"], { user_username => $username }) or die($GT::SQL::error); + my ($racetags) = $sth->fetchrow_array; + + if ($racetags) { + $racetags =~ s/\s*|^,//g; + $racetags =~ s/,$//g; + + @racetags = split (\',\',$racetags); + $db = $DB->table("Triathlons"); + + my $cond = GT::SQL::Condition->new(\'uid\',\'=\', \@racetags); + $db->select_options(\'ORDER BY date ASC\'); + my $sth = $db->select($cond) or die $GT::SQL::error; + + while (my $result = $sth->fetchrow_hashref) { + $result->{racedate} = GT::Date::date_transform($result->{date}, \'%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%\', \'%ddd% %mmm% %dd% %yyyy%\'); + + push @race_loop, { + name => $result->{name}, + location => "$result->{city}, $result->{state}", + racedate => "$result->{racedate}", + url => "http://forum.slowtwitch.com/racecalendar/$result->{statetag}/$result->{nametag}-$result->{uid}.html", + date => $result->{date}, + }; + } + } + + my $sth = $DB->table("UserPersonalRace", "PersonalRace")->select({ user_id_fk => $user_id }); + while (my $row = $sth->fetchrow_hashref) { + my $added; + for (my $i = 0; $i < @race_loop; ++$i) { + if (GT::Date::date_is_smaller($row->{pr_date}, $race_loop[$i]->{date})) { + my $racedate = GT::Date::date_transform($row->{pr_date}, \'%yyyy%-%mm%-%dd%\', \'%ddd% %mmm% %dd% %yyyy%\'); + splice @race_loop, $i, 0, { + id => $row->{pr_id}, + name => $row->{pr_name}, + location => "$row->{pr_city}, $row->{pr_state}, $row->{pr_country}", + racedate => $racedate, + url => $row->{pr_url}, + date => $row->{pr_date}, + user_race=> 1 + }; + $added = 1; + last; + } + } + unless ($added) { + my $racedate = GT::Date::date_transform($row->{pr_date}, \'%yyyy%-%mm%-%dd%\', \'%ddd% %mmm% %dd% %yyyy%\'); + push @race_loop, { + id => $row->{pr_id}, + name => $row->{pr_name}, + location => "$row->{pr_city}, $row->{pr_state}, $row->{pr_country}", + racedate => $racedate, + url => $row->{pr_url}, + date => $row->{pr_date}, + user_race=> 1 + }; + } + } + + + return { race_loop => \@race_loop }; +}', + 'quantcast' => ' + + + +', + 'site_description' => '', + 'slowtwitch_retailer_loop' => 'sub { + my $username = shift; + my @shoptags; + my $db = $DB->table("User"); + my $sth = $db->select(["user_shoptags"], { user_username => $username }) or die($GT::SQL::error); + my ($shoptags) = $sth->fetchrow_array; + if ($shoptags) { + $shoptags =~ s/\s*|^,//g; + $shoptags =~ s/,$//g; + my @shop_loop; + + @shoptags = split (\',\',$shoptags); + $db = $DB->table("Retailers"); + + my $cond = GT::SQL::Condition->new(\'retailer_id\',\'=\', \@shoptags); + $db->select_options(\'ORDER BY retailer_name ASC\'); + my $sth = $db->select($cond); + + while (my $result = $sth->fetchrow_hashref) { + push @shop_loop, { + name => $result->{retailer_name}, + location => "$result->{retailer_city}, $result->{retailer_state}", + url => "http://www.slowtwitch.com/retailers/individual.php?retailer_id=$result->{retailer_id}", + }; + } + return { shop_loop => \@shop_loop }; + } +}', + 'ticker_flashvars_loop' => 'sub { + my @flashvars_links_loop; + my $db = $DB->table(\'Ticker\'); + my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM gforum_Ticker\'); + while (my $result = $sth->fetchrow_hashref) { + $result->{ticker_link} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $result->{ticker_text} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + push @flashvars_links_loop, { + coupon => $result->{ticker_text}, + url => $result->{ticker_link} + }; + } + + return { \'flashvars_links_loop\' => \@flashvars_links_loop }; +}', + 'ticker_loop' => 'sub { + my @coupon_links_loop; + my $db = $DB->table(\'Forum\'); + my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM glinks_Ticker ORDER BY ticker_text ASC\'); + while (my $result = $sth->fetchrow_hashref) { + push @coupon_links_loop, { + coupon => $result->{ticker_text}, + url => $result->{ticker_link} + }; + } + + return { \'coupon_links_loop\' => \@coupon_links_loop }; +}', + 'tri_search' => ' + +' +}; + +# vim:syn=perl:ts=4:noet diff --git a/site/forum/language.txt b/site/forum/language.txt new file mode 100644 index 0000000..d6a99a7 --- /dev/null +++ b/site/forum/language.txt @@ -0,0 +1,270 @@ +# This file contains a perl hash of the default language variables for the +# 'default' template set. You should not edit this file manually, but use the +# language editor in the admin panel instead. Changes will be saved in the +# "local" directory. +{ + 'ACTION_BAD' => 'No such action \'%s\'', + 'ACTION_MUST_LOGIN' => 'Guests are not authorized to access that page. Please login as a user', + 'ACTION_PERMISSION_DENIED' => 'You are not authorized to access that page', + 'ATTACHMENT_COUNT_EXCEEDED' => 'The maximum number of attachments has been exceeded', + 'ATTACHMENT_DOES_NOT_EXIST' => 'The attachment you attempted to download does not exist', + 'ATTACHMENT_FAILED' => 'An error occurred while uploading your attachment: %s', + 'ATTACHMENT_FILTERED' => 'You are not allowed to upload files matching \'%s\'', + 'ATTACHMENT_INSERT_FAILED' => 'Unable to insert your attachment into the database: %s', + 'ATTACHMENT_LIMIT_EXCEEDED' => 'The total attachment size limit has been exceeded', + 'ATTACHMENT_NOT_ALLOWED_GUEST' => 'Guests do not have permission to upload attachments to this forum', + 'ATTACHMENT_NOT_ALLOWED' => 'You have attempted to upload an attachment, but attachments are disabled', + 'ATTACHMENT_SYSTEM_ERROR' => 'A system error occurred while attempting to save your attachment: %s', + 'ATTACHMENT_TOO_LARGE' => 'The attachment exceeds the maximum attachment size (%s)', + 'BAD_REFERER' => 'A valid REFERER is required to view this page', + 'BAN_ERROR_ADMIN' => 'Unable to enable/disable user: You cannot alter administrator accounts', + 'BAN_FORUM_REMOVED' => '%s forum ban(s) have been removed', + 'BAN_IP_ADDED' => 'IP address \'%s\' has been added to the banned IP list', + 'BAN_USER_DISABLED' => 'The \'%s\' user account has been disabled.', + 'BAN_USER_ENABLED' => 'The \'%s\' user account is now enabled.', + 'CATEGORY_DOES_NOT_EXIST' => 'The category you attempted to access does not exist', + 'CATEGORY_NOT_FOUND' => 'Category not found!', + 'DATE_DAY_1' => 'Sunday', + 'DATE_DAY_2' => 'Monday', + 'DATE_DAY_3' => 'Tuesday', + 'DATE_DAY_4' => 'Wednesday', + 'DATE_DAY_5' => 'Thursday', + 'DATE_DAY_6' => 'Friday', + 'DATE_DAY_7' => 'Saturday', + 'DATE_DAY_SHORT_1' => 'Sun', + 'DATE_DAY_SHORT_2' => 'Mon', + 'DATE_DAY_SHORT_3' => 'Tue', + 'DATE_DAY_SHORT_4' => 'Wed', + 'DATE_DAY_SHORT_5' => 'Thu', + 'DATE_DAY_SHORT_6' => 'Fri', + 'DATE_DAY_SHORT_7' => 'Sat', + 'DATE_FORMAT_DATE' => '%mmm% %d%, %yyyy%', + 'DATE_FORMAT' => '%mmm% %d%, %yyyy%, %h%:%MM% %tt%', + 'DATE_FORMAT_TIME' => '%h%:%MM% %tt%', + 'DATE_MONTH_10' => 'October', + 'DATE_MONTH_11' => 'November', + 'DATE_MONTH_12' => 'December', + 'DATE_MONTH_1' => 'January', + 'DATE_MONTH_2' => 'February', + 'DATE_MONTH_3' => 'March', + 'DATE_MONTH_4' => 'April', + 'DATE_MONTH_5' => 'May', + 'DATE_MONTH_6' => 'June', + 'DATE_MONTH_7' => 'July', + 'DATE_MONTH_8' => 'August', + 'DATE_MONTH_9' => 'September', + 'DATE_MONTH_SHORT_10' => 'Oct', + 'DATE_MONTH_SHORT_11' => 'Nov', + 'DATE_MONTH_SHORT_12' => 'Dec', + 'DATE_MONTH_SHORT_1' => 'Jan', + 'DATE_MONTH_SHORT_2' => 'Feb', + 'DATE_MONTH_SHORT_3' => 'Mar', + 'DATE_MONTH_SHORT_4' => 'Apr', + 'DATE_MONTH_SHORT_5' => 'May', + 'DATE_MONTH_SHORT_6' => 'Jun', + 'DATE_MONTH_SHORT_7' => 'Jul', + 'DATE_MONTH_SHORT_8' => 'Aug', + 'DATE_MONTH_SHORT_9' => 'Sep', + 'DATE_UNIT_DAY_RECURRING' => 'day', + 'DATE_UNIT_DAY' => '%s day', + 'DATE_UNIT_DAYS_RECURRING' => '%s days', + 'DATE_UNIT_DAYS' => '%s days', + 'DATE_UNIT_MONTH_RECURRING' => 'month', + 'DATE_UNIT_MONTH' => '%s month', + 'DATE_UNIT_MONTHS_RECURRING' => '%s months', + 'DATE_UNIT_MONTHS' => '%s months', + 'DATE_UNIT_WEEK_RECURRING' => 'week', + 'DATE_UNIT_WEEKS_RECURRING' => '%s weeks', + 'DATE_UNIT_WEEKS' => '%s weeks', + 'DATE_UNIT_WEEK' => '%s week', + 'DATE_UNIT_YEAR_RECURRING' => 'year', + 'DATE_UNIT_YEARS_RECURRING' => '%s years', + 'DATE_UNIT_YEARS' => '%s years', + 'DATE_UNIT_YEAR' => '%s year', + 'FILESIZE_BYTES' => 'B', + 'FILESIZE_KILOBYTES' => 'KB', + 'FILESIZE_MEGABYTES' => 'MB', + 'FORUM_DOES_NOT_EXIST' => 'The forum you attempted to access does not exist', + 'FORUM_NOT_FOUND' => 'Forum not found!', + 'FORUM_STYLE_BOTH' => 'Markup and HTML', + 'FORUM_STYLE_HTML' => 'HTML', + 'FORUM_STYLE_MARKUP' => 'Markup', + 'FORUM_STYLE_PLAIN' => 'Plain Text Only', + 'FORUM_SUBSCRIBED' => 'You have subscribed to %s.', + 'FORUM_UNSUBSCRIBED' => 'You have been unsubscribed from %s.', + 'HELP_TEXT_ENTER_USERNAME' => 'Start typing a user name...', + 'IP_INVALID' => 'The IP address you provided (%s) is invalid.', + 'LOGIN_DISABLED' => 'Your account is not enabled', + 'LOGIN_FAILED' => 'You could not be logged in. Perhaps you tried to log in with cookies, but cookies are disabled?', + 'LOGIN_INVALID_USERNAME_PASSWORD' => 'Invalid username/password combination entered', + 'LOGIN_NOT_VALIDATED' => 'Your signup has not been validated', + 'LOGIN_PAYMENT_EXPIRED' => 'Your account has expired', + 'MESSAGE_DOES_NOT_EXIST' => 'The message you attempted to access does not exist', + 'MESSAGE_GET_METHOD_DENIED' => 'Unable to send message with a GET method', + 'MESSAGE_SMTP_SERVER_OR_MAIL_PATH_NOT_SET' => 'No mail path or SMTP server set!', + 'NO_SUBJECT' => '', + 'PAGE_NOT_FOUND' => 'Page not found!', + 'PAGING_OF' => ' of ', + 'PAGING_VIEW_ALL' => 'View All', + 'PAYLOG_PayPal_address' => 'The payment is pending because your customer did not include a confirmed shipping address and you, the merchant, have your Payment Receiving Preferences set such that you want to manually accept or deny each of these payments. To change your preference, go to the "Preferences" seciont of your "Profile"', + 'PAYLOG_PayPal_echeck' => 'The payment is pending because it was made by an eCheck, which has not yet cleared', + 'PAYLOG_PayPal_intl' => 'The payment is pending because you, the merchant, hold an international account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview', + 'PAYLOG_PayPal_multi_currency' => 'You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment', + 'PAYLOG_PayPal_other' => 'The payment is pending for an "other" reason. For more information, contact PayPal customer service', + 'PAYLOG_PayPal_SUBSC_ACCEPTED' => 'The recurring PayPal payment has been accepted.', + 'PAYLOG_PayPal_unilateral' => 'The payment is pending because it was made to an e-mail address that is not yet registered or confirmed', + 'PAYLOG_PayPal_upgrade' => 'The payment is pending because it was made via credit card and you, the merchant, must upgrade your account to Business or Premier status in order to receive the funds', + 'PAYLOG_PayPal_verify' => 'The payment is pending because you, the merchant, are not yet verified. You must verify your account before you can accept this payment', + 'PAYMENT_CURRENCY_FORMAT' => '$%s', + 'PAYMENT_REMOTE_APPROVED' => 'Approved remote payment received from %s', + 'PAYMENT_REMOTE_CANCELLED' => 'Cancelled payment notification received from %s', + 'PAYMENT_REMOTE_INVALIDIP' => 'A payment notification was received from %s with an unauthorized IP address.', + 'PAYMENT_REMOTE_INVALIDPW' => 'A payment notification was received from %s with an invalid password.', + 'PAYMENT_REMOTE_RECURRING_ACCEPTED' => 'Recurring payment notification received from %s', + 'PAYMENT_REMOTE_RECURRING_DECLINED' => 'Declined payment notification received from %s', + 'PAYMENT_REMOTE_REFUND' => 'Notification of payment refund received from %s', + 'PAYMENT_TYPE_AMEX' => 'American Express', + 'PAYMENT_TYPE_DELTA' => 'Delta', + 'PAYMENT_TYPE_DINERS' => 'Diners Club', + 'PAYMENT_TYPE_DISC' => 'Discover', + 'PAYMENT_TYPE_EURO' => 'Eurocard', + 'PAYMENT_TYPE_JCB' => 'JCB', + 'PAYMENT_TYPE_MC' => 'MasterCard', + 'PAYMENT_TYPE_NOVA' => 'Nova', + 'PAYMENT_TYPE_PAYPAL' => 'PayPal', + 'PAYMENT_TYPE_SOLO' => 'Solo', + 'PAYMENT_TYPE_SWITCH' => 'Switch', + 'PAYMENT_TYPE_VISA_DEBIT' => 'VISA Debit', + 'PAYMENT_TYPE_VISA' => 'VISA', + 'PAYMENT_UNLIMITED' => 'Unlimited', + 'POST_ANONYMOUS_DISABLED' => 'Guest posting is not enabled', + 'POST_BAD_FORUM' => 'Invalid forum ID entered', + 'POST_BAD_POST' => 'Invalid post ID entered', + 'POST_DELETED' => '', + 'POST_DOES_NOT_EXIST' => 'The post you attempted to access does not exist', + 'POST_EDIT_TIME_EXPIRED' => 'The edit/delete time for the post has expired', + 'POSTERR_BAD_ALIAS' => 'Unable to post: Invalid username alias: %s', + 'POSTERR_BAD_GUEST' => 'Unable to post: Invalid guest username: %s', + 'POSTERR_NO_SUBJECT' => 'Unable to post: You must enter a subject', + 'POSTERR_OTHER' => 'Unable to post: %s', + 'POSTICON_hot_new_no_replies' => 'Hot thread - New post', + 'POSTICON_hot_new_with_new_replies' => 'Hot thread - New post, new replies', + 'POSTICON_hot_new_with_replies' => 'Hot thread - New post with replies', + 'POSTICON_hot_no_replies' => 'Hot thread - Single post', + 'POSTICON_hot_with_new_replies' => 'Hot thread - New replies', + 'POSTICON_hot_with_replies' => 'Hot thread - Post has replies', + 'POSTICON_new_no_replies' => 'New post', + 'POSTICON_new_with_new_replies' => 'New post, new replies', + 'POSTICON_new_with_replies' => 'New post with replies', + 'POSTICON_no_replies' => 'Post', + 'POSTICON_with_new_replies' => 'New replies', + 'POSTICON_with_replies' => 'Post with replies', + 'POST_IS_DELETED' => 'The post you attempted to access has been deleted', + 'POST_LOCKED' => 'That thread has been locked', + 'POST_NOT_FOUND' => 'Post not found!', + 'POST_REGARDING' => 'Re: ', + 'POST_REMOVE_NOT_MODERATOR' => 'Only moderators are permitted to completely remove posts', + 'POST_REPORTS_DISABLED' => 'Post reports have been disabled.', + 'POST_REPORTS_ENTER_MESSAGE' => 'Please enter message!', + 'POST_REPORTS_INVALID_POST_ID' => 'Invalid post id!', + 'POST_REPORTS_LOCKED_TILL' => 'Locked till %s', + 'POST_REPORTS_PRIVATE_MESSAGE_SELECT_USERS' => 'Please select at least one message recipient!', + 'POST_REPORTS_SUBJECT' => 'Reported Post: %s', + 'PROFILE_INVALID_DATA' => 'Invalid data for the %s field', + 'PROFILE_NOT_FOUND' => 'Member not found!', + 'PROFILE_PASSWORD_INCORRECT' => 'The password you entered does not match your current password', + 'PROFILE_PASSWORDS_DONT_MATCH' => 'The passwords you entered do not match', + 'REQUEST_POST_ONLY' => '%s method not allowed for this action', + 'RSS_CATEGORY_DESCRIPTION' => 'most recent %s in this category', + 'RSS_FAVOURITES_DESCRIPTION' => 'most popular %s', + 'RSS_FAV_USERS_DESCRIPTION' => 'most recent users who have marked these %s as favourites', + 'RSS_FORUM_DESCRIPTION' => 'most recent %s in this forum', + 'RSS_GLOBAL_DESCRIPTION' => 'most recent %s across all forums', + 'RSS_POST_DESCRIPTION' => 'most recent %s in this thread', + 'RSS_TAGS_DESCRIPTION' => 'most recent %s tagged with %s', + 'RSS_TAGS_USER_DESCRIPTION' => 'most recent %s tagged by user with %s', + 'RSS_USER_DESCRIPTION' => 'most recent %s by %s', + 'RSS_USER_FAVS_DESCRIPTION' => 'most recent %s marked as favourites by %s', + 'SEARCH_NO_FORUMS' => 'You did not select any forums to search, or there are no forums available', + 'SEARCH_NO_RESULTS' => 'Your search did not return any results', + 'SEARCH_NO_TERM' => 'No search term specified', + 'SEO_COULDNT_CALL_DATA_FUNCTION' => 'Couldn\'t call the data function for this type ("%s")!', + 'SEO_INVALID_URL_TYPE' => 'Invalid URL type specified ("%s")!', + 'SIGNUP_EMAIL_BANNED' => 'The e-mail address \'%s\' has been restricted', + 'SIGNUP_EMAIL_EXISTS' => 'The e-mail address \'%s\' has already been used with another username: %s', + 'SIGNUP_EMAIL_VALIDATION_FAILED' => 'Unable to send validation e-mail: %s', + 'SIGNUP_INVALID_PAYMENT' => 'You selected an invalid payment', + 'SIGNUP_NO_EMAIL' => 'You did not enter a valid e-mail address', + 'SIGNUP_NO_PASSWORD' => 'You did not enter a password', + 'SIGNUP_NO_PAYMENT' => 'You did not select a payment', + 'SIGNUP_NO_USERNAME' => 'You did not enter a username', + 'SIGNUP_PASSWORDS_DONT_MATCH' => 'The passwords you entered do not match', + 'SOCIAL_MEDIA_HTTP_ERROR' => 'Couldn\'t fetch feed (%s)!', + 'SOCIAL_MEDIA_ITEMS_ERROR' => 'Feed doesn\'t conatain any items (%s)!', + 'SOCIAL_MEDIA_RSS_PARSE_ERROR' => 'Couldn\'t parse feed (%s)!', + 'TAG_NOT_FOUND' => 'Tag not found!', + 'TAGS_NOT_ATTACHED' => 'These tags are not yet attached to this post!', + 'THREAD_DOES_NOT_EXIST' => 'The thread you attempted to access does not exist', + 'TIMEZONE_ERROR' => 'An error occurred while trying to contact the server', + 'TIMEZONE_LOADING' => 'Getting local time...', + 'TOOLTIP_FLICKR_IDENTIFIER' => 'The number following "id=" in the url for your Flickr RSS feed.', + 'TOOLTIP_LATITUDE' => 'Enter the latitude of your current location in decimal form (49.2810, for example) to have a Google Maps display of your location appear in your profile. Click the "Find" link below to determine this value.', + 'TOOLTIP_LONGITUDE' => 'Enter the longitude of your current location in decimal form (-123.1084, for example) to have a Google Maps display of your location appear in your profile. Click the "Find" link below to determine this value.', + 'TOOLTIP_POST_REPLY_NOTIFY' => 'You can receive e-mails notifying you of responses to particular posts you make. Choose whether or not the option to receive those e-mails is enabled by default while writing posts.', + 'TOOLTIP_PROFILE_USER_DISP_EMAIL' => 'Provide a publicly viewable address which other users will be able to see on your profile page.', + 'TOOLTIP_PROFILE_USER_EMAIL' => 'The e-mail address you enter here will only be used to send you forum notifications. This address will never be displayed on the forum and will not be made available to other users.', + 'TOOLTIP_SOCIAL_MEDIA_USERNAME' => 'The username that appears in the url for your social media site profile page.', + 'TOOLTIP_SUBSCRIBED_FORUMS' => 'You will receive digests containing recent threads and posts in your Subscribed Forums at regular intervals via e-mail.', + 'TOOLTIP_TWITTER_IDENTIFIER' => 'The ID number that appears in the url for your Twitter RSS feed.', + 'TOOLTIP_WATCHED_THREADS' => 'You will receive immediate notification via e-mail of all new posts made in your Watched Threads.', + 'URL_INVALID' => 'You entered an invalid URL: \'%s\'', + 'USER_BANNED' => 'You have been banned', + 'USER_BUDDIES_DELETED' => '%s buddies have been removed from your buddy list.', + 'USER_BUDDY_ADDED' => '%s has been added to your buddy list.', + 'USER_BUDDY_ADD_ERROR' => 'Unable to add %s to your buddy list: %s', + 'USER_BUDDY_ALREADY' => '%s is already on your buddy list!', + 'USER_BUDDY_DEL_ERROR' => 'Unable to remove from your buddy list: %s', + 'USER_BUDDY_DELETED' => '%s has been removed from your buddy list.', + 'USER_BUDDY_NOT_THERE' => 'User %s was not on your buddy list.', + 'USER_BUDDY_NO_USER' => 'The user you attempted to add to your buddy list, \'%s\', does not exist', + 'USER_BUDDY_SELF_ERROR' => 'You cannot add yourself as a buddy.', + 'USER_DELETED' => 'Deleted', + 'USER_DOES_NOT_EXIST' => 'The username you attempted to access does not exist', + 'USER_ICON_BAD_TYPE' => 'You attempted to upload of type \'%s\', but only the following image types are allowed: %s', + 'USER_ICON_CURRENT' => 'Custom image', + 'USER_ICON_EMPTY' => 'The image you attempted to upload contained no data. Please attempt to upload your image again', + 'USER_ICON_SYSTEM_ERROR' => 'A system error occurred while attempting to upload your image: %s', + 'USER_ICON_TOO_LARGE' => 'The image you attempted to upload exceeds the maximum image size (%s)', + 'USER_INVALID_USERNAME' => '%s is not a valid username', + 'USERNAME_CANT_CHANGE' => 'You are not permitted to change your username', + 'USERNAME_DOES_NOT_EXIST' => 'Username \'%s\' does not exist', + 'USERNAME_EXISTS' => 'The username \'%s\' already exists. Please choose another', + 'USERNAME_INVALID_CHARS' => 'Username contains invalid characters', + 'USERNAME_LEADING_SPACES' => 'A username may not contain leading spaces', + 'USERNAME_NOT_ENTERED' => 'No username entered', + 'USERNAME_RESERVED' => 'Username is reserved for future use', + 'USERNAME_TOO_LONG' => 'Username too long. The maximum length of a username is %d characters', + 'USERNAME_TOO_SHORT' => 'Username too short. A username must be at least %d characters long', + 'USERNAME_TRAILING_SPACES' => 'A username may not contain trailing spaces', + 'USER_NEVER_LOGGED_IN' => 'User has never logged in', + 'USER_NO_PRIVMSG' => '%s has chosen not to receive private messages', + 'USER_PERM_ALLOW_PM' => 'All private messages from %s will now be allowed', + 'USER_PERM_BLOCK_PM' => 'All private messages from %s will now be blocked', + 'USER_PERM_HIDE_POST' => 'All posts from %s will now be hidden', + 'USER_PERM_INVALID' => 'An invalid permission was submitted', + 'USER_PERM_SELF_ERROR' => 'You cannot block yourself.', + 'USER_PERM_SHOW_POST' => 'All posts from %s will now be shown', + 'USER_SIGNATURE_EMOTICON' => 'You are not allowed to use emoticons in your signature', + 'USER_SIGNATURE_TOO_LONG' => 'Your signature is too long. Your signature must be under %s characters long', + 'USER_SIGNATURE_TOO_MANY_LINES' => 'Your signature spans too many lines. Your signature must be under %s lines', + 'USERSTATUS_ADMINISTRATOR' => 'Administrator', + 'USERSTATUS_ANONYMOUS' => 'Guest', + 'USERSTATUS_NOT_VALIDATED' => 'Not Validated', + 'USERSTATUS_REGISTERED' => 'Registered User', + 'USER_UNSUBSCRIBE_SUBJECT' => 'Unsubscription Notice', + 'VALIDATE_ALREADY_VALIDATED' => 'You have already been validated', + 'VALIDATE_BAD_CODE' => 'Invalid validation code entered', + 'VALIDATE_NO_CODE' => 'No validation code entered', +}; + +# vim:syn=perl:ts=4:noet diff --git a/site/forum/local/admin_validation.eml b/site/forum/local/admin_validation.eml new file mode 100644 index 0000000..e5f1318 --- /dev/null +++ b/site/forum/local/admin_validation.eml @@ -0,0 +1,12 @@ +To: <%user_email%> +Subject: <%site_title%> validation +From: <%site_title%> <<%admin_email%>> + +Hi, <%user_username%>. Welcome to the <%site_title%> forum! + +This e-mail is being sent to inform you that your <%site_title%> account has +been validated by the forum's administrator. The forum can be found at: + +<%cgi_root_url%>/gforum.cgi?do=login&user_username=<%GT::CGI::escape($user_username)%> + +<%site_title%> Adminstrator diff --git a/site/forum/local/admin_validation_notification.eml b/site/forum/local/admin_validation_notification.eml new file mode 100644 index 0000000..e92355d --- /dev/null +++ b/site/forum/local/admin_validation_notification.eml @@ -0,0 +1,15 @@ +To: slowman@slowtwitch.com,rappstar@slowtwitch.com,eric@slowtwitch.com,ryan@slowtwitch.com +Subject: user signup validation +From: <%site_title%> <<%admin_email%>> + +User "<%user_username%>" has been signed up and awaiting for administrators for validation. + +Email: <%user_email%> + +<%user_username%>, as a mischief-control tactic, name a RACE (be specific!) associated with the sport this site covers that interests you: + +<%user_answer_1%> + +Validate users here: http://forum.slowtwitch.com/cgi-bin/admin/admin.cgi?do=page;page=users_admin_validate.html + +<%site_title%> Administrator diff --git a/site/forum/local/globals.txt b/site/forum/local/globals.txt new file mode 100644 index 0000000..7762b18 --- /dev/null +++ b/site/forum/local/globals.txt @@ -0,0 +1,216 @@ +# This file is auto generated and contains a perl hash of +# your template globals for 'twitch' template set. +# Generated on: Sat Sep 16 12:38:20 2023 + +{ + 'ad_300x250' => ' + +
+ +
', + 'ad_300x600' => ' + +
+ +
+', + 'ad_728x90' => ' + +
+ +
', + 'ad_lr_300x250' => ' + +
+ +
', + 'ad_lr_300x600' => ' + +
+ +
+', + 'ad_lr_728x90' => ' + +
+ +
', + 'ad_lr_wallpaper' => ' + + +', + 'ad_wallpaper' => ' + + +', + 'advertserve_ajax' => ' + +', + 'cat_full_name' => 'Slowtwitch Forums', + 'comscore' => '', + 'current_year' => 'sub { + use POSIX qw(strftime); + my $now_string = strftime "%Y", localtime; + return $now_string; +}', + 'encoding' => 'sub { + my $str = shift || return; + require Encode; + + return Encode::encode("utf-8", $str); +}', + 'ezoic' => ' +', + 'ezoic_desktop_bottom' => ' +
+ +
+', + 'ezoic_desktop_sidebar' => ' +
+', + 'ezoic_mobile_thread' => ' +
+ +
+', + 'ezoic_mobile_top' => ' +
+ +
+', + 'google_tag_manager' => ' + + + + +', + 'new_messages' => 'sub { +return $DB->table(\'Message\')->select(\'COUNT(*)\', { to_user_id_fk => $USER->{user_id}, msg_status => 0 })->fetchrow; +}', + 'quantcast' => '', + 'registered_users' => 'sub { $DB->table(\'User\')->count }', + 'site_title' => 'Slowtwitch.com', + 'smilies' => 'sub { +# This is a list of all the smilies that are listed on the message/post compose +# page. Note that all these smilies should already be defined as markup tags. + my @smilies = qw{:) ;) :( :P cool blush angelic crazy mad shocked laugh :/ :| sly pirate ninja w00t huh whistle}; + + my @ret; + for (@smilies) { + next unless $CFG->{markup_tags}->{$_}; + + my $val = $CFG->{markup_tags}->{$_}->[0]; + $val =~ s/<%image_url%>/$CFG->{image_url}/gi; + $val =~ s/<%cgi_root_url%>/$CFG->{cgi_root_url}/gi; + $val =~ s/<%gforum_cgi%>/$CFG->{gforum_cgi}/gi; + + my ($src) = $val =~ /\bsrc="([^"]+)"/; + my ($alt) = $val =~ /\balt="([^"]+)"/; + + push @ret, { tag => $_, url => $src, alt => $alt || ""}; + } + + return { smilies_loop => \@ret }; +}' +}; + +# vim:syn=perl:ts=4:noet diff --git a/site/forum/local/language.txt b/site/forum/local/language.txt new file mode 100644 index 0000000..b1ef8ad --- /dev/null +++ b/site/forum/local/language.txt @@ -0,0 +1,102 @@ +# This file is auto-generated and contains a perl hash of your +# language variables for the 'default' template set. +# Generated: Fri May 22 14:35:00 2015 + +{ + 'DATE_DAY_1' => 'Sunday', + 'DATE_DAY_2' => 'Monday', + 'DATE_DAY_3' => 'Tuesday', + 'DATE_DAY_4' => 'Wednesday', + 'DATE_DAY_5' => 'Thursday', + 'DATE_DAY_6' => 'Friday', + 'DATE_DAY_7' => 'Saturday', + 'DATE_DAY_SHORT_1' => 'Sun', + 'DATE_DAY_SHORT_2' => 'Mon', + 'DATE_DAY_SHORT_3' => 'Tue', + 'DATE_DAY_SHORT_4' => 'Wed', + 'DATE_DAY_SHORT_5' => 'Thu', + 'DATE_DAY_SHORT_6' => 'Fri', + 'DATE_DAY_SHORT_7' => 'Sat', + 'DATE_FORMAT' => '%mmm% %d%, %yy% %H%:%MM%', + 'DATE_MONTH_1' => 'January', + 'DATE_MONTH_10' => 'October', + 'DATE_MONTH_11' => 'November', + 'DATE_MONTH_12' => 'December', + 'DATE_MONTH_2' => 'February', + 'DATE_MONTH_3' => 'March', + 'DATE_MONTH_4' => 'April', + 'DATE_MONTH_5' => 'May', + 'DATE_MONTH_6' => 'June', + 'DATE_MONTH_7' => 'July', + 'DATE_MONTH_8' => 'August', + 'DATE_MONTH_9' => 'September', + 'DATE_MONTH_SHORT_1' => 'Jan', + 'DATE_MONTH_SHORT_10' => 'Oct', + 'DATE_MONTH_SHORT_11' => 'Nov', + 'DATE_MONTH_SHORT_12' => 'Dec', + 'DATE_MONTH_SHORT_2' => 'Feb', + 'DATE_MONTH_SHORT_3' => 'Mar', + 'DATE_MONTH_SHORT_4' => 'Apr', + 'DATE_MONTH_SHORT_5' => 'May', + 'DATE_MONTH_SHORT_6' => 'Jun', + 'DATE_MONTH_SHORT_7' => 'Jul', + 'DATE_MONTH_SHORT_8' => 'Aug', + 'DATE_MONTH_SHORT_9' => 'Sep', + 'DATE_UNIT_DAY' => '%s day', + 'DATE_UNIT_DAYS' => '%s days', + 'DATE_UNIT_DAYS_RECURRING' => '%s days', + 'DATE_UNIT_DAY_RECURRING' => 'day', + 'DATE_UNIT_MONTH' => '%s month', + 'DATE_UNIT_MONTHS' => '%s months', + 'DATE_UNIT_MONTHS_RECURRING' => '%s months', + 'DATE_UNIT_MONTH_RECURRING' => 'month', + 'DATE_UNIT_WEEK' => '%s week', + 'DATE_UNIT_WEEKS' => '%s weeks', + 'DATE_UNIT_WEEKS_RECURRING' => '%s weeks', + 'DATE_UNIT_WEEK_RECURRING' => 'week', + 'DATE_UNIT_YEAR' => '%s year', + 'DATE_UNIT_YEARS' => '%s years', + 'DATE_UNIT_YEARS_RECURRING' => '%s years', + 'DATE_UNIT_YEAR_RECURRING' => 'year', + 'POLL_ALREADY_DISABLED' => 'This poll is already disabled.', + 'POLL_ALREADY_ENABLED' => 'This poll is already enabled.', + 'POLL_ALREADY_VOTED' => 'You have already voted!', + 'POLL_DISABLED' => 'This poll is closed.', + 'POLL_DOES_NOT_EXIST' => 'The poll you are looking for does not exist!', + 'POLL_MAY_NOT_EDIT' => 'You may not edit the poll (you can still edit your post).', + 'POLL_NOT_ENOUGH_OPTIONS' => 'You can only post polls with two or more options.', + 'POLL_THANK_YOU' => 'Thank you for voting', + 'POLL_VOTE_EMPTY' => 'Empty vote... why on earth did you do that?', + 'SIGNUP_CONFIRM_IMAGE' => 'The security image do not match', + 'SIGNUP_EMAIL_BANNED' => 'The e-mail address \'%s\' has been restricted', + 'SIGNUP_EMAIL_EXISTS' => 'The e-mail address \'%s\' has already been used with another username: %s', + 'SIGNUP_EMAIL_VALIDATION_FAILED' => 'Unable to send validation email: %s', + 'SIGNUP_INVALID_PAYMENT' => 'You selected an invalid payment', + 'SIGNUP_NO_EMAIL' => 'You did not enter a valid e-mail address', + 'SIGNUP_NO_PASSWORD' => 'You did not enter a password', + 'SIGNUP_NO_PAYMENT' => 'You did not select a payment', + 'SIGNUP_NO_USERNAME' => 'You did not enter a username', + 'SIGNUP_PASSWORDS_DONT_MATCH' => 'The passwords you entered do not match', + 'TIMEZONE_ERROR' => 'An error occurred while trying to contact the server', + 'TIMEZONE_LOADING' => 'Getting local time...', + 'USER_BANNED' => 'You have been banned', + 'USER_DELETED' => 'Deleted', + 'USER_DOES_NOT_EXIST' => 'The username you attempted to access does not exist', + 'USER_ICON_BAD_TYPE' => 'You attempted to upload of type \'%s\', but only the following image types are allowed: %s', + 'USER_ICON_CURRENT' => 'Current custom image', + 'USER_ICON_EMPTY' => 'The image you attempted to upload contained no data. Please attempt to upload your image again', + 'USER_ICON_SYSTEM_ERROR' => 'A system error occured while attempting to upload your image: %s', + 'USER_ICON_TOO_LARGE' => 'The image you attempted to upload exceeds the maximum image size (%s)', + 'USER_INVALID_USERNAME' => '%s is not a valid username', + 'USER_MISCHIEF_CONTROL' => 'You have to answer the mischief-control tactic question.', + 'USER_NEVER_LOGGED_IN' => 'User has never logged in', + 'USER_NOTALLOWED_PM' => 'You\'re not allowed to send private messages.', + 'USER_NOTALLOWED_POST' => 'You\'re not allowed to post in this forum.', + 'USER_NO_PRIVMSG' => '%s has chosen not to receive private messages', + 'USER_SIGNATURE_EMOTICON' => 'You are not allowed to use emoticons in your signature', + 'USER_SIGNATURE_TOO_LONG' => 'Your signature is too long. Your signature must be under %s characters long', + 'USER_SIGNATURE_TOO_MANY_LINES' => 'Your signature spans too many lines. Your signature must be under %s lines', + 'USER_TRAINING_DB' => 'Can\'t update training db: %s' +}; + +# vim:syn=perl:ts=4:noet diff --git a/site/forum/local/reply.eml b/site/forum/local/reply.eml new file mode 100644 index 0000000..6034145 --- /dev/null +++ b/site/forum/local/reply.eml @@ -0,0 +1,14 @@ +To: <%user_email%> +Subject: <%cat_full_name%> - Reply to your post +From: <%cat_full_name%> <<%admin_email%>> + +<%cat_full_name%> + +<%post_username%> has replied to your post in the <%cat_full_name%>: <%forum_name%> forum. + +Subject: <%post_subject%> + +You can view the post here: <%cgi_root_url%>/gforum.cgi?post=<%post_id%>#p<%post_id%> + +You can unsubscribe the reply notification here: <%cgi_root_url%>/gforum.cgi?do=user_profile_basic + diff --git a/site/forum/message.eml b/site/forum/message.eml new file mode 100644 index 0000000..6d00c15 --- /dev/null +++ b/site/forum/message.eml @@ -0,0 +1,12 @@ +To: <%to_user_email%> +Subject: <%cat_full_name%> - Private message received +From: <%cat_full_name%> <<%admin_email%>> + +<%cat_full_name%> + +<%msg_username%> has sent you a private message. + +Subject: <%msg_subject%> + +You can view the message here: <%cgi_root_url%>/gforum.cgi?do=message_view&message=<%msg_id%> + diff --git a/site/forum/new_thread_notify.eml b/site/forum/new_thread_notify.eml new file mode 100644 index 0000000..a2c1d58 --- /dev/null +++ b/site/forum/new_thread_notify.eml @@ -0,0 +1,14 @@ +To: <%site_title%> <<%To%>> +Subject: <%site_title%> - New Thread Notification +From: <%site_title%> <<%admin_email%>> + +The user <<%username%>> has created a new thread: + +Category : <%category_name%> +Forum name : <% forum_name %> + +------------------------------------------------ +<%message%> +------------------------------------------------ + +<%cgi_root_url%>/gforum.cgi?post=<%post_id%> \ No newline at end of file diff --git a/site/forum/post_report.eml b/site/forum/post_report.eml new file mode 100644 index 0000000..510a98a --- /dev/null +++ b/site/forum/post_report.eml @@ -0,0 +1,10 @@ +Subject: <%site_title%> - Reported Post +From: <%site_title%> <<%admin_email%>> +To: <%moderator_mail%> + +<%unescape_html report_username%> has reported the post "<%post_title%>". + +Given explanation: +<%unescape_html report_message%> + +You can view the reported post here: <%GForum::SEO::url(type => "post", id => $post_post_id, anchor => $post_post_id)%> \ No newline at end of file diff --git a/site/forum/reply.eml b/site/forum/reply.eml new file mode 100644 index 0000000..7786bf9 --- /dev/null +++ b/site/forum/reply.eml @@ -0,0 +1,12 @@ +To: <%user_email%> +Subject: <%cat_full_name%> - Reply to your post +From: <%cat_full_name%> <<%admin_email%>> + +<%cat_full_name%> + +<%post_username%> has replied to your post in the <%cat_full_name%>: <%forum_name%> forum. + +Subject: <%post_subject%> + +You can view the post here: <%cgi_root_url%>/gforum.cgi?post=<%post_id%>#p<%post_id%> + diff --git a/site/forum/subscribe.eml b/site/forum/subscribe.eml new file mode 100644 index 0000000..bc383ba --- /dev/null +++ b/site/forum/subscribe.eml @@ -0,0 +1,24 @@ +To: <%user_email%> +Subject: <%cat_full_name%> - Daily archive of: <%forum_name%> +From: <%cat_full_name%> <<%admin_email%>> + +<%cat_full_name%> archive for <%forum_name%> + +This forum is located at <%cgi_root_url%>/gforum.cgi?forum=<%forum_id%> +The main site is located at <%cgi_root_url%>/gforum.cgi + +--------------------------------------------------------------------------- + +<%loop post_loop%> +Subject: <%post_subject%> +Posted by: <%post_username%> +Posted on: <%post_date%> + +<%post_message_text%> + +--------------------------------------------------------------------------- +<%endloop%> + +<%if more_posts%> +Not all posts have been listed since the forum archive is limited to <%subscribe_email_max_posts%> posts. More posts can be found on the <%cat_full_name%> site. +<%endif%> diff --git a/site/forum/temp_pass.eml b/site/forum/temp_pass.eml new file mode 100644 index 0000000..18d08d3 --- /dev/null +++ b/site/forum/temp_pass.eml @@ -0,0 +1,13 @@ +To: <%user_email%> +Subject: <%cat_full_name%> - Temporary password +From: <%cat_full_name%> <<%admin_email%>> + +You recently requested that a new temporary password be created and sent to you. + +This password may be used to log in to <%cat_full_name%> only once. When you log in, you should immediately change your password to something you can remember. + +Your login information (for one time only): + +Username: <%user_username%> +Password: <%user_temp_pass%> + diff --git a/site/forum/thread_notify.eml b/site/forum/thread_notify.eml new file mode 100644 index 0000000..fb94677 --- /dev/null +++ b/site/forum/thread_notify.eml @@ -0,0 +1,13 @@ +Subject: <%cat_full_name%> - Reply to watched thread +From: <%cat_full_name%> <<%admin_email%>> + +<%cat_full_name%>: Watched Thread reply. + +The '<%root_post_subject%>' thread in the <%forum_name%> forum has been replied to. + +You can view the thread here: <%cgi_root_url%>/gforum.cgi?post=<%root_post_id%>;page=unread#unread + +You specified that the thread should be watched for any replies. To stop watching this and any other +watched threads, visit the Watched Threads section of your profile, available here: +<%cgi_root_url%>/gforum.cgi?do=user_profile_notifications&action=threads + diff --git a/site/forum/validation.eml b/site/forum/validation.eml new file mode 100644 index 0000000..a280656 --- /dev/null +++ b/site/forum/validation.eml @@ -0,0 +1,14 @@ +To: <%user_email%> +Subject: <%cat_full_name%> validation +From: <%cat_full_name%> <<%admin_email%>> + +Hi, <%user_username%>. Welcome to the <%cat_full_name%>! + +This e-mail has been sent to confirm that this is a valid e-mail address. You will be unable to login until you have visited the following URL: + +<%cgi_root_url%>/gforum.cgi?do=user_validate&validate=<%validate_code%> + +Your real e-mail address will only be used to send you notification of replies +and forum archives (if you request them). Your real e-mail address will not be +visible to other users of the forum. + diff --git a/site/forum/validation_dev.eml b/site/forum/validation_dev.eml new file mode 100644 index 0000000..2a887f5 --- /dev/null +++ b/site/forum/validation_dev.eml @@ -0,0 +1,16 @@ +To: <%user_username%> <<%user_email%>> +Subject: <%cat_full_name%> validation +From: <%cat_full_name%> <<%admin_email%>> + +Hi <%user_username%>, + +Welcome to the <%cat_full_name%> forum! + +This e-mail has been sent to confirm that this is a valid e-mail address. You will be unable to login until you have visited the following URL: + +<%cgi_root_url%>/gforum.cgi?do=user_validate&validate=<%validate_code%> + +Your real e-mail address will only be used to send you notification of replies +and forum archives (if you request them). Your real e-mail address will not be +visible to other users of the forum. + diff --git a/site/racecalendar/articles/static b/site/racecalendar/articles/static new file mode 120000 index 0000000..a7191fd --- /dev/null +++ b/site/racecalendar/articles/static @@ -0,0 +1 @@ +/var/home/slowtwitch/slowtwitch.com/www/articles/static \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/admin/blank.gif b/site/slowtwitch.com/www/articles/static/admin/blank.gif new file mode 100644 index 0000000..74b254f Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/admin/blank.gif differ diff --git a/site/slowtwitch.com/www/articles/static/admin/collapse.gif b/site/slowtwitch.com/www/articles/static/admin/collapse.gif new file mode 100644 index 0000000..4b6aa56 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/admin/collapse.gif differ diff --git a/site/slowtwitch.com/www/articles/static/admin/expand.gif b/site/slowtwitch.com/www/articles/static/admin/expand.gif new file mode 100644 index 0000000..0982f07 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/admin/expand.gif differ diff --git a/site/slowtwitch.com/www/articles/static/admin/loading.gif b/site/slowtwitch.com/www/articles/static/admin/loading.gif new file mode 100644 index 0000000..c9dfbd0 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/admin/loading.gif differ diff --git a/site/slowtwitch.com/www/articles/static/admin/root.gif b/site/slowtwitch.com/www/articles/static/admin/root.gif new file mode 100644 index 0000000..b636f4b Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/admin/root.gif differ diff --git a/site/slowtwitch.com/www/articles/static/browser/expandfake.gif b/site/slowtwitch.com/www/articles/static/browser/expandfake.gif new file mode 100644 index 0000000..43252a4 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/browser/expandfake.gif differ diff --git a/site/slowtwitch.com/www/articles/static/browser/expandless.gif b/site/slowtwitch.com/www/articles/static/browser/expandless.gif new file mode 100644 index 0000000..c95f10e Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/browser/expandless.gif differ diff --git a/site/slowtwitch.com/www/articles/static/browser/expandplus.gif b/site/slowtwitch.com/www/articles/static/browser/expandplus.gif new file mode 100644 index 0000000..7618c47 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/browser/expandplus.gif differ diff --git a/site/slowtwitch.com/www/articles/static/browser/selected.gif b/site/slowtwitch.com/www/articles/static/browser/selected.gif new file mode 100644 index 0000000..d0f70d1 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/browser/selected.gif differ diff --git a/site/slowtwitch.com/www/articles/static/browser/unselected.gif b/site/slowtwitch.com/www/articles/static/browser/unselected.gif new file mode 100644 index 0000000..8e310e5 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/browser/unselected.gif differ diff --git a/site/slowtwitch.com/www/articles/static/dev b/site/slowtwitch.com/www/articles/static/dev new file mode 120000 index 0000000..625f951 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/dev @@ -0,0 +1 @@ +luna \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/clear_shim.gif b/site/slowtwitch.com/www/articles/static/fileman/clear_shim.gif new file mode 100644 index 0000000..076c753 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/clear_shim.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/colorchart.jpg b/site/slowtwitch.com/www/articles/static/fileman/colorchart.jpg new file mode 100644 index 0000000..4389793 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/colorchart.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/fileman.js b/site/slowtwitch.com/www/articles/static/fileman/fileman.js new file mode 100644 index 0000000..82d6d3b --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/fileman.js @@ -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
'; + + 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; i1) 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 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'; +} diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/02fileman.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/02fileman.jpg new file mode 100644 index 0000000..e9c0508 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/02fileman.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/03toolbar.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/03toolbar.jpg new file mode 100644 index 0000000..5a3c858 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/03toolbar.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/04search.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/04search.jpg new file mode 100644 index 0000000..1b8202c Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/04search.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/05replace.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/05replace.jpg new file mode 100644 index 0000000..3b60a14 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/05replace.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/06command.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/06command.jpg new file mode 100644 index 0000000..6b06475 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/06command.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/07upload.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/07upload.jpg new file mode 100644 index 0000000..c624fda Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/07upload.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/08newfile.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/08newfile.jpg new file mode 100644 index 0000000..4050ef1 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/08newfile.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/09newdirectory.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/09newdirectory.jpg new file mode 100644 index 0000000..a34d7e6 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/09newdirectory.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/10protect.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/10protect.jpg new file mode 100644 index 0000000..0fb73d2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/10protect.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/11preferences.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/11preferences.jpg new file mode 100644 index 0000000..1d1b861 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/11preferences.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/12password.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/12password.jpg new file mode 100644 index 0000000..ee5198d Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/12password.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/13filemenu.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/13filemenu.jpg new file mode 100644 index 0000000..dfebb2a Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/13filemenu.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/14permissions.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/14permissions.jpg new file mode 100644 index 0000000..035f900 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/14permissions.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/15commandbar.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/15commandbar.jpg new file mode 100644 index 0000000..40b93c2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/15commandbar.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/16download.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/16download.jpg new file mode 100644 index 0000000..cad3bd3 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/16download.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/17copy.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/17copy.jpg new file mode 100644 index 0000000..a7e43a1 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/17copy.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/18move.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/18move.jpg new file mode 100644 index 0000000..45137d6 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/18move.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/19chmod.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/19chmod.jpg new file mode 100644 index 0000000..3672ea7 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/19chmod.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/20tail.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/20tail.jpg new file mode 100644 index 0000000..f194ea5 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/20tail.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/22diff.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/22diff.jpg new file mode 100644 index 0000000..edb83f2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/22diff.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/23compress.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/23compress.jpg new file mode 100644 index 0000000..7f231e8 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/23compress.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/actions.gif b/site/slowtwitch.com/www/articles/static/fileman/help/actions.gif new file mode 100644 index 0000000..ec09a22 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/actions.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-chmod.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-chmod.gif new file mode 100644 index 0000000..f30ae44 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-chmod.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-compress.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-compress.gif new file mode 100644 index 0000000..3147090 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-compress.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-copy.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-copy.gif new file mode 100644 index 0000000..c110972 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-copy.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-delete.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-delete.gif new file mode 100644 index 0000000..3c45103 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-delete.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-diff.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-diff.gif new file mode 100644 index 0000000..21622c4 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-diff.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-download.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-download.gif new file mode 100644 index 0000000..a1ec910 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-download.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-move.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-move.gif new file mode 100644 index 0000000..39b7524 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-move.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-print.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-print.gif new file mode 100644 index 0000000..f4369f2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-print.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-rename.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-rename.gif new file mode 100644 index 0000000..2ffec62 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-rename.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-symlink.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-symlink.gif new file mode 100644 index 0000000..94f86e3 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-symlink.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-tail.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-tail.gif new file mode 100644 index 0000000..ac65451 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-tail.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command-uncompress.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command-uncompress.gif new file mode 100644 index 0000000..db00ba1 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command-uncompress.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/command.gif b/site/slowtwitch.com/www/articles/static/fileman/help/command.gif new file mode 100644 index 0000000..889d689 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/command.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/dir-structure.gif b/site/slowtwitch.com/www/articles/static/fileman/help/dir-structure.gif new file mode 100644 index 0000000..eae28ed Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/dir-structure.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/fig2.gif b/site/slowtwitch.com/www/articles/static/fileman/help/fig2.gif new file mode 100644 index 0000000..d271e27 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/fig2.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/fig3.gif b/site/slowtwitch.com/www/articles/static/fileman/help/fig3.gif new file mode 100644 index 0000000..2bbd552 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/fig3.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/fig6.gif b/site/slowtwitch.com/www/articles/static/fileman/help/fig6.gif new file mode 100644 index 0000000..de792d0 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/fig6.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/fig7.gif b/site/slowtwitch.com/www/articles/static/fileman/help/fig7.gif new file mode 100644 index 0000000..ec7cd46 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/fig7.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/newfile.gif b/site/slowtwitch.com/www/articles/static/fileman/help/newfile.gif new file mode 100644 index 0000000..60f7467 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/newfile.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/newfolder.gif b/site/slowtwitch.com/www/articles/static/fileman/help/newfolder.gif new file mode 100644 index 0000000..d03a37a Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/newfolder.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/protect.gif b/site/slowtwitch.com/www/articles/static/fileman/help/protect.gif new file mode 100644 index 0000000..8f05b5e Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/protect.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/replace.gif b/site/slowtwitch.com/www/articles/static/fileman/help/replace.gif new file mode 100644 index 0000000..575912c Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/replace.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/search.gif b/site/slowtwitch.com/www/articles/static/fileman/help/search.gif new file mode 100644 index 0000000..623fbcb Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/search.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/toolbar.jpg b/site/slowtwitch.com/www/articles/static/fileman/help/toolbar.jpg new file mode 100644 index 0000000..b6da081 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/toolbar.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/tools.gif b/site/slowtwitch.com/www/articles/static/fileman/help/tools.gif new file mode 100644 index 0000000..908922d Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/tools.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/help/upload.gif b/site/slowtwitch.com/www/articles/static/fileman/help/upload.gif new file mode 100644 index 0000000..b2bd446 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/help/upload.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/1pixel.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/1pixel.gif new file mode 100644 index 0000000..1d11fa9 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/1pixel.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/back.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/back.gif new file mode 100644 index 0000000..e1a2b55 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/back.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/binary.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/binary.gif new file mode 100644 index 0000000..9a15cba Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/binary.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/close.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/close.gif new file mode 100644 index 0000000..fd28eff Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/close.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/compressed.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/compressed.gif new file mode 100644 index 0000000..39e7327 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/compressed.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/doc.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/doc.gif new file mode 100644 index 0000000..a163a59 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/doc.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/down.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/down.gif new file mode 100644 index 0000000..3493360 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/down.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/fileman_logo.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/fileman_logo.gif new file mode 100644 index 0000000..736564a Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/fileman_logo.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/first.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/first.gif new file mode 100644 index 0000000..cb75c8f Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/first.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/first_grey.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/first_grey.gif new file mode 100644 index 0000000..5c5a192 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/first_grey.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/folder.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/folder.gif new file mode 100644 index 0000000..2ce41af Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/folder.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/ie.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/ie.gif new file mode 100644 index 0000000..3ab22bf Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/ie.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/image2.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/image2.gif new file mode 100644 index 0000000..751faee Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/image2.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/last.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/last.gif new file mode 100644 index 0000000..22912f5 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/last.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/last_grey.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/last_grey.gif new file mode 100644 index 0000000..35a4ac5 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/last_grey.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/next.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/next.gif new file mode 100644 index 0000000..3d400f2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/next.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/next_grey.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/next_grey.gif new file mode 100644 index 0000000..bb17a54 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/next_grey.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/p.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/p.gif new file mode 100644 index 0000000..7b917b4 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/p.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/parent.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/parent.gif new file mode 100644 index 0000000..a694ae1 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/parent.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/pdf.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/pdf.gif new file mode 100644 index 0000000..c559ccc Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/pdf.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/prev.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/prev.gif new file mode 100644 index 0000000..cd3b088 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/prev.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/prev_grey.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/prev_grey.gif new file mode 100644 index 0000000..e91d15b Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/prev_grey.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/quill.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/quill.gif new file mode 100644 index 0000000..818a5cd Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/quill.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/script.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/script.gif new file mode 100644 index 0000000..d8a853b Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/script.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/sound.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/sound.gif new file mode 100644 index 0000000..03e7441 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/sound.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/sound1.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/sound1.gif new file mode 100644 index 0000000..8efb49f Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/sound1.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/text.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/text.gif new file mode 100644 index 0000000..0bb37b5 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/text.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/unknown.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/unknown.gif new file mode 100644 index 0000000..32b1ea2 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/unknown.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/up.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/up.gif new file mode 100644 index 0000000..e80bef7 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/up.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/icons/xls.gif b/site/slowtwitch.com/www/articles/static/fileman/icons/xls.gif new file mode 100644 index 0000000..1700082 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/icons/xls.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/date.js b/site/slowtwitch.com/www/articles/static/fileman/js/date.js new file mode 100644 index 0000000..d35b126 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/date.js @@ -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').submit(function() { + var command = fm.current.command || fm.current.action; + +/* Handle extra steps if needed for some commands before submit the request */ + fm.form.attr('action', fm.config.cgi_url); + if (command == 'command') { + fm.command(); + } + else if (command == 'upload') { + fm.upload(); + } + else if (command.search(/file|edit/) == 0) { + if (tinyMCE.activeEditor) { + var editor = $('textarea[name="editor"]'); + var content = $('#editor_mode').val() == 'html' ? fm.tinyMCEContent() : editor.val(); + tinyMCE.activeEditor.remove(); + editor.val(content); + } + } + + $(this).ajaxSubmit({ + dataType : 'json', + beforeSubmit : function() { + /* Display waiting image for some commands */ + if (command.search(/search|replace|uncompress|compress|copy|delete|move|download/) == 0) { + fm.loading('start'); + } + }, + success : function(response) { + fm.loading('end'); + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else { + fm.commandResponse(response); + } + } + }); + return false; + }); + +/* Load files and setting layout */ + this.cd({ load_default : 1 }); + this.layoutDimensions(); + +/* Set up sorting action for the headers */ + $('.foldertab th a[rel]').each(function() { + var link = $(this); + link.click(function() { + $('.foldertab th a[rel] img').remove(); + if (fm.paging.sb != link.attr('rel')) { + fm.paging.sb = link.attr('rel'); + fm.paging.so = fm.paging.sb.search(/date|size|perm/) != -1 ? 'desc' : 'asc'; + } + else { + fm.paging.so = fm.paging.so == 'asc' ? 'desc' : 'asc'; + } + fm.sort(fm.files, fm.paging.sb, fm.paging.so); + fm.page(fm.paging, function(nh) { fm.printFiles(nh); }); + return false; + }); + }); + +/* Set Advance search and upload multiple files link */ + this.form.find('a[rel="advance-search"]').click(function() { return fm.advanceSearch(); }); + this.form.find('a[rel="upload-multiple"]').click(function() { return fm.uploadFiles(); }); + +/* Set action for action drop down */ + $('#fm_action').attr('selectedIndex', 0).change(function() { + var action = $(this).val(); + if ($('#cmd-' + action).length == 1 || action == '' || action.search(/delete|perl|print/) == 0) { + fm.actionDialog({ action : action }); + } + else { + fm.showMessage({ success : false, message : 'Invalid action: ' + action }); + } + }); + +/* Cluetip setup */ + $('.help').cluetip({ + activation : 'click', + closePosition : 'title', + closeText: 'Close', + width : 400, + height : 300, + sticky : true, + arrows : false + }); + +/* Handle showing sub-menus */ + if (this.config.is_ie) { + $('.primarynav li[class="navitem"]').each(function() { + var $li = $(this); + if ($li.find('ul').length == 0) return; + var $ul = $li.find('ul'); + $li.mouseover(function() { + $li.addClass('sfhover'); + $li.append(''); + }); + $li.mouseout(function() { + $li.find('iframe').remove(); + $li.removeClass('sfhover'); + }); + }); + } + +/* Search Expression option requires 'Search Contents' checked */ + $('#search_exp').click(function() { + $('#search_content').attr('checked', $(this).attr('checked') ? true : false); + }) + +/* Browse buttons */ + $('input[name="button-browse"]').each(function() { + var button = $(this); + button.click(function() { + var command = fm.current.command || fm.current.action; + fm.browse({ + title : command == 'diff' ? 'Select a text file' : 'Select Directory', + filter : command == 'diff' ? 2 : 1, + hidden_query : fm.hiddens.hidden_query, + id : command + '_input' + }); + }); + }); + +/* Setting for chmod command */ + $('#cmd-chmod input[name="chmod_input"]').change(function() { + var val = $(this).val(); + if (val.length == 0) return; + if (val.search(/\D/) >= 0) { + $(this).val('').focus(); + fm.showMessage({ success : false, message : 'Invalid octal notation.'}) + return; + } + var nums = val.split(""); + var invalid = false; + for (var i=0; i 7) { + invalid = true; + break; + } + } + + if (invalid) { + fm.showMessage({ success : false, message : 'Invalid octal notation.'}) + return; + } + fm.chmod(val); + }); + +/* Logout link */ + $('#loginbar a[rel]').click(function() { + fm.current.command = 'logout'; + fm.form.find('input[name="cmd"]').val('logout'); + fm.form.submit(); + return false; + }); + +/* Format Date */ + this.config.date_format = this.config.date_format; + Date.firstDayOfWeek = 7; + Date.format = this.config.date_format; + +/* Prevent user uses mousewheel on IE */ + document.getElementById('fm_action').onmousewheel = function() { return false; }; + +/* Setting action for access menu bar. This is only available for user who has multiple access directories */ + $('#uaccess a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname: '/', a : link.attr('rel') }); + return false; + }); + }); +} + +/* + login method: handles all none authentication actions + html : should be login form. This happens when session is expired +*/ +FileMan.prototype.login = function(html) { + if (html) $('#home').html(html).addClass('noauth'); + + var $contentmessage = $('#contentmessage'); + + $('#username').focus(); + $contentmessage.find('.error').oneTime(5000, 'msgtimer', function() { $contentmessage.slideUp('normal'); }); + + var fm = this; + $('a[rel="reset_password"]').click(function() { + fm.printForm('reset_password', function(response) { + if (response.success) { + $('form input[name="cmd"]').val('reset_password'); + var $login = $('#login'); + $login.fadeOut('normal', function() { + $('#content').append(response.data.html); + $('#email').focus(); + $('a[rel="login"]').click(function() { + var $reset = $('#reset_password'); + $reset.fadeOut('normal', function() { + $login.fadeIn('fast', function() { + $reset.remove(); + $('#username').focus(); + $('form input[name="cmd"]').val('login'); + }); + }); + }); + }); + } + }); + + return false; + }); + + $('form').ajaxForm({ + dataType : 'json', + success : function(response) { + if (response.success) { + if (response.data.redirect == 'login') { + var $reset = $('#reset_password'); + $reset.fadeOut('normal', function() { + $('#login').fadeIn('normal', function() { + $reset.remove(); + $('form input[name="cmd"]').val('login'); + $contentmessage.find('div').html(response.message).removeClass().addClass('message'); + $contentmessage.slideDown('normal', function() { $('#username').focus(); }); + }); + }); + fm.login(response.data.html); + } + else { + $('#wrapper').fadeOut('normal').remove(); + window.location = fm.config.cgi_url + (response.data.notuse_cookie == 1 ? ('?sid=' + response.data.session.id) : ''); + } + } + else { + $contentmessage.find('div').html(response.message).removeClass().addClass('error'); + $contentmessage.slideDown('normal', function() { + if ($('#login').is(':hidden')) $('#email').focus(); + else $('#username').focus(); + }).oneTime(5000, 'msgtimer', function() { $contentmessage.slideUp('normal'); }); + } + } + }); +} + +/* + Handle layout dimensions + wHeight: Should be window height. This is an optional. + message_height: Should be message box height. This is an optional + */ +FileMan.prototype.layoutDimensions = function(wHeight) { + if (typeof(wHeight) == 'undefined' || !wHeight) wHeight = $(window).height(); + + var message_height = $('#contentmessage').is(':hidden') ? 0 : ($('#contentmessage').outerHeight() + 2); + var height = wHeight - this.height.wrapperheader - this.height.wrapperfooter - 5; + var shadow_height = $('#ocwrapper .shadowtop').outerHeight() + $('#ocwrapper .shadowbottom').outerHeight(); + var command_height = $('#contentheader').is(':hidden') ? 0 : $('#contentheader').outerHeight(); + + var wrapper_content_padding = command_height > 0 ? 2 : 18; + var content_height = height - command_height - message_height - shadow_height - wrapper_content_padding; + + /* Setting height for these objects */ + $('#ocwrapper').css('height', height - command_height + 'px'); + $('#wrapper-content').css('height', height + 'px'); + $('#content').css('height', content_height + 'px'); + + this.height.content = $('#content').height(); + this.height.wrapper = height; + + $('#contentheader').css('width', $('#wrapper-content').width() - 20 + 'px'); + + /* If command-dialog exists, it needs to get resized as well */ + var $command_dialog = $('#command-dialog'); + if ($command_dialog.length > 0) { + var $editor = $command_dialog.find('textarea[name="editor"]'); + if ($editor.length > 0) { + var nwidth = getScreenWidth() - 45; + var nheight = getScreenHeight() - 275; + $editor.css('height', nheight + 'px').css('width', nwidth + 'px'); + + if ($editor.is(':hidden') && this.config.tinyMCE) { + this.config.tinyMCE.width = nwidth + 'px'; + this.config.tinyMCE.height = nheight - 5 + 'px'; + + tinyMCE.activeEditor.hide(); + tinyMCE.init(this.config.tinyMCE); + } + } + + var toolbar_height = $command_dialog.find('.toolbar').outerHeight() || 0; + $command_dialog.find('.contentframe').css('height', this.height.content - toolbar_height + 'px'); + } + else { + /* Setting the height for the content frame which is set 'scroll' for overflow-y */ + if ($('.contentframe').length > 0 && !$('.contentframe').hasClass('hide')) { + this.height.folder = $('.foldertab:first').height(); + this.height.toolbar = $('.toolbar').outerHeight() + this.height.folder; + + $('.contentframe').css('height', content_height - this.height.toolbar + 'px'); + + /* Fixing the width for file table which doesn't work probably on IE7 */ + $('.contentframe table[class="foldertab"]').css('width', $('.foldertab:first').outerWidth() - 18 + 'px'); + } + } +} + +/* + Handles showing the command panel + args : should be a hash of parameters +*/ +FileMan.prototype.commandDialog = function(args) { + var fm = this; + if (this.fileEditor.beingEdited) { + if (args.command == 'command') this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { fm.commandDialog(args); }); + } + + if (typeof(args) == 'undefined') args = new Object(); + +/* Clear timeoud ID if exists */ + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + + var $contentheader = $('#contentheader'); + var $contentmessage = $('#contentmessage'); + var command_height = $contentheader.height(); + var message_height = 0 + var msg_show = false; + var command = args.command || null; + +/* Hide the action bar if visible */ + if (this.current.action) { + $('#fm_action').attr('selectedIndex', 0); + this.fadeOut($('#cmd-' + this.current.action)); + this.current.action = null; + } + +/* Display message */ + if (!$contentmessage.is(':hidden')){ + $contentmessage.stopTime('msgtimer'); + this.fadeOut($contentmessage); + msg_show = true; + } + +/* Display the Command command screen */ + var $command_dialog = $('#command-dialog'); + if (command == 'command') { + if (this.current.command != command) { + var $content = $('#content'); + + this.printForm('command', function(response) { + if (response.success) { + fm.working_dir = response.data.working_dir; + if ($command_dialog.length > 0) $command_dialog.remove(); + fm.fadeOut($('#listfiles'), function() { + $content.append('
' + response.data.prompt + '
'); + fm.fadeIn($('#command-dialog').css('overflow-y', 'scroll'), function() { + fm.showStatus(command); + }); + }); + } + }); + } + } + +/* Display editor form */ + else if ($command_dialog.is(':hidden')) { + this.fadeOut($('#listfiles'), function() { + if (command.search(/file|edit/) == 0) { + var $modal = $('#modal-dialog'); + fm.loading('start'); + + fm.fadeIn($command_dialog, function() { + var $contentframe = $command_dialog.find('.contentframe'); + var $editor = $contentframe.find('textarea[name="editor"]'); + $contentframe.css('height', $command_dialog.height() + 'px').css('width', $command_dialog.width() + 'px').css('overflow', 'hidden'); + if ($('#editor_mode').val() == 'html') { + $editor.css('height', $command_dialog.height() - 13 + 'px').css('width', $command_dialog.width() - 5 + 'px'); + tinyMCE.init(fm.config.tinyMCE); + } + else { + $editor.css('height', $command_dialog.height() - 5 + 'px') + .css('width', $command_dialog.width() - 5 + 'px') + .change(function() { + if (!fm.fileEditor.beingEdited) fm.fileEditor.beingEdited = true; + }); + + fm.fadeIn($editor, function() { + if (!$modal.is(':hidden')) $modal.html('').jqmHide(); + }); + } + fm.loading('end'); + }); + } + else { + fm.fadeIn($command_dialog); + } + }); + } + +/* Display main screen */ + else if ($('#listfiles').is(':hidden') || $('.foldertab').is(':hidden')) { + if (!$command_dialog.is(':hidden')) { + this.fadeOut($command_dialog, function() { + $command_dialog.remove(); + if (command == null) $('.contentframe').css('height', fm.height.content - fm.height.toolbar - message_height + 'px'); + fm.fadeIn($('.foldertab')); + fm.fadeIn($('.paging')); + fm.fadeIn($('#listfiles'), function() { + if (args.message) fm.showMessage(args); + if (args.refresh) fm.cd(); + }); + }); + } + else { + this.fadeIn($('#listfiles'), function() { + if (args.message) fm.showMessage(args); + if (args.refresh) fm.cd(); + }); + this.fadeIn($('.foldertab')); + this.fadeIn($('.paging')); + } + this.showStatus(); + } + if (this.current.command == command) return; + + if (command == null && this.current.command != command) { + $("#ocwrapper").css('height', this.height.wrapper - command_height - message_height + 'px').css('margin-top', '0px'); + $("#content").css('height', this.height.content - message_height + 'px'); + $(".contentframe").css('height', this.height.content - message_height - command_height - 10 + 'px'); + + this.fadeOut($contentheader); + } + else { + $('#primarynav a[rel="' + command + '"]').parent().addClass('selected'); + +/* Create space for the command panel */ + if ($contentheader.is(':hidden')) { + if ($(".contentframe").length > 0) { + $("#content").css('height', fm.height.content - command_height + 'px'); + this.animate($(".contentframe"), { + height : this.height.content - this.height.toolbar - command_height, + scrollTop : 0 + }, 'fast', function() { + fm.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : fm.height.wrapper - command_height + }, 'fast', function() { + fm.slideDown($contentheader, function() { + $('#' + command + '_input').val(args.value || '').focus(); + }); + }); + }); + } + } + +/* Hide message box and resize the main screen */ + else if (msg_show) { + if ($(".contentframe").length > 0) { + $("#content").css('height', this.height.content - command_height + 'px'); + $(".contentframe").css('height', this.height.content - this.height.toolbar - command_height + 'px'); + + this.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : this.height.wrapper - command_height + }); + } + } + } + + /* Reset form before display it */ + this.resetForm(command); + + /* Display the command dialobottomg */ + if (this.current.command) { + this.fadeOut($('#cmd-' + this.current.command), function() { + fm.fadeIn($('#cmd-' + command), function() { + $('#' + command + '_input').val(args.value || '').focus(); + }); + }); + } + else { + this.fadeIn($('#cmd-' + command)); + } + +/* Remove #xx-content */ + $('#content').css('overflow', 'hidden'); + if (this.current.command) { + this.fadeOut($('#' + this.current.command + '-content'), function() { $('#' + this.current.command + '-content').remove() }); + $('.primarynav a[rel="' + this.current.command + '"]').parent().removeClass('selected'); + } + +/* Set the current command */ + this.current.command = command; + $('#cmd').val(command) + + if (this.form.find('input[name="cmd-result"]').length > 0 && command != 'command') { + this.form.find('input[name="cmd-result"]').remove(); + this.cd(); + } +} + +/* + actionDialog method: Show action dialog + action : should be action name + json : should be json object +*/ +FileMan.prototype.actionDialog = function(args) { + var fm = this; + if (this.fileEditor.beingEdited) { + this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { + fm.actionDialog(args); + }); + } + + if (!args) args = new Object; + var action = args.action; + var json = args.json; + + if (this.current.action == action) return; + +/* Clear timeoud ID if exists */ + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + +/* Get rid of hide from .fodlertab */ + if ($('.foldertab').is(':hidden')) { + $('#command-dialog').remove(); + this.fadeIn($('.foldertab')); + this.fadeIn($('.paging')); + this.fadeIn($('.readme')); + } + + var message_height = 0; + var toolbar_height = this.height.toolbar; + var folder_height = 0; + var $contentframe = $('.contentframe'); + var $contentheader = $('#contentheader'); + + if (json && json.message) { + this.showMessage(json); + message_height = this.height.contentmessage; + } + else if (!$('#contentmessage').is(':hidden')) { + this.slideUp($('#contentmessage')); + } + +/* Display a form instead: this applies for actions under toolbar menus*/ + var html = json && json.data.html ? json.data.html : ''; + if (html != '') { + if ($('#command-dialog').length == 0) $('#content').append('
'); + if (action != 'user' && action.search(/log/) == -1) toolbar_height -= this.height.folder; + if (action != 'user_modify' && json.data.user_modify) action = 'user_modify'; + + var $command_dialog = $('#command-dialog').css('overflow-y', 'hidden'); + this.fadeOut($('#listfiles'), function() { + fm.fadeOut($command_dialog, function() { + $command_dialog.html(html); + fm.fadeIn($command_dialog); + + $contentframe = $('#command-dialog .contentframe'); + if (action.search(/user/) == 0) { + if (action == 'user') { + fm.userManagement(json); + } + else { + fm.userAction(); + $command_dialog.find('input[name="button-cancel"]').click(function() { fm.actionForm('user'); }); + + $command_dialog.find('input[name="button-browse"]').click(function() { + var access = $('textarea[name="access_directories"]').val(); + var aTemp = access != '' ? access.split('\n') : new Array(); + fm.cdata.accesses = aTemp; + fm.browse({ + title : 'Select Directories', + filter : 1, + hidden_query : fm.hiddens.hidden_query, + multiple : true, + id : 'access_directories' + }) + }); + + $command_dialog.find('select[name="mod_type"]').change(function() { + if ($(this).val() == 1) { + fm.fadeOut($('#user_section')); + } + else { + fm.fadeIn($('#user_section')); + } + }); + } + } + else if (action == 'log') { + fm.browseLogs(json); + } + else if (action == 'uncompress') { + fm.uncompress(json.data.files); + folder_height = $('#command-dialog .foldertab:first').outerHeight() + 5; + } + + fm.animate($('#content'), { height : fm.height.content - message_height }); + fm.animate($contentframe, { height : fm.height.content - toolbar_height - message_height - folder_height }, 'normal', function() { + $command_dialog.find('input[id="' + action + '_input"]').focus(); + $command_dialog.find('.help').cluetip({ + activation : 'click', + closePosition : 'title', + closeText: 'Close', + width : 400, + height : 300, + sticky : true, + arrows : false + }); + }); + }); + }); + this.showStatus(this.languages[action] || action); + } + + if (!$contentheader.is(':hidden')) { + this.fadeOut($('#cmd-' + this.current.command), function() { + fm.animate($("#ocwrapper"), { + 'margin-top' : 0, + 'height' : fm.height.wrapper + }, 'normal', function() { + fm.animate($("#content"), { height: fm.height.content }); + $contentframe.css('height', fm.height.content - toolbar_height + 'px'); + + fm.fadeOut($contentheader, function() { + $('#' + action + '_input').focus(); + }); + }); + }); + + this.current.command = null; + $('.primarynav a[rel]').parent().removeClass('selected'); + } + else if (!html) { + this.animate($("#content"), { height: fm.height.content }); + $contentframe.css('height', fm.height.content - toolbar_height + 'px'); + } + +/* Reset form before display it */ + this.resetForm(action); + +/* Show action form if applicated */ + if (this.current.action && this.current.action != 'delete') { + this.fadeOut($('#cmd-' + this.current.action), function() { + fm.fadeIn($('#cmd-' + action), function () { + $('#' + action + '_input').focus(); + }); + }); + } + else { + this.fadeIn($('#cmd-' + action), function () { + $('#' + action + '_input').focus(); + }); + } + +/* Save the action */ + this.current.action = action; + $('#cmd').val(action) + this.form.find('input[name="confirm-name"]').val(''); + + /* Handle specific action */ + if (this.current.action.search(/delete|perl|print/) == 0) { + this.form.submit(); + } + else if (this.current.action == 'chmod') { + $('#cmd-chmod .checkbox').click(function() { + fm.chmod(); + }); + + /* Loading permission for a file if selected */ + var fselected = $('input[name="cinput"][checked]'); + if (fselected.length > 0) { + var fname = fselected.length == 1 ? fselected.val() : $(fselected[0]).val(); + this.parsePerm(fname); + } + } + else if (this.current.action == 'tail') { + $('#' + this.current.action + '_input').val('25'); + } +} + +/* + commandReponse method handles output of a command + json: should be json data object +*/ +FileMan.prototype.commandResponse = function(json) { + var command = this.current.command || this.current.action; + + var fm = this; + this.form.find('input[name="confirm-name"]').val(''); + if (command.search(/search|replace/) != -1) { /* The search command returns */ + this.paging.num_hits = json.data.hits; + this.paging.size = json.data.size; + this.readme = ''; + + /* Displaying search results, paging, and status info */ + this.sort(json.data.files, this.paging.sb, this.paging.so); + this.page(this.paging, function(nh) { fm.printFiles(nh); }); + + if (json.success) this.showStatus(); + this.form.append(''); + + this.showMessage(json); + } + else if (json.data.confirm == 1 && json.data.file) { + this.modalConfirm({ + html : 'Do you want to overwrite ' + json.data.file.name + '?', + yes : function($modal) { + fm.form.append('').submit(); + $modal.html('').jqmHide(); + }, + no : function($modal) { + $modal.html('').jqmHide(); + } + }); + } + else if (command.search(/copy|move/) == 0) { + this.copy(json); + } + else if (command == 'delete') { + this.remove(json); + } + else if (command == 'print') { + this.print(json); + } + else if (command == 'download') { + if (json.success) { + this.preview(json.data.file, 'download'); + } + else { + this.showMessage(json); + } + } + else if (command == 'perl') { + this.perl(json); + } + else if (command.search(/diff|tail/) == 0) { + if (json.success) { + this.showStatus(command); + + this.actionResponse('
' + json.data.output + '
'); + $('#' + command + '_input').focus(); + + /* Handle refreshing for tail command if enabled */ + if (command == 'tail' && json.data.refresh > 0) { + this.timerID = window.setTimeout(function() { fm.form.submit(); }, json.data.refresh * 1000); + } + } + else { + if (this.timerID) window.clearTimeOut(this.timerID); + this.showMessage(json); + } + } + else if (command.search(/user/) == 0) { + if (json.success == true) { + this.actionDialog({ action : 'user', json : json }); + } + else if (json.message) { + this.showMessage(json); + $('#user_action').val(''); + } + } + else if (command == 'logout') { + this.login(json.data.html); + } + else { + if (command == 'upload') $('#modal-dialog').jqm().jqmHide(); + if (json.success) { + /* Overwrite preferences */ + if (command == 'preferences') { + this.config.effect = json.data.defaults.effect == 1 ? true : false; + this.config.readme = json.data.defaults.readme; + this.paging.max_hits = json.data.defaults.maxhits; + this.paging.sb = json.data.defaults.sb || 'name'; + this.paging.so = json.data.defaults.so || 'asc'; + } + + var callback = this.fileEditor.callback; + var edited = this.fileEditor.beingEdited; + var action_called = this.fileEditor.actionCalled; + + /* Re-load file list */ + this.fileEditor = new Object(); + + if (action_called != true) { + if (command == 'uncompress') this.commandDialog({ success : json.success, message : json.message, refresh : true }); + else this.cd(json); + this.resetForm(command); + } + + /* Excutive editor's callback if available */ + if (edited && typeof(callback) == 'function') { + callback(); + } + } + else if (json.message) { + this.showMessage(json); + } + } +} + +/* + actionResponse method handles displaying the result of actions that aren't requried 'submit' button hit + (e.g.: delete, perl, print...) + html : should be html code +*/ +FileMan.prototype.actionResponse = function(html) { + this.form.append(''); + if ($('#command-dialog').length == 0) { + var contentframe_height = this.height.content - this.height.toolbar + this.height.folder; + this.fadeOut($('.paging')); + this.fadeOut($('.readme')); + this.fadeOut($('.foldertab'), function() { $(".contentframe").css('height', contentframe_height + 'px'); }); + $('.contentframe').append(''); + } + this.fadeIn($('#command-dialog').html(html)); +} + +/* + actionForm method prints out a action form. + action : should be an action + args : should be a hash of all parameters that are passed in. +*/ +FileMan.prototype.actionForm = function(action, args) { + var fm = this; + + this.printForm(action, function (response) { + if (response.success) { + fm.actionDialog({ action : action, json : response }); + } + else if (response.message) { + fm.showMessage(response); + } + }, args); +} + +/* + uploadFiles : allows multiple files uploading +*/ +FileMan.prototype.uploadFiles = function() { + var $modal = $('#modal-dialog'); + var html = '
' + this.hiddens.hidden_objects + + '

Upload Files

' + + '
'; + + var mwidth = 650; + var mleft = parseInt(($(window).width() - mwidth) / 2); + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '20%') + .html(html).jqmShow(); + + var fm = this; + $modal.find('a[rel="addfile"]').click(function() { + var uploads = $modal.find('input[type="file"]'); + if (uploads.length == fm.config.max_upload) return false; + if (uploads.length < fm.config.max_upload) { + $('#upfiles').append('
'); + $modal.find('input[name="num_files"]').val(uploads.length + 1); + } + return false; + }); + + $modal.find('.close').css('cursor', 'pointer').click(function() { $modal.html('').jqmHide(); }); + + var form = $modal.find('form'); + form.submit(function() { + $(this).hide(); + fm.upload(true); + }); + + form.ajaxForm({ + dataType : 'json', + success : function(response) { fm.commandResponse(response); } + }); + + return false; +} + +/* + upload command +*/ +FileMan.prototype.upload = function(multiple) { + var $modal = $('#modal-dialog'); + var fm = this; + $modal.jqm({ + onHide : function(hash) { + if (fm.timerID > 0) { + window.clearTimeout(fm.timerID); + fm.timerID = 0; + } + $modal.find('.done').css('width', fm.config.uploadmax_width + 'px'); + hash.w.fadeOut('fast',function() { hash.o.remove(); }); + } + }).removeClass().addClass('modal-dialog upload-dialog').css('width', this.config.uploadmax_width + 25 + 'px').css('top', '40%').css('left', '35%'); + + var html = ''; + + this.config.serial = randomString(); + if (multiple) { + $modal.append(html).jqmShow(); + $modal.find('form').attr('action', this.config.cgi_url + '?serial=' + this.config.serial).attr('enctype', 'multipart/form-data'); + } + else { + $modal.html(html).jqmShow(); + this.form.attr('action', this.config.cgi_url + '?serial=' + this.config.serial).attr('enctype', 'multipart/form-data'); + } + + if (this.timerID > 0) { + window.clearTimeout(fm.timerID); + this.timerID = 0; + } + this.timerID = window.setTimeout(function() { fm.uploadProgress(); }, 500); +} + +/* + uploadProgress method + This method handles upload progress +*/ +FileMan.prototype.uploadProgress = function() { + var $modal = $('#modal-dialog'); + var fm = this; + this.printForm('upload', function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (response.success) { + var uploaded = response.data.uploaded; + var upload_size = response.data.upload_size; + var elapsed_time = response.data.elapsed_time; + var filename = response.data.filename; + var allowed_space= response.data.allowed_space; + var free_space = response.data.free_space; + + if ($modal.find('#uploaded').length == 0) { + $modal.find('.meter-info').empty().html('Uploading... of at 0 KB/sec; 00:00:00 remain'); + if (allowed_space > 0 && free_space > upload_size) { + $modal.jqmHide(); + window.clearTimeout(fm.timerID); + fm.timerID = 0; + fm.showMessage({ message : 'NO_SPACE', success : false }); + return; + } + } + + if (fm.cdata.upload_filename != filename) { + $modal.find('.meter-filename').html(filename); + fm.cdata.upload_filename = filename; + } + + var percentage = upload_size > 0 ? Math.ceil((uploaded / upload_size) * 100) : 0; + if (fm.cdata.uploaded == uploaded) { + percentage = 100; + $modal.find('.done').css('width', fm.config.uploadmax_width + 'px'); + } + else { + var done_width = parseInt(percentage * fm.config.uploadmax_width / 100); + if (done_width > 0) $modal.find('.done').css('width', done_width + 'px'); + } + + var speed = elapsed_time > 0 ? (uploaded / elapsed_time) : 0; + var time = parseInt((elapsed_time * 100) / percentage); + var remain = eval(time - elapsed_time); + + if (percentage == 100) { + window.clearTimeout(fm.timerID); + fm.timerID = 0; + $modal.find('.meter-info').empty().html('Copying...'); + } + else { + $modal.find('#uploaded').html(friendly_size(uploaded)); + $modal.find('#upload-size').html(friendly_size(upload_size)); + $modal.find('#upload-speed').html(friendly_size(speed, 1, upload_size)); + $modal.find('#remain').html(format_time(remain)); + + fm.cdata.uploaded = uploaded; + fm.timerID = window.setTimeout(function() { fm.uploadProgress(); }, 500); + } + } + }, { upload : this.config.serial }); +} + +/* Download command */ +FileMan.prototype.download = function() { + var file = $('.foldertab input[name="cinput"][checked]'); + if (file.length == 0) { + this.showMessage({ success : false, message : "No File was selected." }); + } + else if (file.length > 1 && $('#cmd-download select[name="download_compress"]').val() == 0) { + this.showMessage({ success : false, message : 'No mode was selected.' }); + } +} + +/* + Perl command +*/ +FileMan.prototype.perl = function(json) { + this.resetCommand(); + + if (json.success) { + this.showStatus('perl'); + + var html = '
';
+        for (var i=0; i\n' +  message + '

'; + } + html += '
'; + this.actionResponse(html); + } + else { + this.showMessage(json); + } +} + +/* + hideMessage method: which does hide the message bar +*/ +FileMan.prototype.hideMessage = function() { + var $contentframe = $('#command-dialog .contentframe').length > 0 ? $('#command-dialog .contentframe') : $('.contentframe'); + var command_height = $('#contentheader').is(':hidden') ? 0 : $('#contentheader').height(); + var toolbar_height = this.height.toolbar - ($('#command-dialog .contentframe').length > 0 ? this.height.folder : 0); + var command = this.current.command || this.current.action; + + var fm = this; + this.slideUp($('#contentmessage').stopTime('msgtimer')); + this.animate($("#ocwrapper"), { + 'margin-top' : command_height, + 'height' : this.height.wrapper - command_height + }, 'normal', function() { + $("#content").css('height', fm.height.content - command_height + 'px'); + $contentframe.css('height', fm.height.content - toolbar_height - command_height + 'px'); + $('#' + command + '_input').focus(); + }); +} + +/* + showMessage method which shows message bar + args: should be a hash as { message : 'blah', success : true/fase } +*/ +FileMan.prototype.showMessage = function(args) { + var success = args.success; + var message = args.message; + var $content_message = $('#contentmessage'); + var $content = $('#content'); + var $contentframe = $('#command-dialog .contentframe').length > 0 ? $('#command-dialog .contentframe') : $('.contentframe'); + var command = this.current.command || this.current.action; + var fm = this; + var commnand = this.current.command || this.current.action; + + $content_message.stopTime('msgtimer'); + if ($content_message.is(':hidden')) { + this.animate($contentframe, { + height : $contentframe.height() - this.height.contentmessage + }, 'normal', function() { + fm.animate($content, { + height : $content.height() - fm.height.contentmessage - 2 + }, 'normal', function() { + $content_message.removeClass(success ? 'error' : 'message').addClass(success ? 'message' : 'error').text(message); + fm.slideDown($content_message, function() { + if (!success) $('#' + command + '_input').focus(); + }); + }); + }); + + if (!success) $content_message.oneTime(5000, 'msgtimer', function() { fm.hideMessage(); }); + } + else { + $content_message.removeClass(success ? 'error' : 'message').addClass(success ? 'message' : 'error').text(message); + if (!success) $content_message.oneTime(5000, 'msgtimer', function() { fm.hideMessage(); }); + } +} + +/* + Print command +*/ +FileMan.prototype.print = function(json) { + if (json.success) { + var files = json.data.files; + var url = this.config.cgi_url + '?cmd=print;print=1' + this.hiddens.hidden_query; + var fm = this; + for (var i=0; i 0) { + var count = 0; + var confirms = json.data.confirms; + var fm = this; + + /* Print out the confirmation modal dialog */ + this.modalConfirm({ + data : json.data, + del : true, + html : 'Do you want to delete ' + confirms[0] + '', + yes : function($modal) { + $modal.find('input[name="confirm-name"]').val(confirms[count]); + $modal.find('form').submit(); + }, + all : function($modal) { + $modal.find('input[name="confirm-name"]').val('delete-all'); + $modal.find('form').submit(); + }, + skip : function($modal) { + /* Remove file from the list */ + $modal.find('input[name="cinput"][value="' + confirms[count] + '"]').remove(); + + count++; + if (count == confirms.length) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-skip'); + $modal.find('form').submit(); + } + else { + fm.resetCommand(); + $modal.html('').jqmHide(); + } + } + else { + $modal.find('#confirm-name').html(confirms[count]); + $modal.find('input[name="confirm-name"]').val(confirms[count]); + } + }, + cancel : function($modal) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-cancel'); + $modal.find('form').submit(); + } + else { + fm.resetCommand(); + $modal.html('').jqmHide(); + } + } + }); + } + else { + /* Hide the modal dialog if visible */ + $('#modal-dialog').html('').jqm().jqmHide(); + if (json.success) { + this.resetCommand(); + this.cd(json); + } + else { + this.showMessage(json); + } + } +} + +/* Copy/Move command */ +FileMan.prototype.copy = function(json) { + var command = this.current.command || this.current.action; + + /* Need to confirm on overwrite existing files */ + if (json.success && json.data.confirms && json.data.confirms.length > 0) { + var count = 0; + var confirms = json.data.confirms; + var fm = this; + + /* Print out the confirmation modal dialog */ + this.modalConfirm({ + data : json.data, + html : 'Do you want to overwrite ' + confirms[0] + '', + yes : function($modal) { + $modal.find('input[name="confirm-name"]').val(confirms[count]); + $modal.find('form').submit(); + }, + all : function($modal) { + $modal.find('input[name="confirm-name"]').val('copy-all'); + $modal.find('form').submit(); + }, + skip : function($modal) { + /* Remove file from the list */ + $modal.find('input[name="cinput"][value="' + confirms[count] + '"]').remove(); + + count++; + if (count == confirms.length) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-skip'); + $modal.find('form').submit(); + } + else { + $modal.html('').jqmHide(); + } + } + else { + $modal.find('#confirm-name').html(confirms[count]); + $modal.find('input[name="confirm-name"]').val(confirms[count]); + } + }, + cancel : function($modal) { + if (json.data.num_done > 0) { + $modal.find('input[name="confirm-name"]').val('button-cancel'); + $modal.find('form').submit(); + } + else { + $modal.html('').jqmHide(); + } + } + }); + } + else { + /* Hide the modal dialog if visible */ + $('#modal-dialog').html('').jqm().jqmHide(); + + /* Reset values */ + if (json.success) { + this.cd(json); + $('#' + command + '_input').val('').focus(); + } + else { + this.showMessage(json); + } + } +} + +/* + The command command +*/ +FileMan.prototype.command = function() { + this.config.serial = randomString(); + $('#serial').val(this.config.serial); + + if (this.timerID > 0) { + window.clearTimeout(this.timerID); + this.timerID = 0; + } + + var fm = this; + var longrun = $('#opt_long').attr('checked') ? true : false; + this.timerID = window.setTimeout( + function() { + fm.commandProgress(fm.config.serial, ';command_input=' + $('#command_input').val() + (longrun ? ';long=1' : '')); + }, (longrun ? 80 : 100) + ); +} + +/* + commandProgress method handles command output + randome_str : should be a unique string + input : should be a string of command inputs +*/ +FileMan.prototype.commandProgress = function(random_str, input) { + var fm = this; var flag = true; + var $first_prompt = $('#command-dialog span[class="prompt"]:first'); + if ($('#' + random_str).length == 0) { + $first_prompt.after('
'); + } + else { + flag = false; + } + $.ajax({ + type : 'GET', + url : this.config.cgi_url + '?cmd=command' + input + (this.working_dir ? ';working_dir=' + this.working_dir : '') + ';serial=' + this.config.serial + ';retrieve=1;ajax=1' + this.hiddens.hidden_query, + dataType : 'xml', + cache : false, + success : function(response, tstatus) { + var prompt = response.getElementsByTagName('prompt')[0].firstChild.nodeValue; + var next_prompt = response.getElementsByTagName('next_prompt')[0].firstChild.nodeValue; + var command = response.getElementsByTagName('command')[0].firstChild.nodeValue; + var output = response.getElementsByTagName('output')[0].firstChild.nodeValue; + fm.working_dir = response.getElementsByTagName('working')[0].firstChild.nodeValue; + $('#cmd-command input[name="working_dir"]').val(fm.working_dir); + + if (flag) { + $('#command_input').val('').focus(); + $('#cmd-' + random_str).html('' + htmlEscape(prompt) + ' ' + htmlEscape(command)); + } + if (next_prompt != $first_prompt.html()) $first_prompt.html(htmlEscape(next_prompt)); + + if (output.search(/timeout|done/) > -1) { + output = output.replace(/done/, ''); + $('#' + random_str).html('
' + htmlEscape(output) + '
'); + + /* Clear timer ID */ + window.clearTimeout(fm.timerID); + fm.timerID = 0; + $.ajax({ + type : 'GET', + dataType : 'xml', + cache : false, + url : fm.config.cgi_url + '?cmd=command;serial=' + fm.config.serial + ';remove=1;ajax=1' + fm.hiddens.hidden_query + }); + } + else { + $('#' + random_str).html('
' + output + '
'); + fm.timerID = window.setTimeout(function() { fm.commandProgress(random_str, input); }, 500); + } + } + }); +} + +/* + List information about the files of a directory + args : should be a hash of all options + func : should be a callback function. +*/ +FileMan.prototype.ls = function(args, func) { + if (!args) args = new Object(); + var dname = args.dname || ''; + var html = '
' + + '' + + '' + (args.hidden_objects || this.hiddens.hidden_objects) + '
'; + + var $form = $('#cdbar').append(html).find('#tmpform'); + if (args.breadcrumbs) $form.find('input[name="work_path"]').val(''); + + var params = new Array('load_default', 'filter', 'a'); + for (var i=0; i'); + } + + var fm = this; + $form.submit(function() { + $(this).ajaxSubmit({ + dataType : 'json', + success : function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (typeof(func) == 'function') { + func(response); + } + $form.remove(); + } + }); + return false; + }); + $form.submit(); +} + +FileMan.prototype.loading = function(action) { + if (action == 'start') { + var fm = this; + this.timer = true; + $(document).oneTime(this.config.timer, 'waitingtimer', function() { + if (!fm.timer) return; + var mwidth = 16; + var mleft = parseInt((fm.screen.width - mwidth) / 2); + $('#waiting-dialog').jqm().removeClass().addClass('modal-dialog modal-waiting') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '40%') + .html('').jqmShow(); + }); + } + else { + this.timer = false; + if (!$('#waiting-dialog').is(':hidden')) $('#waiting-dialog').html('').jqmHide(); + } +} +/* + cd command + args : should be a hash of + dname : should be directory name where you want to cd to + breadcrumbs : should be true/false. work_path will be set to null if it's true + work_path : should be true/false +*/ +FileMan.prototype.cd = function(args) { + if (!args) args = new Object(); + + this.loading('start'); + var success = args.success; + var fm = this; + this.ls(args, function(response) { + if (response.success) { + fm.paging.num_hits = response.data.hits; + fm.paging.size = response.data.size; + fm.paging.current_page = 1; + fm.hiddens = response.data.hiddens; + fm.readme = response.data.readme_content; + + if (response.data.root_path) fm.config.root_path = response.data.root_path; + $('#hiddens').empty().append(fm.hiddens.hidden_objects); + + if (response.data.paths) { + fm.paths = response.data.paths.loop; + fm.parent = response.data.paths.parent; + fm.config.work_path = response.data.paths.work_path; + } + else { + fm.paths = new Array(); + fm.parent = ''; + fm.config.work_path = '/'; + } + + /* Print out the list of files, sorting, bread crumbs, paging */ + fm.sort(response.data.files, fm.paging.sb, fm.paging.so); + fm.breadCrumbs(); + fm.page(fm.paging, function(nh) { fm.printFiles(nh); }); + fm.showStatus(); + + $('#cdform input[name="dname"]').focus(); + + if ($('#listfiles').is(':hidden') || $('.foldertab').is(':hidden')) { + fm.commandDialog(args); + } + else if (!success && !$('#contentmessage').is(':hidden')) { + fm.hideMessage(); + } + else if (success) { + fm.showMessage(args); + } + + fm.htaccess(response.data.htaccess_users); + } + else { + fm.showMessage(response); + } + fm.loading('end'); + }); +} + +/* + modalConfirm show a modal confirm dialog + args : should be a hash of all actions + e.g. + object.modalConfirm({ + data : 'json data object', + yes : function($modal) { + Do something here.. + }, + no : function($modal) { + blah blah.. + } + .... + }); +*/ +FileMan.prototype.modalConfirm = function(args) { + var $modal = $('#modal-dialog'); + var html = '
' + + '' + this.hiddens.hidden_objects + + '

Confirmation

' + + '
'; + + var nwidth = 400; + var nleft = parseInt($(window).width() - nwidth) /2; + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form modal-confirm') + .css('left', nleft + 'px').css('top', '30%').css('width', nwidth + 'px') + .html(html).jqmShow().find('input[type="button"]').click(function() { + var name = $(this).attr('name'); + if (name == 'button-yes' && typeof(args.yes) == 'function') args.yes($modal); + else if (name == 'button-all' && typeof(args.all) == 'function') args.all($modal); + else if (name == 'button-skip' && typeof(args.skip) == 'function') args.skip($modal); + else if (name == 'button-no' && typeof(args.no) == 'function') args.no($modal); + else if (name == 'button-cancel' && typeof(args.cancel) == 'function') args.cancel($modal); + }); + var fm = this; + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $('select[class="action"]').val(''); + fm.current.action = ''; + $modal.jqmHide(); + }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(data) { + fm.commandResponse(data); + } + }); +} + +/* + printFiles method handles files listing + nh : should be a page number +*/ +FileMan.prototype.printFiles = function(nh) { + if (typeof(nh) == 'undefined') nh = 1; + + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var $body = $('.contentframe table[class="foldertab"]'); + $body.empty(); + $('.readme').remove(); + + var count = 0; + var array = ''; + var maps = this.maps; + + /* Print out parent link */ + if (this.parent != '') { + var tr = ' <\/td>' + + '
File Folder<\/a><\/div><\/td>' + + '..<\/a><\/td>' + + ' <\/td>' + + ' <\/td>' + + ' <\/td>' + + ' <\/td>'; + + tr += this.config.is_win + ? '<\/tr>\n<\/td>\n>' + : ' <\/td><\/tr>\n<\/td>\n'; + + $body.append(tr); + + $('.link-uplevel').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname : link.attr('rel') }); + return false; + }); + }); + } + + /* Print out a empty page */ + if (this.files.length == 0) { + $('#fm_action').attr('disabled', true); + $('#checkall').attr('disabled', true); + $body.append('No files were found!<\/td><\/tr>'); + } + else { + $('#fm_action').attr('disabled', ''); + $('#checkall').attr('disabled', ''); + + /* Print files of page n */ + for (var i=beg; i<\/td>' + + '
File Folder<\/a><\/div><\/td>' + + '' + this.files[i][maps.name] + '<\/a><\/td>' + + '' + (this.files[i][maps.type] == 1 ? ' ' : friendly_size(this.files[i][maps.size])) + '<\/td>' + + '' + this.files[i][maps.desc] + '<\/td>' + + '' + this.files[i][maps.sdate] + '<\/td>'; + + tr += this.config.is_win + ? '\n<\/td><\/tr>\n' + : '' + this.files[i][maps.owner] + '<\/td>' + this.files[i][maps.sperm] + '<\/a><\/td><\/tr>\n<\/td><\/tr>\n'; + + $body.append(tr); + count++; + } + } + + /* display README content if enabled */ + if (this.readme != '') { + if (this.config.readme == 2) { + $body.after('

README\'s content

\n' + this.readme + '
'); + } + else if (this.config.readme == 1) { + $body.before('
README\'s content\n' + this.readme + '
'); + } + } + + /* Set an action for File Folder icons/links */ + var fm = this; + $('.link-folder[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for File icons */ + $('.icon').find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.printForm('preview', function (response) { + if (response.success) { + fm.preview(response.data.file); + } + else { + fm.showMessage(response); + } + }, { f : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for File links */ + $('.name').find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.loading('start'); + fm.form.find('input[name="cmd-result"]').remove(); + fm.printForm('edit', function(response) { + if (response.success) { + if (response.data.compressed == 1) { + fm.actionDialog({ action : 'uncompress', json : response }); + } + else if (response.data.file) { + fm.preview(response.data.file); + } + else { + fm.editor('edit', link.attr('rel'), response.data.type, response.data.html); + } + } + else { + fm.showMessage(response); + } + + fm.loading('end'); + }, { f : link.attr('rel') }); + return false; + }); + }); + + /* Set an action for permission links */ + $('td[class="permission"]').find('a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.parsePerm(link.attr('rel')); + return false; + }); + }); + + /* Print out the sorting image */ + $('.foldertab th a[rel] img').remove(); + $('.foldertab th a[rel="' + this.paging.sb + '"]').append(' '); + + /* Set actions for checkboxes */ + var $foldertab = $('.foldertab'); + $foldertab.find('input[name="checkall"]').attr('checked', false); + + $foldertab.find('input[type="checkbox"]').each(function() { + $(this).change(function() { + if ($(this).val() == 'checkall') { + $foldertab.find('input[type="checkbox"]').attr('checked', $(this).attr('checked') ? true : false); + } + else { + var flag = true; + var fname; var selected = 0; + $foldertab.find('input[name="cinput"]').each(function() { + if ($(this).attr('checked')) { + selected++; + fname = $(this).val(); + } + else { + flag = false; + } + }); + if (selected == 1 && fm.current.action == 'chmod') fm.parsePerm(fname); + $foldertab.find('input[name="checkall"]').attr('checked', flag); + } + fm.fileStats(); + }); + }); +} + +/* + sort method handle sorting files + source : should be an array + sb : sort by column index + so : sort order. It should be asc/desc +*/ +FileMan.prototype.sort = function(source, sb, so) { + this.paging.current_page = 1; + if (typeof(source) == 'undefined') return; + if (typeof(source) == 'object' || source.length > 0) { + + /* Need to seperate folders and files before sorting */ + var afolders = new Array(); var afiles = new Array(); + var maps = this.maps; + for (var i=0; i 0) afolders.qsort(0, afolders.length, maps[sb], so); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps[sb], so); + + if (so == 'desc') { + for (var i=0; i' + selected + ' files, ' + friendly_size(size) + ''); +} + +/* Create path bread-crumbs */ +FileMan.prototype.breadCrumbs = function() { + var bread_crumbs = '
' + ($('#uaccess').length > 0 ? (this.config.root_path + '<\/a>') : ('Root<\/a>: ')); + for (var i=0; i' + this.paths[i].folder + '<\/a>'; + } + $('#bread-crumbs').html(bread_crumbs); + + var fm = this; + $('#bread-crumbs a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.cd({ dname: link.attr('rel'), breadcrumbs : true }); + return false; + }); + }); +} + +/* Reset command variables */ +FileMan.prototype.resetCommand = function() { + this.current.command = null; + this.current.action = null; + $('#cmd').val(''); + $('#fm_action').attr('selectedIndex', 0); +} + +/* resetForm method: reset all inputs */ +FileMan.prototype.resetForm = function(command) { + $('#cmd-' + command + ' *').each(function() { + var type = $(this).attr('type'); + if (type && type.search(/text|password|file/) == 0) $(this).val(''); + else if (type == 'checkbox' || type == 'radio') $(this).attr('checked', false); + else if (this.tagName == 'SELECT') $(this).attr('selectedIndex', 0); + }); + if (command == 'upload') document.getElementById('myform').reset(); +} + +/* showStatus method */ +FileMan.prototype.showStatus = function(status) { + var contentfooter = $('#contentfooter'); + if (status) { + contentfooter.find('.status').html(status); + contentfooter.find('.summary').addClass('hide'); + } + else { + this.fileStats(); + contentfooter.find('.summary').removeClass().addClass('summary').html('Total ' + this.paging.num_hits + ' files, ' + friendly_size(this.paging.size) + ''); + } +} + +/* + parsePerm method gets permission info of a file + fname : should be filename +*/ +FileMan.prototype.parsePerm = function(fname) { + $('#fm_action').val('chmod').change(); + + /* Loading file info */ + var beg = this.paging.current_page == 1 ? 0 : ((this.paging.current_page - 1) * this.paging.max_hits); + var count = 0; + var file = new Array(); + for (var i=beg; i= 16) { + $('#ar').attr('checked', sperm.substr(0,1) == 'r' ? true : false); + $('#aw').attr('checked', sperm.substr(1,1) == 'w' ? true : false); + $('#ax').attr('checked', sperm.substr(2,1) == 'x' ? true : false); + $('#ur').attr('checked', sperm.substr(4,1) == 'r' ? true : false); + $('#uw').attr('checked', sperm.substr(5,1) == 'w' ? true : false); + $('#ux').attr('checked', sperm.substr(6,1) == 'x' ? true : false); + $('#gr').attr('checked', sperm.substr(8,1) == 'r' ? true : false); + $('#gw').attr('checked', sperm.substr(9,1) == 'w' ? true : false); + $('#gx').attr('checked', sperm.substr(10,1) == 'x' ? true : false); + $('#or').attr('checked', sperm.substr(12,1) == 'r' ? true : false); + $('#ow').attr('checked', sperm.substr(13,1) == 'w' ? true : false); + $('#ox').attr('checked', sperm.substr(14,1) == 'x' ? true : false); + } + else { + $('#ur').attr('checked', sperm.substr(0,1) == 'r' ? true : false); + $('#uw').attr('checked', sperm.substr(1,1) == 'w' ? true : false); + $('#ux').attr('checked', sperm.substr(2,1) == 'x' ? true : false); + $('#gr').attr('checked', sperm.substr(4,1) == 'r' ? true : false); + $('#gw').attr('checked', sperm.substr(5,1) == 'w' ? true : false); + $('#gx').attr('checked', sperm.substr(6,1) == 'x' ? true : false); + $('#or').attr('checked', sperm.substr(8,1) == 'r' ? true : false); + $('#ow').attr('checked', sperm.substr(9,1) == 'w' ? true : false); + $('#ox').attr('checked', sperm.substr(10,1)== 'x' ? true : false); + } + + $('#chmod_input').val(file[this.maps.perm]); +} + +/* + chmod command +*/ +FileMan.prototype.chmod = function(octal) { + if (octal && octal.length > 0) { + var perm_map = { 0: 'u',1 : 'g',2 : 'o' }; + var nums = octal.split(""); + var count = 0; + for (var i=0; i'); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : files.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'name', so : 'asc' }, + action : function(nh) { fm.printCompressed(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + return false; + }); + }); + +/* Set actions for checkboxes */ + var $foldertab = $('#command-dialog .foldertab'); + $foldertab.find('input[type="checkbox"]').each(function() { + $(this).click(function() { + if ($(this).val() == 'checkall') { + $foldertab.find('input[type="checkbox"]').attr('checked', $(this).attr('checked') ? true : false); + } + else { + var flag = true; + $foldertab.find('input[name="compress"]').each(function() { + if ($(this).attr('checked')) return; + flag = false; + return false; + }); + + $foldertab.find('input[name="checkall"]').attr('checked', flag); + } + fm.fileStats({ inputs : $inputs, nh : fm.cdata.nh, files : fm.cdata.files }); + }); + }); + + /* Handle paging */ + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : files.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'name', so : 'asc' }, + action : function(nh) { fm.printCompressed(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + $('#command-dialog input[name="button-browse"]').click(function() { + fm.browse({ + title : 'Select Directory', + filter : 1, + hidden_query : fm.hiddens.hidden_query, + id : 'uncompress_input' + }); + }); + + this.fileStats({ inputs : $('#command-dialog .foldertab').find('input[name="compress"]'), nh : this.cdata.nh, files : this.cdata.files }); + $('#contentfooter .summary').removeClass().addClass('summary').html('Total ' + files.length + ' files, ' + friendly_size(this.cdata.size) + ''); +} + +/* + This method handles sorting compressed's content +*/ +FileMan.prototype.sortCompressed = function(sb) { + if (this.cdata.files.length == 0) return; + + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + this.cdata.nh = 1; + + /* Need to seperate folders and files before sorting */ + var afolders = new Array(); var afiles = new Array(); + var maps = this.maps; + var files = this.cdata.files; + var size = 0; + + for (var i=0; i 0) afolders.qsort(0, afolders.length, maps[sb], so); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps[sb], so); + + if (so == 'desc') { + for (var i=0; i<\/td>' + + '
<\/div><\/td>' + + '' +files[i][maps.name] + '<\/td>' + + '' + (files[i][maps.type] == 1 ? ' ' : friendly_size(files[i][maps.size])) + '<\/td>' + + '' + files[i][maps.desc] + '<\/td>' + + '' + files[i][maps.sdate] + '<\/td>'; + + tr += this.config.is_win + ? '\n<\/td><\/tr>\n' + : '' + files[i][maps.owner] + '<\/td>' + files[i][maps.sperm] + '<\/td><\/tr>\n<\/td><\/tr>\n'; + + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +FileMan.prototype.editorConfirm = function(func) { + var fm = this; + this.modalConfirm({ + html : 'Do you want to save your changes?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.fileEditor.callback = function() { + if (typeof(func) == 'function') func(); + } + fm.form.submit(); + }, + no : function($modal) { + $modal.html('').jqmHide(); + fm.fileEditor = new Object(); + if (typeof(func) == 'function') func(); + }, + cancel : function($modal) { + $modal.html('').jqmHide(); + } + }); +} + +FileMan.prototype.newfile = function() { + var fm = this; + if (this.fileEditor.beingEdited) { + this.fileEditor.actionCalled = true; + return this.editorConfirm(function() { fm.newfile(); }); + } + + this.form.find('input[name="cmd-result"]').remove(); + this.printForm('file', function(response) { + if (response.success) { + /* Remove command-dialog if exists */ + var $command_dialog = $('#command-dialog'); + if ($command_dialog.length > 0) { + fm.fadeOut($command_dialog, function() { + $command_dialog.remove(); + fm.editor('file', '', '', response.data.html); + }); + } + else { + fm.editor('file', '', '', response.data.html); + } + } + else { + fm.showMessage(response); + } + }); +} +/* + File command + command : should be newfile/edit + filename : shoule be file name +*/ +FileMan.prototype.editor = function(command, filename, filetype, html) { + var content = $('#content').append(html).find('textarea').val(); + this.config.tinyMCE.plugins = (filename != '' && content.search(/||<body/i) == -1) + ? "style,table,advhr,advimage,advlink,preview,media,searchreplace" + : "style,table,advhr,advimage,advlink,preview,media,searchreplace,fullpage"; + + /* Remove these objects if they already exist */ + $('#edit_input').val(filename || ''); + this.form.find('input[name="file"]').remove(); + this.form.find('input[name="overwrite_confirmed"]').remove(); + + if (filename) { + this.form.append('<input type="hidden" name="file" value="' + filename + '" />'); + this.showStatus(filename + ' (<span>' + this.config.work_path + '</span>)'); + } + else { + this.showStatus('[No Name]'); + } + + /* Editor switch mode action */ + var $switch_mode = $('.switch-mode'); + var $editor_mode = $('#editor_mode'); + + if (filetype == 'html' || filetype == '') { + this.fadeIn($switch_mode.val('Switch To ' + ($editor_mode.val() == 'html' ? 'TEXT' : 'HTML'))); + } + else { + this.fadeOut($switch_mode); + } + + var fm = this; + this.fileEditor.beingEdited = false; + $switch_mode.click(function() { + var mode = $editor_mode.val(); + if (mode == 'html') { + var content = fm.tinyMCEContent(); + tinyMCE.activeEditor.hide(); + fm.fadeIn($('textarea[name="editor"]').val(content).css('height', $('#command-dialog').height() - 5 + 'px')); + } + else { + var editor = $('#command-dialog textarea[name="editor"]'); + editor.css('height', editor.height() - 8 + 'px'); + + if (tinyMCE.activeEditor && tinyMCE.activeEditor.isHidden()) { + tinyMCE.activeEditor.show(); + } + else { + tinyMCE.init(fm.config.tinyMCE); + } + } + $editor_mode.val(mode == 'html' ? 'text' : 'html'); + $switch_mode.val('Switch To ' + (mode == 'html' ? 'HTML' : 'TEXT')); + }); + + this.commandDialog({ command : command, value : filename }); +} + +/* + This method handles preview/download a file. + file : File information. It should be a hash + download : if it's passed it, file will be sent to browser +*/ +FileMan.prototype.preview = function(file, download) { + if (typeof(file) != 'object') return; + if (!download && file.type.search(/image|text|html/) == 0) { + var content = file.type.search(/html|text/) == 0 + ? ('<pre>' + file.content + '</pre>') + : ('<div class="preview-image"><img src="' + this.config.cgi_url + '?cmd=fdownload;f=' + file.name + this.hiddens.hidden_query + '" title="' + file.name + '" /></div>'); + + var html = '<div class="toolbar clear"><h3 class="header">Preview a File</h3>' + + '<div><b>' + file.name + '</b></div></div>' + + '<div class="contentframe">' + content + '</div>'; + this.actionDialog({ action : 'preview', json : { data : { html : html }} }); + } + else { + var src = this.config.cgi_url + '?cmd=fdownload;f=' + file.name + if (file.source) src += ';type=' + file.source; + if (file.mode) src += ';mode=' + file.mode; + src += this.hiddens.hidden_query; + + if ($('.contentframe iframe[name="preview"]').length == 0) { + $('.contentframe').append('<iframe name="preview" src="' + src + '" class="hide"></iframe>'); + } + else { + $('.contentframe iframe[name="preview"]').attr('src', src); + } + } +} + +/* + printForm: print out a command form +*/ +FileMan.prototype.printForm = function(action, func, args) { + var html = '<form id="tmpform" action="' + this.config.cgi_url + '" method="post" class="hide">' + + '<input type="hidden" name="cmd" value="' + action +'" /><input type="hidden" name="ajax" value="1" /><input type="hidden" name="form" value="1" />'; + + if (action == 'command') { + html += '<input type="hidden" name="prompt" value="1" />'; + $('#cmd-command input[name="working_dir"]').val(''); + } + + if (args && typeof(args) == 'object') { + for (var i in args) { + if (typeof(args[i]) == 'object') { + for (j=0; j<args[i].length;j++) { + html += '<input type="hidden" name="' + i + '" value="' + args[i][j] + '" />'; + } + } + else { + html += '<input type="hidden" name="' + i + '" value="' + args[i] + '" />'; + } + } + } + + html += this.hiddens.hidden_objects + '</form>'; + + var $form = $('#home').append(html).find('#tmpform'); + var fm = this; + $form.submit(function() { + $(this).ajaxSubmit({ + dataType : 'json', + success : function(response) { + if (response.status == 'ERR_NOAUTH') { + fm.login(response.data.html); + } + else if (typeof(func) == 'function') { + func(response); + } + $form.remove(); + } + }); + return false; + }); + + $form.submit(); +} + +/* + advanceSearch command +*/ +FileMan.prototype.advanceSearch = function() { + var fm = this; + this.printForm('search', function(response) { + var $modal = $('#modal-dialog'); + var mwidth = 650; + var mleft = parseInt(($(window).width() - mwidth) / 2); + var mtop = parseInt(($(window).height() - 400) / 2); + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', mtop + 'px') + .html(response.data.html).jqmShow().find('input[name="search_input"]').focus(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $modal.jqmHide(); + fm.form.find('input[name="search_input"]').focus(); + }); + + if (response.success) { + $modal.find('form').ajaxForm({ + dataType : 'json', + success : function(res) { + if (res.success) { + if (res.data.hits == 0) { + $modal.find('form p.error').show().text(res.message); + } + else { + fm.commandResponse(res); + $modal.jqmHide(); + } + } + else { + $modal.find('form p.error').show().text(res.message); + $modal.find('input[name="search_input"]').focus(); + } + } + }); + + $modal.find('.date-pick').datePicker({ clickInput : true, startDate: fm.startDate() }); + $('#fromdate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#todate').dpSetStartDate(d.addDays(1).asString()); + } + }).dpSetDisabled(true); + + $('#todate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#fromdate').dpSetEndDate(d.addDays(-1).asString()); + } + }).dpSetDisabled(true); + + $modal.find('input[name="search_mod"]').each(function() { + var obj = $(this); + obj.click(function() { + var flag = obj.val() == 'date' ? false : true; + $('#fromdate').dpSetDisabled(flag); + $('#todate').dpSetDisabled(flag); + }); + }); + } + else { + this.showMessage(response); + } + }); + return false; +} + +FileMan.prototype.userAction = function(action) { + if (!action || action == '') return; + + if (action == 'user_add') return this.actionForm(action); + + var selected = $('#command-dialog').find('input[name="cuser"][checked]'); + if (selected.length == 0) { + $('#user_action').attr('selectedIndex', 0); + this.showMessage({ success : false, message : "No user was selected." }); + return; + } + + /* Return the modify form instead if one user is selected */ + if (action.search(/user_access|user_permission/) == 0) { + var cuser = new Array; + selected.each(function() { + cuser.push($(this).val()); + }); + this.actionForm(action, { cuser : cuser }); + } + else { + this.current.action = action; + $('#cmd').val(action); + + var fm = this; + this.modalConfirm({ + html : 'Do you want to delete selected user(s)?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#user_action').val(''); + $modal.html('').jqmHide(); + } + }); + } +} + +FileMan.prototype.userManagement = function(json) { + if (json.data.users.length == 0) { + $('#user_action').attr('disabled', true); + return; + } + + this.cdata = { + map : { type : 0, username : 1, password : 2, name : 3, email : 4, added : 5, permission : 6, access : 7, allowed_space : 8 }, + users : json.data.users, + so : 'desc', + nh : 1 + }; + this.sortUsers(); + var fm = this; + $('#command-dialog th a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.sortUsers(link.attr('rel')); + + var so = fm.cdata.so || 'asc'; + $('#command-dialog th a[rel]').find('img').remove(); + $('#command-dialog th a[rel="' + link.attr('rel') + '"]').append(' <img src="' + fm.config.image_url + '/icons/' + (so == 'desc' ? 'descending.gif' : 'ascending.gif') + '" title="' + (so == 'desc' ? 'V' : '^') + '" \/>'); + return false; + }); + }); + $('#command-dialog select[name="user_action"]').change(function() { fm.userAction($(this).val()); }); + $('#command-dialog .contentframe .username a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.actionForm('user_modify', { u : link.attr('rel') }); + return false; + }); + }); +} + +FileMan.prototype.sortUsers = function(sb) { + if (!sb) sb = 'username'; + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + + var ausers = this.cdata.users; + var maps = this.cdata.map; + + ausers.qsort(0, ausers.length, maps[sb], so); + + this.cdata.users = ausers; + this.cdata.so = so; + this.printUsers(this.cdata.nh); +} + +FileMan.prototype.printUsers = function(nh) { + if (!nh) nh = 1; + + var ausers = this.cdata.users; + var maps = this.cdata.map; + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var body = $('#command-dialog .contentframe').find('table[class="foldertab"]'); + body.empty(); + + var count = 0; + for (var i=beg; i<ausers.length; i++) { + if (count == this.paging.max_hits) break; + var u = ausers[i]; + var access = new Array; + if (u[maps.access]) { + for (var j=0; j<u[maps.access].length; j++) { + var a = u[maps.access][j]; + access.push(a.disp); + } + } + var tr = '<tr><td class="selectbox"><input type="checkbox" name="cuser" value="' + u[maps.username] + '" /><\/td>' + + '<td class="username"><a href="#" rel="' + u[maps.username] + '">' + u[maps.username] + '</a><\/td>' + + '<td class="type">' + (u[maps.type] == 0 ? 'User' : 'Admin') + '<\/td>' + + '<td class="email">' + u[maps.email] + '<\/td>' + + '<td class="access"><pre>' + access.join("\n") + '</pre><\/td>'; + + tr += '<tr class="spacer"><td colspan="6"><\/td><\/tr>\n'; + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +/* + browse which allows you to select files, directories from a list + args : should be a hash of + - title : title of the windows + - filter : what you want to show up in the list. 1: folder only, 2: folder and text file + - multiple : allows multiple files selected + - id : the object ID you want to return to +*/ +FileMan.prototype.browse = function(args) { + if (!args) args = new Object(); + args['modal'] = true; + + this.cdata.changed= false; + + var $modal = $('#modal-dialog'); + var mwidth = 450; + var mleft = parseInt(($(window).width() - mwidth) / 2); + var html = '<form action="' + this.config.cgi_url + '" method="post">\n<h1 class="clear">\n<img src="' + this.config.image_url + '/icons/close.gif" title="Close" class="close" />\n<span>' + args.title + '</span>\n</h1><div class="modal-content">'; + if (args.filter == 2) html +='<p>Location: <input type="text" name="location" value="" class="text longtext" readonly \/>'; + html += '<p class="error hide"></p>\n<div class="currentpath"><span id="modal-breadcrumbs"></span></div>'; + +/* Root select box. */ + if (args.multiple) html += '<div class="rootpath"><input type="checkbox" id="location_root" value="1" /><label for="location_root">Root Directory</label></div>'; + + html += '<table class="foldertab">\n<tr>'; + +/* Allow multiple directories selected */ + if (args.multiple) html += '<th class="selectbox"> <\/th>'; + + html += '<th class="icon"><\/th>\n<th class="name">Name</th>\n<th class="scrollbar"><\/th><\/tr><\/table>\n' + + '<div class="contentframe">\n<table class="foldertab"><\/table><\/div>' + + '<div class="buttonbar clear"><span><input type="hidden" name="select_path" value="" \/><input type="button" name="button-cancel" value="Cancel" class="submit" /> <input type="button" name="button-select" value="Select" class="submit" \/><\/span>'; + html += '<input type="input" name="makedir_input" value="" class="text shorttext" \/><input type="submit" name="button-makedir" value="Create Folder" class="button" \/>'; + html += '</div></div><div id="hiddens" class="hide"><\/div><input type="hidden" name="cmd" value="makedir" \/><\/form>\n'; + + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px').css('top', '120px') + .html(html).jqmShow(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { + $modal.find('input[name="button-cancel"]').click(); + }); + + var fm = this; + $modal.find('input[name="button-cancel"]').click(function() { + $modal.html('').jqmHide(); + if (fm.cdata.changed) fm.cd(); + }); + + if (args.id) { + $modal.find('input[name="button-select"]').click(function() { + if (args.multiple) { + var accesses = ''; + if ($modal.find('#location_root').attr('checked')) { + accesses = '/'; + } + else { + for (var i=0; i<fm.cdata.accesses.length; i++) { + if (fm.cdata.accesses[i] == '' && fm.cdata.accesses[i] != fm.config.root_path) continue; + accesses += fm.cdata.accesses[i] + (i == fm.cdata.accesses.length - 1 ? '' : '\n'); + } + } + $('#' + args.id).val(accesses); + } + else { + var val = $modal.find('input[name="select_path"]').val(); + if (args.filter == 2) { + var loc = $modal.find('input[name="location"]').val() ; + if (loc != '') { + val += val == '/' ? loc : ('/' + loc); + $('#' + args.id).val(val); + } + else { + return; + } + } + else { + $('#' + args.id).val(val); + } + } + $modal.html('').jqmHide(); + }); + } + this.browseFiles($modal, args); +} + +/* + browseFiles: listing files and directories + $modal : shoule be modal object + args : should be a hash of all paramters +*/ +FileMan.prototype.browseFiles = function($modal, args) { + var dname = args.dname; + var hidden_query = args.hidden_query || ''; + + var fm = this; + var maps = this.maps; + var url = '?cmd=cd' + (args.filter > 0 ? (';filter=' + args.filter) : '') + hidden_query + (typeof(dname) != 'undefined' ? ';f=' + dname : ''); + if (args.multiple) url += ';multiple=1'; + this.ls(args, function(response) { + if (response.success) { + var source = response.data.files; + var hiddens = response.data.hiddens; + var paths = new Array(); + var parent = ''; + var work_path = ''; + + if (response.data.paths) { + paths = response.data.paths.loop; + parent = response.data.paths.parent; + work_path = response.data.paths.work_path; + } + + var afolders = new Array(); var afiles = new Array(); + for (var i=0; i<source.length; i++) { + if (source[i][maps.type] == 1) afolders.push(source[i]); + else afiles.push(source[i]); + } + + if (afolders.length > 0) afolders.qsort(0, afolders.length, maps['name'], 'asc'); + if (afiles.length > 0) afiles.qsort(0, afiles.length, maps['name'], 'asc'); + + for (var i=0; i<afiles.length; i++) { + afolders.push(afiles[i]); + } + + var breadcrumbs = '<a href="#" rel="/" class="root link-breadcrumb">Root</a>:'; + for (var i=0; i<paths.length; i++) { + breadcrumbs += '/<a href="#" rel="' + (paths[i].path != '' ? paths[i].path + '/' : '') + paths[i].folder + '" class="link-breadcrumb">' + paths[i].folder + '<\/a>'; + } + $modal.find('#modal-breadcrumbs').html(breadcrumbs); + + var files = ''; + if (parent != '') { + files += '<tr>'; + if (args.multiple) files += '<td class="selectbox"> <\/td>'; + files += '<td class="icon"><div class="icon-uplevel"><a href="#" rel="' + parent + '" class="icon-linkable link-folder">File Folder<\/a><\/div><\/td>' + + '<td class="name"><a href="#" rel="' + parent + '" title="Up One Level" class="link-folder">...<\/a><\/td>' + + '<\/tr>\n<tr class="spacer"><td colspan="' + (args.multiple ? 4 : 3) + '"><\/td><\/tr>\n'; + } + + for (var i=0; i<afolders.length; i++) { + files += '<tr>'; + if (args.multiple) files += '<td class="selectbox"><input type="checkbox" name="cselect" value="' + work_path + '/' + afolders[i][maps.name] +'" /><\/td>'; + files += '<td class="icon"><div class="icon-' + afolders[i][maps.icon] + '"><a href="#" rel="' + afolders[i][maps.name] + '" title="File Folder" class="icon-linkable ' + (afolders[i][maps.type] == 1 ? 'link-folder' : 'link-file') + '"><\/a><\/div><\/td>' + + '<td class="name"><a href="#" rel="' + afolders[i][maps.name] + '" title="File Folder" class="' + (afolders[i][maps.type] == 1 ? 'link-folder' : 'link-file') + '">' + afolders[i][maps.name] + '<\/a><\/td>' + + '<\/tr>\n<tr class="spacer"><td colspan="' + (args.multiple ? 4 : 3) + '"><\/td><\/tr>\n'; + } + $modal.find('.contentframe table').empty().append(files); + $modal.find('#hiddens').empty().append(hiddens.hidden_objects); + + /* Sent action for links and inputs */ + $modal.find('.link-folder[rel]').each(function() { + var link = $(this); + link.click(function() { + args['dname'] = link.attr('rel'); + args['hidden_objects'] = hiddens.hidden_objects; + args['breadcrumbs'] = false; + fm.browseFiles($modal, args); + return false; + }); + }); + + $modal.find('.link-breadcrumb[rel]').each(function() { + var link = $(this); + link.click(function() { + args['dname'] = link.attr('rel'); + args['breadcrumbs'] = true; + args['hidden_objects'] = fm.hiddens.hidden_objects; + fm.browseFiles($modal, args); + return false; + }); + }); + + $modal.find('.link-file[rel]').each(function() { + var link = $(this); + link.click(function() { + $modal.find('input[name="location"]').val(link.attr('rel')); + }); + }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(data) { + if (data.success) { + args['hidden_query'] = hiddens.hidden_query; + fm.browseFiles($modal, args); + $modal.find('input[name="makedir_input"]').val('').focus(); + fm.cdata.changed = true; + } + else { + $modal.find('.error').removeClass('hide').html(data.message); + $modal.find('input[name="makedir_input"]').focus(); + } + } + }); + + $modal.find('input[name="location"]').val(''); + $modal.find('input[name="select_path"]').val(work_path); + + /* This applies for multiple selects */ + if (args.multiple) { + $modal.find('input[name="cselect"]').each(function() { + var input = $(this); + input.click(function() { + fm.updateAccess(input.val(), input.attr('checked')); + }); + }); + + $modal.find('#location_root').change(function() { + $modal.find('input[name="cselect"]').attr('disabled', $(this).attr('checked') ? true : false); + fm.cdata.accesses = new Array(); + }); + + /* Pre-select user access folders */ + var found_root = false; + var preselect = fm.cdata.accesses; + for (i=0; i<preselect.length; i++) { + var found = $modal.find('input[value="' + preselect[i] + '"]'); + if (found.length > 0) found.attr('checked', true); + else if (preselect[i] == '/') { + found_root = true; + break; + } + } + + if (found_root) $modal.find('#location_root').attr('checked', true).change(); + } + + } + else { + fm.showMessage(response); + } + }); +} + +/* Add/Remove a user access directory */ +FileMan.prototype.updateAccess = function(path, flag) { + if (!flag) { /* Remove a path from the selected list */ + var accesses = new Array(); + for (var i=0; i<this.cdata.accesses.length; i++) { + if (path == this.cdata.accesses[i]) continue; + accesses[accesses.length] = this.cdata.accesses[i]; + } + this.cdata.accesses = accesses; + } + else { /* Add a path into the list */ + var found = false; + for (var i=0; i<this.cdata.accesses.length; i++) { + if (path == this.cdata.accesses[i]) { + found = true; + break; + } + } + if (!found) this.cdata.accesses.push(path); + } +} + +/* Browse logs actions */ +FileMan.prototype.browseLogs = function(json) { + if (json.data.logs.length == 0) { + $('#log_action').attr('disabled', true); + return; + } + + this.cdata = { + map : { uid: 0, ip: 1, date: 2, action: 3, desc: 4, sdate : 5 }, + logs : json.data.logs, + so : 'asc', + nh : 1 + }; + + var fm = this; + $('#command-dialog th a[rel]').each(function() { + var link = $(this); + link.click(function() { + fm.sortLogs(link.attr('rel')); + var so = fm.cdata.so || 'asc'; + $('#command-dialog th a[rel]').find('img').remove(); + $('#command-dialog th a[rel="' + link.attr('rel') + '"]').append(' <img src="' + fm.config.image_url + '/icons/' + (so == 'desc' ? 'descending.gif' : 'ascending.gif') + '" title="' + (so == 'desc' ? 'V' : '^') + '" \/>'); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : json.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + return false; + }); + }); + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : json.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + $('#log_action').change(function() { + var action = $(this).val(); + if (action == 'log_delete') { + fm.current.action = action; + $('#cmd').val(action); + fm.modalConfirm({ + html : 'Are you sure you want to clear the logs?', + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#log_action').val(''); + $modal.html('').jqmHide(); + } + }); + } + else if (action == 'log_search') { + fm.printForm('log', function (response) { + var $modal = $('#modal-dialog'); + var mwidth = 650; + var mleft = parseInt((fm.screen.width - mwidth) / 2); + + if (response.success) { + $modal.jqm().removeClass().addClass('modal-dialog modal-dialog-form') + .css('width', mwidth + 'px').css('left', mleft + 'px') + .html(response.data.html).jqmShow(); + + $modal.find('h1 img').css('cursor', 'pointer').click(function() { $modal.jqmHide(); }); + + $modal.find('form').ajaxForm({ + dataType: 'json', + success : function(res) { + if (res.success) { + $modal.jqmHide(); + fm.cdata.logs = res.data.logs; + + var paging = new page({ + image_url : fm.config.image_url, + parent : $('#command-dialog'), + paging : { num_hits : res.data.logs.length, max_hits : fm.paging.max_hits, current_page : 1, sb : 'date', so : 'asc' }, + action : function(nh) { fm.printLogs(nh); } + }, $('#command-dialog .toolbar div[class="paging"]')); + + fm.sortLogs(); + if (res.message) fm.showMessage(res); + } + else { + $modal.find('form p.error').show().text(res.message); + $modal.find('input[name="search_input"]').focus(); + } + } + }); + + $modal.find('.date-pick').datePicker({ clickInput : true, startDate : fm.startDate() }); + $('#fromdate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#todate').dpSetStartDate(d.addDays(1).asString()); + } + }); + + $('#todate').bind('dpClosed', function(e, selectedDates) { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $('#fromdate').dpSetEndDate(d.addDays(-1).asString()); + } + }); + } + }, { search : 1 }); + } + $(this).val(''); + }); + fm.sortLogs(); +} + +FileMan.prototype.sortLogs = function(sb) { + if (!sb) sb = 'date'; + var so = (!this.cdata.so || this.cdata.so == 'desc') ? 'asc' : 'desc'; + + var alogs = this.cdata.logs; + var maps = this.cdata.map; + + alogs.qsort(0, alogs.length, maps[sb], so); + + this.cdata.logs = alogs; + this.cdata.so = so; + this.cdata.nh = 1; + this.printLogs(this.cdata.nh); +} + +FileMan.prototype.printLogs = function(nh) { + if (!nh) nh = 1; + + var alogs = this.cdata.logs; + var maps = this.cdata.map; + var beg = nh == 1 ? 0 : ((nh - 1) * this.paging.max_hits); + var body = $('#command-dialog .contentframe').find('table[class="foldertab"]'); + body.empty(); + + var count = 0; + for (var i=beg; i<alogs.length; i++) { + if (count == this.paging.max_hits) break; + var l = alogs[i]; + var tr = '<tr><td class="modified">' + l[maps.sdate] + '<\/td>' + + '<td class="owner">' + l[maps.uid] + '<\/td>' + + '<td class="permission">' + l[maps.ip] + '<\/td>' + + '<td class="action">' + l[maps.action] + '<\/td>' + + '<td class="name">' + l[maps.desc] + '<\/td>'; + + tr += '<tr class="spacer"><td colspan="6"><\/td><\/tr>\n'; + body.append(tr); + count++; + } + this.cdata.nh = nh; +} + +/* + protect command +*/ +FileMan.prototype.htaccess = function(users) { + $('#cmd-protect input[name="protect-delete-all"]').remove(); + + var select = $('#cmd-protect select'); + select.empty(); + + if (users && users.length > 0) { + users.qsort(0, users.length, 0, 'asc'); + select.append('<option value="">---</option>'); + for (var i=0; i<users.length; i++) { + select.append('<option value="' + users[i] + '">' + users[i] + '</option>'); + } + select.attr('disabled', false); + + var fm = this; + $('#cmd-protect input[name="button-delete"]').attr('disabled', false).click(function() { fm.htaccessDelete(); }); + $('#cmd-protect input[name="button-delete-all"]').attr('disabled', false).click(function() { fm.htaccessDelete(true); }); + } + else { + select.attr('disabled', true); + $('#cmd-protect input[name="button-delete"]').attr('disabled', true); + $('#cmd-protect input[name="button-delete-all"]').attr('disabled', true); + } +} + +/* + need a confirmation on delete htaccess users +*/ +FileMan.prototype.htaccessDelete = function(all) { + var msg; + if (all) { + msg = 'Are you sure you want to delete all users?'; + $('#cmd-protect').append('<input type="hidden" name="protect-delete-all" value="1" />'); + } + else if ($('#protect_user').val() == '') { + this.showMessage({ success : false, message : "No user was selected." }); + return; + } + else { + $('#cmd-protect input[name="protect-delete-all"]').remove(); + msg = 'Are you sure you want to delete "' + $('#protect_user').val() + '"?'; + $('#htaccess-delete').val(''); + } + + var fm = this; + this.modalConfirm({ + html : msg, + yes : function($modal) { + $modal.html('').jqmHide(); + fm.form.submit(); + }, + no : function($modal) { + $('#user_action').val(''); + $modal.html('').jqmHide(); + } + }); +} + +/* Help contents */ +FileMan.prototype.help = function() { + var width = 780; + var height = 600; + var attrs = 'resizable=no,status=yes,toolbar=no,menubar=no,location=no,width=' + width + ',height=' + height + ',left=400,top=10'; + var w = window.open(this.config.cgi_url + '?page=help.html' + this.hiddens.hidden_query, 'help', attrs); + w.focus(); +} + +/* About FileMan */ +FileMan.prototype.about = function() { + var $modal = $('#modal-dialog'); + var nleft = parseInt(($(window).width() - 400) / 2); + var ntop = parseInt((this.screen.height - 400)/ 2); + var html = '<div class="aboutcontent">' + + '<div><b>Version:<\/b> ' + this.config.version + '<\/div>' + + '<div><b>Registration Number:<\/b> ' + (this.config.regnum != '' ? this.config.regnum : 'Free') + '<\/div>' + + '<div class="copyright">©2001 - 2008. Powered By Gossamer Threads Inc.<br \/><b> <a href="http://www.gossamer-threads.com/scripts/fileman/license.htm" target="_blank">View License Information »<\/a><\/b><\/div>' + + '<div class="close"><a href="#">Close<\/a><\/div><\/div>'; + $modal.jqm().removeClass().addClass('modal-dialog modal-about ') + .css('left', nleft + 'px').css('top', ntop + 'px').css('width', '420px') + .html(html).jqmShow(); + + $modal.find('.close a').click(function() { + $modal.html('').jqmHide(); + return false; + }); +} + +FileMan.prototype.startDate = function() { + var format = this.config.date_format.split(/-|\\/); + var d = ''; + for (var i=0; i<format.length; i++) { + if (format[i] == 'yyyy') { + d += d != '' ? '-1996' : '1996'; + } + else { + d += d != '' ? '-01' : '01'; + } + + } + return d; +} + +/* + Animate method + $obj : should be jquery object + args : should be a hash of all properties that are used for animate. e.g. margin-top, height, width, etc... + func : should be a callback function +*/ +FileMan.prototype.animate = function($obj, args, speed, func) { + if (this.config.effect) { + var maps = { height : 'height', width : 'width', 'margin-top' : 'marginTop', 'margin-bottom' : 'marginBottom' }; + var opts = new Object(); + + for (var i in args) { + if (!maps[i]) continue; + opts[maps[i]] = args[i]; + } + $obj.animate(opts, speed || 'normal', function() { + if (typeof(func) == 'function') func(); + }) + } + else { + for (var i in args) { + $obj.css(i, args[i] + 'px'); + } + if (typeof(func) == 'function') func(); + } +} + +/* + slideUp method + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.slideUp = function($obj, func) { + if (this.config.effect) { + $obj.slideUp('normal', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.hide('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + slideDown method + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.slideDown = function($obj, func) { + if (this.config.effect) { + $obj.slideDown('normal', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.show('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + Show a object with/without an effection + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.fadeIn = function($obj, func) { + if (this.config.effect) { + $obj.fadeIn('fast', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.show('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* + Hide a object with/without an effection + $obj : should be a jquery object + func : should be a callback function +*/ +FileMan.prototype.fadeOut = function($obj, func) { + if (this.config.effect) { + $obj.fadeOut('fast', function() { + if (typeof(func) == 'function') func(); + }); + } + else { + $obj.hide('fast', function() { + if (typeof(func) == 'function') func(); + }); + } +} + +/* Unescape GT tags and manually the textarea with the content instead of using tinyMCE.activeEditor.save() method */ +FileMan.prototype.tinyMCEContent = function() { + var content = ''; + if (tinyMCE.activeEditor == null) return content; + + content = tinyMCE.activeEditor.getContent(); + content = content.replace(/%>/gi, '%>'); + content = content.replace(/<%/gi, '<%'); + return content; +} + +/* quick sort which allows you to sort an array of arrays +source: is an array +begin: should be a number. Which is the start point +end: should be a number. Which is the end point +column: should be sort column + */ +Array.prototype.qsort = function(begin, end, column, sort_order) { + if (end - 1 > begin) { + var pivot = begin + Math.floor(Math.random() * (end - begin)); + + pivot = this.partition(begin, end, pivot, column, sort_order); + + this.qsort(begin, pivot, column, sort_order); + this.qsort(pivot + 1, end, column, sort_order); + } +} + +Array.prototype.partition = function(begin, end, pivot, column, sort_order) { + var piv = this[pivot][column]; + this.swap(pivot, end - 1); + + var store = begin; + if (sort_order == 'desc') { + for (var i= begin; i<end - 1; ++i) { + if (this[i][column] > piv) { + this.swap(store, i); + ++store; + } + } + } + else { + for (var i= begin; i<end - 1; ++i) { + if (this[i][column] <= piv) { + this.swap(store, i); + ++store; + } + } + } + + this.swap(end - 1, store); + return store; +} + +Array.prototype.swap = function(a, b) { + var tmp = this[a]; + this[a] = this[b]; + this[b] = tmp; +} + +/* + page Object + args : is a hash of + - image_url : image URL + - paging : should be a hash of max_hits, so, sb +*/ +function page(args, $page) { + for (var i in args) { + this[i] = args[i]; + } + if (args.paging.max_hits >= args.paging.num_hits) { + $page.html(''); + return; + } + + var paging = args.paging; + var options = { + max_pages : 20, + boundary_pages : 1, + style : 1, + style_next : '<img src="' + args.image_url + '/paging-next.gif" alt=">" title="Next Page" />', + style_prev : '<img src="' + args.image_url + '/paging-prev.gif" alt="<" title="Previous Page" />', + style_first : '<img src="' + args.image_url + '/paging-first.gif" alt="|<" title="First Page" />', + style_last : '<img src="' + args.image_url + '/paging-last.gif" alt=">|" title="Last Page" />', + style_nonext : '<img src="' + args.image_url + '/paging-nonext.gif" alt="" />', + style_noprev : '<img src="' + args.image_url + '/paging-noprev.gif" alt="" />', + style_nofirst : '<img src="' + args.image_url + '/paging-nofirst.gif" alt="" />', + style_nolast : '<img src="' + args.image_url + '/paging-nolast.gif" alt="" />', + lang_of : ' of ', + paging_pre : '', + paging_post : '' + }; + + paging.num_pages = parseInt(paging.num_hits / paging.max_hits); + if (paging.num_hits % paging.max_hits > 0) paging.num_pages++ + + this.page = $page; + this.paging.num_pages = paging.num_pages; + this.paging.options = options; + this.print(true); + this.pagingAction(); +} + +page.prototype.print = function(fresh) { + var paging = this.paging; + var options = this.paging.options; + var start = 0; var end = 0; + if (paging.num_pages <= options.max_pages) { + start = 1; + end = paging.num_pages; + } + else if (paging.current_page >= paging.num_pages - options.max_pages / 2) { + end = paging.num_pages; + start = end - options.max_pages + 1; + } + else if (paging.current_page <= options.max_pages / 2) { + start = 1; + end = options.max_pages; + } + else { + start = paging.current_page - parseInt(options.max_pages / 2) + 1; + if (options.max_pages % 2 > 0) start--; + end = paging.current_page + parseInt(options.max_pages / 2); + } + + var left_boundary = 0; + var right_boundary = 0; + if (end >= paging.num_pages - options.boundary_pages - 1) end = paging.num_pages; + else right_boundary = 1; + + if (start <= options.boundary_pages + 2) start = 1; + else left_boundary = 1; + + var pages = new Array(); + if (left_boundary > 0) { + for (var i=0; i<options.boundary_pages;i++) pages.push(i + 1); + pages.push('...'); + } + for (var i=start;i<=end;i++) { + pages.push(i); + } + + if (right_boundary > 0) { + pages.push('...'); + for (var i=paging.num_pages - options.boundary_pages + 1; i<=paging.num_pages; i++) pages.push(i); + } + + paging.pages = pages; + var page_html = ''; + + if (fresh) { + page_html += options.paging_pre; + page_html += '<span id="page-first">' + options.style_nofirst + '<\/span> <span id="page-prev">' + options.style_noprev + '<\/span> '; + page_html += '<select>'; + } + + for (var i=0; i<pages.length; i++) { + if (pages[i] == '...') { + page_html += '<option value="" disabled="disabled">...<\/option>'; + } + else { + page_html += '<option value="' + pages[i] + '"'; + if (pages[i] == paging.current_page) page_html += ' selected="selected"'; + page_html += '>' + pages[i] + options.lang_of + paging.num_pages + '<\/option>'; + } + } + + var pg = this; + if (fresh) { + page_html += '<\/select> '; + page_html += '<span id="page-next">' + options.style_next + '<\/span> <span id="page-last">' + options.style_last + '<\/span>'; + page_html += options.paging_post; + this.page.html(page_html); + } + else { + this.page.find('select').empty().html(page_html); + } + + this.page.find('select').change(function() { + if (this.options[this.selectedIndex].innerHTML != '...' && typeof(pg.action) == 'function') { + pg.gotoPage(this.options[this.selectedIndex].value); + } + }); +} + +/* + Setting actions for paging: next, previous, etc... +*/ +page.prototype.pagingAction = function() { + var pg = this; + var parent_obj = this.parent ? this.parent : $('.toolbar'); + + if (this.paging.current_page == 1) { + if (parent_obj.find('#page-first').find(this.paging.options.style_nofirst).length == 0) parent_obj.find('#page-first').html(this.paging.options.style_nofirst); + if (parent_obj.find('#page-prev').find(this.paging.options.style_noprev).length == 0) parent_obj.find('#page-prev').html(this.paging.options.style_noprev); + } + else { + if (parent_obj.find('#page-first').find(this.paging.options.style_first).length == 0) { + parent_obj.find('#page-first').html(this.paging.options.style_first); + parent_obj.find('#page-first img').click(function() { pg.gotoPage(1); }); + } + if (parent_obj.find('#page-prev').find(this.paging.options.style_prev).length == 0) { + parent_obj.find('#page-prev').html(this.paging.options.style_prev); + parent_obj.find('#page-prev img').click(function() { pg.gotoPage(pg.paging.current_page - 1) }); + } + } + + if (this.paging.current_page == this.paging.num_pages) { + if (parent_obj.find('#page-last').find(this.paging.options.style_nolast).length == 0) parent_obj.find('#page-last').html(this.paging.options.style_nolast); + if (parent_obj.find('#page-prev').find(this.paging.options.style_nonext).length == 0) parent_obj.find('#page-next').html(this.paging.options.style_nonext); + } + else { + if (parent_obj.find('#page-last').find(this.paging.options.style_last).length == 0) { + parent_obj.find('#page-last').html(this.paging.options.style_last); + parent_obj.find('#page-last img').click(function() { pg.gotoPage(pg.paging.num_pages); }); + } + if (parent_obj.find('#page-next').find(this.paging.options.style_next).length == 0) { + parent_obj.find('#page-next').html(this.paging.options.style_next); + parent_obj.find('#page-next img').click(function() { + pg.gotoPage(pg.paging.current_page + 1); + }); + } + } + this.page.find('img').css('cursor', 'pointer'); +} + +/* + gotoPage method +*/ +page.prototype.gotoPage = function(nh) { + if (nh > this.paging.num_pages) return; + + this.paging.current_page = parseInt(nh); + + if (this.paging.num_pages > this.paging.options.max_pages) this.print(); + this.pagingAction(); + + this.page.find('option[value="' + nh +'"]').attr('selected', true); + if (typeof(this.action) == 'function') this.action(nh); +} + +/* Global functions */ +function friendly_size(num, force_kb, total_size) { + if (num < 100) return num + ' bytes'; + var force_mb = total_size > 999999 ? 1 : 0; + var unit; + if((num > 999999 || force_mb) && !force_kb) { + num = num/(1024*1024); + num = num.toString(); + var testnum = num.replace( /^(\d+\.\d).*/, '$1' ); + if(testnum == '0.0') testnum = num.replace( /^(\d+\.\d\d).*/, '$1' ); + if(testnum == '0.00') testnum = num.replace( /^(\d+\.\d\d\d).*/, '$1' ); + num = testnum; + unit = 'MB'; + } + else { + var kb = num/1024; + var decimal = kb - parseInt(kb); + num = parseInt(kb); + if (decimal > 0) { + var str = decimal.toFixed(3).substr(1, 3); + num += '' + str; + } + unit = 'KB'; + } + return num + ' ' + unit; +} + +function getScreenHeight() { /* $(window).height() does not working properly on window resizing */ + if (window.innerHeight) return window.innerHeight; + else if (document.documentElement.clientHeight) return document.documentElement.clientHeight; + else if (window.clientHeight) return window.clientHeight; + else if (document.body.clientHeight) return document.body.clientHeight; + else return 0; +} + +function getScreenWidth() { + if (window.innerWidth) return window.innerWidth; + else if (document.documentElement.clientWidth) return document.documentElement.clientWidth; + else if (window.clientWidth) return window.clientWidth; + else if (document.body.clientWidth) return document.body.clientWidth; + else return 0; +} + +function randomString() { + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; + var string_length = 8; + var randomstring = ''; + for (var i=0; i<string_length; i++) { + var rnum = Math.floor(Math.random() * chars.length); + randomstring += chars.substring(rnum,rnum+1); + } + + return randomstring; +} + +function format_time(num) { + if(num >= 60 * 60){ + var secs_left = num % (60 * 60); + var mins_left = secs_left / 60; + mins_left = mins_left.toString(); + mins_left = mins_left.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + mins_left = mins_left.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = num/(60*60); + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num + ':' + mins_left + ':00'; + } + else if(num >= 60) { + var secs_left = num % 60; + secs_left = secs_left.toString().replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = num/60; + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + + num = '00:' + num + ':' + secs_left; + } + else { + num = num.toString(); + num = num.replace( /^(\d+)\..*/, '$1' ); // show no decimal places. + num = num.replace( /^(\d)$/, '0$1' ); // for single-digits, prepend a zero. + num = '00:00:' + num; + } + return num; +} + +function htmlEscape(text) { + text = text.replace(/&/g, '&'); + text = text.replace(/</g, '<'); + text = text.replace(/>/g, '>'); + text = text.replace(/"/g, '"'); + return text; +} + diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.cluetip.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.cluetip.js new file mode 100644 index 0000000..8372791 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.cluetip.js @@ -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); diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.datePicker.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.datePicker.js new file mode 100644 index 0000000..bd5103d --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.datePicker.js @@ -0,0 +1,1056 @@ +/** + * Copyright (c) 2007 Kelvin Luck (http://www.kelvinluck.com/) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * $Id: jquery.datePicker.js,v 1.1 2008/07/21 22:54:09 bao Exp $ + **/ + +(function($){ + + $.fn.extend({ +/** + * Render a calendar table into any matched elements. + * + * @param Object s (optional) Customize your calendars. + * @option Number month The month to render (NOTE that months are zero based). Default is today's month. + * @option Number year The year to render. Default is today's year. + * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback. + * @option Number showHeader Whether or not to show the header row, possible values are: $.dpConst.SHOW_HEADER_NONE (no header), $.dpConst.SHOW_HEADER_SHORT (first letter of each day) and $.dpConst.SHOW_HEADER_LONG (full name of each day). Default is $.dpConst.SHOW_HEADER_SHORT. + * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. + * @type jQuery + * @name renderCalendar + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#calendar-me').renderCalendar({month:0, year:2007}); + * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. + * + * @example + * var testCallback = function($td, thisDate, month, year) + * { + * if ($td.is('.current-month') && thisDate.getDay() == 4) { + * var d = thisDate.getDate(); + * $td.bind( + * 'click', + * function() + * { + * alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year); + * } + * ).addClass('thursday'); + * } else if (thisDate.getDay() == 5) { + * $td.html('Friday the ' + $td.html() + 'th'); + * } + * } + * $('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback}); + * + * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text. + **/ + renderCalendar : function(s) + { + var dc = function(a) + { + return document.createElement(a); + }; + + s = $.extend( + { + month : null, + year : null, + renderCallback : null, + showHeader : $.dpConst.SHOW_HEADER_SHORT, + dpController : null, + hoverClass : 'dp-hover' + } + , s + ); + + if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) { + var headRow = $(dc('tr')); + for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) { + var weekday = i%7; + var day = Date.dayNames[weekday]; + headRow.append( + jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day) + ); + } + }; + + var calendarTable = $(dc('table')) + .attr( + { + 'cellspacing':2, + 'className':'jCalendar' + } + ) + .append( + (s.showHeader != $.dpConst.SHOW_HEADER_NONE ? + $(dc('thead')) + .append(headRow) + : + dc('thead') + ) + ); + var tbody = $(dc('tbody')); + + var today = (new Date()).zeroTime(); + + var month = s.month == undefined ? today.getMonth() : s.month; + var year = s.year || today.getFullYear(); + + var currentDate = new Date(year, month, 1); + + + var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1; + if (firstDayOffset > 1) firstDayOffset -= 7; + var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7); + currentDate.addDays(firstDayOffset-1); + + var doHover = function() + { + if (s.hoverClass) { + $(this).addClass(s.hoverClass); + } + }; + var unHover = function() + { + if (s.hoverClass) { + $(this).removeClass(s.hoverClass); + } + }; + + var w = 0; + while (w++<weeksToDraw) { + var r = jQuery(dc('tr')); + for (var i=0; i<7; i++) { + var thisMonth = currentDate.getMonth() == month; + var d = $(dc('td')) + .text(currentDate.getDate() + '') + .attr('className', (thisMonth ? 'current-month ' : 'other-month ') + + (currentDate.isWeekend() ? 'weekend ' : 'weekday ') + + (thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '') + ) + .hover(doHover, unHover) + ; + if (s.renderCallback) { + s.renderCallback(d, currentDate, month, year); + } + r.append(d); + currentDate.addDays(1); + } + tbody.append(r); + } + calendarTable.append(tbody); + + return this.each( + function() + { + $(this).empty().append(calendarTable); + } + ); + }, +/** + * Create a datePicker associated with each of the matched elements. + * + * The matched element will receive a few custom events with the following signatures: + * + * dateSelected(event, date, $td, status) + * Triggered when a date is selected. event is a reference to the event, date is the Date selected, $td is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false) + * + * dpClosed(event, selected) + * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects. + * + * dpMonthChanged(event, displayedMonth, displayedYear) + * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month. + * + * dpDisplayed(event, $datePickerDiv) + * Triggered when the date picker is created. $datePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker. + * + * @param Object s (optional) Customize your date pickers. + * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month. + * @option Number year The year to render when the date picker is opened. Default is today's year. + * @option String startDate The first date date can be selected. + * @option String endDate The last date that can be selected. + * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup) + * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true. + * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true. + * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true. + * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false. + * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false. + * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear. + * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM. Default is $.dpConst.POS_TOP. + * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT. + * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0. + * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0. + * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback. + * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class. + * @type jQuery + * @name datePicker + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('input.date-picker').datePicker(); + * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format). + * + * @example demo/index.html + * @desc See the projects homepage for many more complex examples... + **/ + datePicker : function(s) + { + if (!$.event._dpCache) $.event._dpCache = []; + + // initialise the date picker controller with the relevant settings... + s = $.extend( + { + month : undefined, + year : undefined, + startDate : undefined, + endDate : undefined, + inline : false, + renderCallback : [], + createButton : true, + showYearNavigation : true, + closeOnSelect : true, + displayClose : false, + selectMultiple : false, + clickInput : false, + verticalPosition : $.dpConst.POS_TOP, + horizontalPosition : $.dpConst.POS_LEFT, + verticalOffset : 0, + horizontalOffset : 0, + hoverClass : 'dp-hover' + } + , s + ); + + return this.each( + function() + { + var $this = $(this); + var alreadyExists = true; + + if (!this._dpId) { + this._dpId = $.event.guid++; + $.event._dpCache[this._dpId] = new DatePicker(this); + alreadyExists = false; + } + + if (s.inline) { + s.createButton = false; + s.displayClose = false; + s.closeOnSelect = false; + $this.empty(); + } + + var controller = $.event._dpCache[this._dpId]; + + controller.init(s); + + if (!alreadyExists && s.createButton) { + // create it! + controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>') + .bind( + 'click', + function() + { + $this.dpDisplay(this); + this.blur(); + return false; + } + ); + $this.after(controller.button); + } + + if (!alreadyExists && $this.is(':text')) { + $this + .bind( + 'dateSelected', + function(e, selectedDate, $td) + { + this.value = selectedDate.asString(); + } + ).bind( + 'change', + function() + { + var d = Date.fromString(this.value); + if (d) { + controller.setSelected(d, true, true); + } + } + ); + if (s.clickInput) { + $this.bind( + 'click', + function() + { + $this.dpDisplay(); + } + ); + } + var d = Date.fromString(this.value); + if (this.value != '' && d) { + controller.setSelected(d, true, true); + } + } + + $this.addClass('dp-applied'); + + } + ) + }, +/** + * Disables or enables this date picker + * + * @param Boolean s Whether to disable (true) or enable (false) this datePicker + * @type jQuery + * @name dpSetDisabled + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetDisabled(true); + * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field. + **/ + dpSetDisabled : function(s) + { + return _w.call(this, 'setDisabled', s); + }, +/** + * Updates the first selectable date for any date pickers on any matched elements. + * + * @param String d A string representing the first selectable date (formatted according to Date.format). + * @type jQuery + * @name dpSetStartDate + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetStartDate('01/01/2000'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium. + **/ + dpSetStartDate : function(d) + { + return _w.call(this, 'setStartDate', d); + }, +/** + * Updates the last selectable date for any date pickers on any matched elements. + * + * @param String d A string representing the last selectable date (formatted according to Date.format). + * @type jQuery + * @name dpSetEndDate + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetEndDate('01/01/2010'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010. + **/ + dpSetEndDate : function(d) + { + return _w.call(this, 'setEndDate', d); + }, +/** + * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element. + * + * @type Array + * @name dpGetSelected + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * alert($('.date-picker').dpGetSelected()); + * @desc Will alert an empty array (as nothing is selected yet) + **/ + dpGetSelected : function() + { + var c = _getController(this[0]); + if (c) { + return c.getSelected(); + } + return null; + }, +/** + * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker. + * + * @param String d A string representing the date you want to select (formatted according to Date.format). + * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true. + * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true. + * @type jQuery + * @name dpSetSelected + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetSelected('01/01/2010'); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. + **/ + dpSetSelected : function(d, v, m) + { + if (v == undefined) v=true; + if (m == undefined) m=true; + return _w.call(this, 'setSelected', Date.fromString(d), v, m); + }, +/** + * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead. + * + * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month. + * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year. + * @type jQuery + * @name dpSetDisplayedMonth + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-picker').datePicker(); + * $('.date-picker').dpSetDisplayedMonth(10, 2008); + * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010. + **/ + dpSetDisplayedMonth : function(m, y) + { + return _w.call(this, 'setDisplayedMonth', Number(m), Number(y)); + }, +/** + * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed. + * + * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker. + * @type jQuery + * @name dpDisplay + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpDisplay(); + * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up. + **/ + dpDisplay : function(e) + { + return _w.call(this, 'display', e); + }, +/** + * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page + * + * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. + * @type jQuery + * @name dpSetRenderCallback + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetRenderCallback(function($td, thisDate, month, year) + * { + * // do stuff as each td is rendered dependant on the date in the td and the displayed month and year + * }); + * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed. + **/ + dpSetRenderCallback : function(a) + { + return _w.call(this, 'setRenderCallback', a); + }, +/** + * Sets the position that the datePicker will pop up (relative to it's associated element) + * + * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_TOP and $.dpConst.POS_BOTTOM + * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT + * @type jQuery + * @name dpSetPosition + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetPosition($.dpConst.POS_BOTTOM, $.dpConst.POS_RIGHT); + * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element. + **/ + dpSetPosition : function(v, h) + { + return _w.call(this, 'setPosition', v, h); + }, +/** + * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition) + * + * @param Number v The vertical offset of the created date picker. + * @param Number h The horizontal offset of the created date picker. + * @type jQuery + * @name dpSetOffset + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('#date-picker').datePicker(); + * $('#date-picker').dpSetOffset(-20, 200); + * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position. + **/ + dpSetOffset : function(v, h) + { + return _w.call(this, 'setOffset', v, h); + }, +/** + * Closes the open date picker associated with this element. + * + * @type jQuery + * @name dpClose + * @cat plugins/datePicker + * @author Kelvin Luck (http://www.kelvinluck.com/) + * + * @example $('.date-pick') + * .datePicker() + * .bind( + * 'focus', + * function() + * { + * $(this).dpDisplay(); + * } + * ).bind( + * 'blur', + * function() + * { + * $(this).dpClose(); + * } + * ); + * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred. + **/ + dpClose : function() + { + return _w.call(this, '_closeCalendar', false, this[0]); + }, + // private function called on unload to clean up any expandos etc and prevent memory links... + _dpDestroy : function() + { + // TODO - implement this? + } + }); + + // private internal function to cut down on the amount of code needed where we forward + // dp* methods on the jQuery object on to the relevant DatePicker controllers... + var _w = function(f, a1, a2, a3) + { + return this.each( + function() + { + var c = _getController(this); + if (c) { + c[f](a1, a2, a3); + } + } + ); + }; + + function DatePicker(ele) + { + this.ele = ele; + + // initial values... + this.displayedMonth = null; + this.displayedYear = null; + this.startDate = null; + this.endDate = null; + this.showYearNavigation = null; + this.closeOnSelect = null; + this.displayClose = null; + this.selectMultiple = null; + this.verticalPosition = null; + this.horizontalPosition = null; + this.verticalOffset = null; + this.horizontalOffset = null; + this.button = null; + this.renderCallback = []; + this.selectedDates = {}; + this.inline = null; + this.context = '#dp-popup'; + }; + $.extend( + DatePicker.prototype, + { + init : function(s) + { + this.setStartDate(s.startDate); + this.setEndDate(s.endDate); + this.setDisplayedMonth(Number(s.month), Number(s.year)); + this.setRenderCallback(s.renderCallback); + this.showYearNavigation = s.showYearNavigation; + this.closeOnSelect = s.closeOnSelect; + this.displayClose = s.displayClose; + this.selectMultiple = s.selectMultiple; + this.verticalPosition = s.verticalPosition; + this.horizontalPosition = s.horizontalPosition; + this.hoverClass = s.hoverClass; + this.setOffset(s.verticalOffset, s.horizontalOffset); + this.inline = s.inline; + if (this.inline) { + this.context = this.ele; + this.display(); + } + }, + setStartDate : function(d) + { + if (d) { + this.startDate = Date.fromString(d); + } + if (!this.startDate) { + this.startDate = (new Date()).zeroTime(); + } + this.setDisplayedMonth(this.displayedMonth, this.displayedYear); + }, + setEndDate : function(d) + { + if (d) { + this.endDate = Date.fromString(d); + } + if (!this.endDate) { + this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy + } + if (this.endDate.getTime() < this.startDate.getTime()) { + this.endDate = this.startDate; + } + this.setDisplayedMonth(this.displayedMonth, this.displayedYear); + }, + setPosition : function(v, h) + { + this.verticalPosition = v; + this.horizontalPosition = h; + }, + setOffset : function(v, h) + { + this.verticalOffset = parseInt(v) || 0; + this.horizontalOffset = parseInt(h) || 0; + }, + setDisabled : function(s) + { + $e = $(this.ele); + $e[s ? 'addClass' : 'removeClass']('dp-disabled'); + if (this.button) { + $but = $(this.button); + $but[s ? 'addClass' : 'removeClass']('dp-disabled'); + $but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE); + } + if ($e.is(':text')) { + $e.attr('disabled', s ? 'disabled' : ''); + } + }, + setDisplayedMonth : function(m, y) + { + if (this.startDate == undefined || this.endDate == undefined) { + return; + } + var s = new Date(this.startDate.getTime()); + s.setDate(1); + var e = new Date(this.endDate.getTime()); + e.setDate(1); + + var t; + if ((!m && !y) || (isNaN(m) && isNaN(y))) { + // no month or year passed - default to current month + t = new Date().zeroTime(); + t.setDate(1); + } else if (isNaN(m)) { + // just year passed in - presume we want the displayedMonth + t = new Date(y, this.displayedMonth, 1); + } else if (isNaN(y)) { + // just month passed in - presume we want the displayedYear + t = new Date(this.displayedYear, m, 1); + } else { + // year and month passed in - that's the date we want! + t = new Date(y, m, 1) + } + + // check if the desired date is within the range of our defined startDate and endDate + if (t.getTime() < s.getTime()) { + t = s; + } else if (t.getTime() > e.getTime()) { + t = e; + } + this.displayedMonth = t.getMonth(); + this.displayedYear = t.getFullYear(); + }, + setSelected : function(d, v, moveToMonth) + { + if (this.selectMultiple == false) { + this.selectedDates = {}; + $('td.selected', this.context).removeClass('selected'); + } + if (moveToMonth) { + this.setDisplayedMonth(d.getMonth(), d.getFullYear()); + } + this.selectedDates[d.toString()] = v; + }, + isSelected : function(d) + { + return this.selectedDates[d.toString()]; + }, + getSelected : function() + { + var r = []; + for(s in this.selectedDates) { + if (this.selectedDates[s] == true) { + r.push(Date.parse(s)); + } + } + return r; + }, + display : function(eleAlignTo) + { + if ($(this.ele).is('.dp-disabled')) return; + + eleAlignTo = eleAlignTo || this.ele; + var c = this; + var $ele = $(eleAlignTo); + var eleOffset = $ele.offset(); + + var $createIn; + var attrs; + var attrsCalendarHolder; + var cssRules; + + if (c.inline) { + $createIn = $(this.ele); + attrs = { + 'id' : 'calendar-' + this.ele._dpId, + 'className' : 'dp-popup dp-popup-inline' + }; + cssRules = { + }; + } else { + $createIn = $('body'); + attrs = { + 'id' : 'dp-popup', + 'className' : 'dp-popup' + }; + cssRules = { + 'top' : eleOffset.top + c.verticalOffset, + 'left' : eleOffset.left + c.horizontalOffset + }; + + var _checkMouse = function(e) + { + var el = e.target; + var cal = $('#dp-popup')[0]; + + while (true){ + if (el == cal) { + return true; + } else if (el == document) { + c._closeCalendar(); + return false; + } else { + el = $(el).parent()[0]; + } + } + }; + this._checkMouse = _checkMouse; + + this._closeCalendar(true); + } + + + $createIn + .append( + $('<div></div>') + .attr(attrs) + .css(cssRules) + .append( + $('<h2></h2>'), + $('<div class="dp-nav-prev"></div>') + .append( + $('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '"><<</a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 0, -1); + } + ), + $('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '"><</a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, -1, 0); + } + ) + ), + $('<div class="dp-nav-next"></div>') + .append( + $('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '">>></a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 0, 1); + } + ), + $('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '">></a>') + .bind( + 'click', + function() + { + return c._displayNewMonth.call(c, this, 1, 0); + } + ) + ), + $('<div></div>') + .attr('className', 'dp-calendar') + ) + .bgIframe() + ); + + var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup'); + + if (this.showYearNavigation == false) { + $('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none'); + } + if (this.displayClose) { + $pop.append( + $('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>') + .bind( + 'click', + function() + { + c._closeCalendar(); + return false; + } + ) + ); + } + c._renderCalendar(); + + $(this.ele).trigger('dpDisplayed', $pop); + + if (!c.inline) { + if (this.verticalPosition == $.dpConst.POS_BOTTOM) { + $pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset); + } + if (this.horizontalPosition == $.dpConst.POS_RIGHT) { + $pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset); + } + $(document).bind('mousedown', this._checkMouse); + } + }, + setRenderCallback : function(a) + { + if (a && typeof(a) == 'function') { + a = [a]; + } + this.renderCallback = this.renderCallback.concat(a); + }, + cellRender : function ($td, thisDate, month, year) { + var c = this.dpController; + var d = new Date(thisDate.getTime()); + + // add our click handlers to deal with it when the days are clicked... + + $td.bind( + 'click', + function() + { + var $this = $(this); + if (!$this.is('.disabled')) { + c.setSelected(d, !$this.is('.selected') || !c.selectMultiple); + var s = c.isSelected(d); + $(c.ele).trigger('dateSelected', [d, $td, s]); + $(c.ele).trigger('change'); + if (c.closeOnSelect) { + c._closeCalendar(); + } else { + $this[s ? 'addClass' : 'removeClass']('selected'); + } + } + } + ); + + if (c.isSelected(d)) { + $td.addClass('selected'); + } + + // call any extra renderCallbacks that were passed in + for (var i=0; i<c.renderCallback.length; i++) { + c.renderCallback[i].apply(this, arguments); + } + + + }, + // ele is the clicked button - only proceed if it doesn't have the class disabled... + // m and y are -1, 0 or 1 depending which direction we want to go in... + _displayNewMonth : function(ele, m, y) + { + if (!$(ele).is('.disabled')) { + this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y); + this._clearCalendar(); + this._renderCalendar(); + $(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]); + } + ele.blur(); + return false; + }, + _renderCalendar : function() + { + // set the title... + $('h2', this.context).html(Date.monthNames[this.displayedMonth] + ' ' + this.displayedYear); + + // render the calendar... + $('.dp-calendar', this.context).renderCalendar( + { + month : this.displayedMonth, + year : this.displayedYear, + renderCallback : this.cellRender, + dpController : this, + hoverClass : this.hoverClass + } + ); + + // update the status of the control buttons and disable dates before startDate or after endDate... + // TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying? + if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) { + $('.dp-nav-prev-year', this.context).addClass('disabled'); + $('.dp-nav-prev-month', this.context).addClass('disabled'); + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > 20) { + $this.addClass('disabled'); + } + } + ); + var d = this.startDate.getDate(); + $('.dp-calendar td.current-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < d) { + $this.addClass('disabled'); + } + } + ); + } else { + $('.dp-nav-prev-year', this.context).removeClass('disabled'); + $('.dp-nav-prev-month', this.context).removeClass('disabled'); + var d = this.startDate.getDate(); + if (d > 20) { + // check if the startDate is last month as we might need to add some disabled classes... + var sd = new Date(this.startDate.getTime()); + sd.addMonths(1); + if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) { + $('dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < d) { + $this.addClass('disabled'); + } + } + ); + } + } + } + if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) { + $('.dp-nav-next-year', this.context).addClass('disabled'); + $('.dp-nav-next-month', this.context).addClass('disabled'); + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) < 14) { + $this.addClass('disabled'); + } + } + ); + var d = this.endDate.getDate(); + $('.dp-calendar td.current-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > d) { + $this.addClass('disabled'); + } + } + ); + } else { + $('.dp-nav-next-year', this.context).removeClass('disabled'); + $('.dp-nav-next-month', this.context).removeClass('disabled'); + var d = this.endDate.getDate(); + if (d < 13) { + // check if the endDate is next month as we might need to add some disabled classes... + var ed = new Date(this.endDate.getTime()); + ed.addMonths(-1); + if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) { + $('.dp-calendar td.other-month', this.context).each( + function() + { + var $this = $(this); + if (Number($this.text()) > d) { + $this.addClass('disabled'); + } + } + ); + } + } + } + }, + _closeCalendar : function(programatic, ele) + { + if (!ele || ele == this.ele) + { + $(document).unbind('mousedown', this._checkMouse); + this._clearCalendar(); + $('#dp-popup a').unbind(); + $('#dp-popup').empty().remove(); + if (!programatic) { + $(this.ele).trigger('dpClosed', [this.getSelected()]); + } + } + }, + // empties the current dp-calendar div and makes sure that all events are unbound + // and expandos removed to avoid memory leaks... + _clearCalendar : function() + { + // TODO. + $('.dp-calendar td', this.context).unbind(); + $('.dp-calendar', this.context).empty(); + } + } + ); + + // static constants + $.dpConst = { + SHOW_HEADER_NONE : 0, + SHOW_HEADER_SHORT : 1, + SHOW_HEADER_LONG : 2, + POS_TOP : 0, + POS_BOTTOM : 1, + POS_LEFT : 0, + POS_RIGHT : 1 + }; + // localisable text + $.dpText = { + TEXT_PREV_YEAR : 'Previous year', + TEXT_PREV_MONTH : 'Previous month', + TEXT_NEXT_YEAR : 'Next year', + TEXT_NEXT_MONTH : 'Next month', + TEXT_CLOSE : 'Close', + TEXT_CHOOSE_DATE : 'Choose date' + }; + // version + $.dpVersion = '$Id: jquery.datePicker.js,v 1.1 2008/07/21 22:54:09 bao Exp $'; + + function _getController(ele) + { + if (ele._dpId) return $.event._dpCache[ele._dpId]; + return false; + }; + + // make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional + // comments to only include bgIframe where it is needed in IE without breaking this plugin). + if ($.fn.bgIframe == undefined) { + $.fn.bgIframe = function() {return this; }; + }; + + + // clean-up + $(window) + .bind('unload', function() { + var els = $.event._dpCache || []; + for (var i in els) { + $(els[i].ele)._dpDestroy(); + } + }); + + +})(jQuery); diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.form.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.form.js new file mode 100644 index 0000000..7bf52f7 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.form.js @@ -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); diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.hoverIntent.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.hoverIntent.js new file mode 100644 index 0000000..ac67e4d --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.hoverIntent.js @@ -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); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.jqModal.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.jqModal.js new file mode 100644 index 0000000..4257d81 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.jqModal.js @@ -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); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.min.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.min.js new file mode 100644 index 0000000..ba1ab6d --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.min.js @@ -0,0 +1,32 @@ +/* + * jQuery 1.2.5 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008/11/14 20:52:55 $ + * $Rev: 5651 $ + */ +(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else +return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.5",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else +return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else +this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else +script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else +for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else +for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(notxml&&!special&&name in elem){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);if(msie&&special&¬xml)return elem.getAttribute(name,2);return elem.getAttribute(name);}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else +while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else +while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else +xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else +jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else +s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/js/jquery.timers.js b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.timers.js new file mode 100644 index 0000000..454be57 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/js/jquery.timers.js @@ -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); + } + }); + + diff --git a/site/slowtwitch.com/www/articles/static/fileman/schemes/fileman.jpg b/site/slowtwitch.com/www/articles/static/fileman/schemes/fileman.jpg new file mode 100644 index 0000000..58940d9 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/schemes/fileman.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/schemes/gt.jpg b/site/slowtwitch.com/www/articles/static/fileman/schemes/gt.jpg new file mode 100644 index 0000000..f7f09be Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/schemes/gt.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/schemes/maple.jpg b/site/slowtwitch.com/www/articles/static/fileman/schemes/maple.jpg new file mode 100644 index 0000000..44149a0 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/schemes/maple.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/schemes/rainy.jpg b/site/slowtwitch.com/www/articles/static/fileman/schemes/rainy.jpg new file mode 100644 index 0000000..9153820 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/schemes/rainy.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/schemes/rose.jpg b/site/slowtwitch.com/www/articles/static/fileman/schemes/rose.jpg new file mode 100644 index 0000000..3fd6624 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/schemes/rose.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/langs/en.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/langs/en.js new file mode 100644 index 0000000..ef3e18a --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/langs/en.js @@ -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." +}}}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin.js new file mode 100644 index 0000000..f335004 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin.js @@ -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);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js new file mode 100644 index 0000000..3d2f8b3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 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); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/js/rule.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/js/rule.js new file mode 100644 index 0000000..a60c35f --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/js/rule.js @@ -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); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js new file mode 100644 index 0000000..eec74db --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/langs/en_dlg.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.advhr_dlg',{ +width:"Width", +size:"Height", +noshade:"No shadow" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/rule.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/rule.htm new file mode 100644 index 0000000..c42b9e1 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advhr/rule.htm @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <title>{#advhr.advhr_desc} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + +
+ + +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin.js new file mode 100644 index 0000000..3af5057 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AdvancedImagePlugin',{init:function(ed,url){ed.addCommand('mceAdvImage',function(){if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({file:url+'/image.htm',width:480+parseInt(ed.getLang('advimage.delta_width',0)),height:385+parseInt(ed.getLang('advimage.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('image',{title:'advimage.image_desc',cmd:'mceAdvImage'});},getInfo:function(){return{longname:'Advanced image',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advimage',tinymce.plugins.AdvancedImagePlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js new file mode 100644 index 0000000..b5c9dd4 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/editor_plugin_src.js @@ -0,0 +1,47 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedImagePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceAdvImage', function() { + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + file : url + '/image.htm', + width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)), + height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('image', { + title : 'advimage.image_desc', + cmd : 'mceAdvImage' + }); + }, + + getInfo : function() { + return { + longname : 'Advanced image', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/image.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/image.htm new file mode 100644 index 0000000..3cd7647 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/image.htm @@ -0,0 +1,238 @@ + + + + {#advimage_dlg.dialog_title} + + + + + + + + + + +
+ + +
+
+
+ {#advimage_dlg.general} + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+ +
+ {#advimage_dlg.preview} + +
+
+ +
+
+ {#advimage_dlg.tab_appearance} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ {#advimage_dlg.example_img} + Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam + nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum + edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam + erat volutpat. +
+
+ x + px +
  + + + + +
+
+
+
+ +
+
+ {#advimage_dlg.swap_image} + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+ + + + +
 
+
+ +
+ {#advimage_dlg.misc} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + +
 
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/img/sample.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/img/sample.gif new file mode 100644 index 0000000..53bf689 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/img/sample.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/js/image.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/js/image.js new file mode 100644 index 0000000..1d19ce8 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/js/image.js @@ -0,0 +1,441 @@ +var ImageDialog = { + preInit : function() { + var url; + + tinyMCEPopup.requireLangPack(); + + if (url = tinyMCEPopup.getParam("external_image_list_url")) + document.write(''); + }, + + init : function(ed) { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(); + + tinyMCEPopup.resizeToInnerSize(); + this.fillClassList('class_list'); + this.fillFileList('src_list', 'tinyMCEImageList'); + this.fillFileList('over_list', 'tinyMCEImageList'); + this.fillFileList('out_list', 'tinyMCEImageList'); + TinyMCE_EditableSelects.init(); + + if (n.nodeName == 'IMG') { + nl.src.value = dom.getAttrib(n, 'src'); + nl.width.value = dom.getAttrib(n, 'width'); + nl.height.value = dom.getAttrib(n, 'height'); + nl.alt.value = dom.getAttrib(n, 'alt'); + nl.title.value = dom.getAttrib(n, 'title'); + nl.vspace.value = this.getAttrib(n, 'vspace'); + nl.hspace.value = this.getAttrib(n, 'hspace'); + nl.border.value = this.getAttrib(n, 'border'); + selectByValue(f, 'align', this.getAttrib(n, 'align')); + selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true); + nl.style.value = dom.getAttrib(n, 'style'); + nl.id.value = dom.getAttrib(n, 'id'); + nl.dir.value = dom.getAttrib(n, 'dir'); + nl.lang.value = dom.getAttrib(n, 'lang'); + nl.usemap.value = dom.getAttrib(n, 'usemap'); + nl.longdesc.value = dom.getAttrib(n, 'longdesc'); + nl.insert.value = ed.getLang('update'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover'))) + nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout'))) + nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1'); + + if (ed.settings.inline_styles) { + // Move attribs to styles + if (dom.getAttrib(n, 'align')) + this.updateStyle('align'); + + if (dom.getAttrib(n, 'hspace')) + this.updateStyle('hspace'); + + if (dom.getAttrib(n, 'border')) + this.updateStyle('border'); + + if (dom.getAttrib(n, 'vspace')) + this.updateStyle('vspace'); + } + } + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image'); + if (isVisible('overbrowser')) + document.getElementById('onmouseoversrc').style.width = '260px'; + + // Setup browse button + document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image'); + if (isVisible('outbrowser')) + document.getElementById('onmouseoutsrc').style.width = '260px'; + + // If option enabled default contrain proportions to checked + if (ed.getParam("advimage_constrain_proportions", true)) + f.constrain.checked = true; + + // Check swap image if valid data + if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value) + this.setSwapImage(true); + else + this.setSwapImage(false); + + this.changeAppearance(); + this.showPreviewImage(nl.src.value, 1); + }, + + insert : function(file, title) { + var ed = tinyMCEPopup.editor, t = this, f = document.forms[0]; + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (tinyMCEPopup.getParam("accessibility_warnings", 1)) { + if (!f.alt.value) { + tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) { + if (s) + t.insertAndClose(); + }); + + return; + } + } + + t.insertAndClose(); + }, + + insertAndClose : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + // Fixes crash in Safari + if (tinymce.isWebKit) + ed.getWin().focus(); + + if (!ed.settings.inline_styles) { + args = { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }; + } else { + // Remove deprecated values + args = { + vspace : '', + hspace : '', + border : '', + align : '' + }; + } + + tinymce.extend(args, { + src : nl.src.value, + width : nl.width.value, + height : nl.height.value, + alt : nl.alt.value, + title : nl.title.value, + 'class' : getSelectValue(f, 'class_list'), + style : nl.style.value, + id : nl.id.value, + dir : nl.dir.value, + lang : nl.lang.value, + usemap : nl.usemap.value, + longdesc : nl.longdesc.value + }); + + args.onmouseover = args.onmouseout = ''; + + if (f.onmousemovecheck.checked) { + if (nl.onmouseoversrc.value) + args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';"; + + if (nl.onmouseoutsrc.value) + args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';"; + } + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + setSwapImage : function(st) { + var f = document.forms[0]; + + f.onmousemovecheck.checked = st; + setBrowserDisabled('overbrowser', !st); + setBrowserDisabled('outbrowser', !st); + + if (f.over_list) + f.over_list.disabled = !st; + + if (f.out_list) + f.out_list.disabled = !st; + + f.onmouseoversrc.disabled = !st; + f.onmouseoutsrc.disabled = !st; + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.elements.width.value = f.elements.height.value = ''; + }, + + updateImageData : function(img, st) { + var f = document.forms[0]; + + if (!st) { + f.elements.width.value = img.width; + f.elements.height.value = img.height; + } + + this.preloadImg = img; + }, + + changeAppearance : function() { + var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg'); + + if (img) { + if (ed.getParam('inline_styles')) { + ed.dom.setAttrib(img, 'style', f.style.value); + } else { + img.align = f.align.value; + img.border = f.border.value; + img.hspace = f.hspace.value; + img.vspace = f.vspace.value; + } + } + }, + + changeHeight : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height; + f.height.value = tp.toFixed(0); + }, + + changeWidth : function() { + var f = document.forms[0], tp, t = this; + + if (!f.constrain.checked || !t.preloadImg) { + return; + } + + if (f.width.value == "" || f.height.value == "") + return; + + tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width; + f.width.value = tp.toFixed(0); + }, + + updateStyle : function(ty) { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value}); + + if (tinyMCEPopup.editor.settings.inline_styles) { + // Handle align + if (ty == 'align') { + dom.setStyle(img, 'float', ''); + dom.setStyle(img, 'vertical-align', ''); + + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') + dom.setStyle(img, 'float', v); + else + img.style.verticalAlign = v; + } + } + + // Handle border + if (ty == 'border') { + dom.setStyle(img, 'border', ''); + + v = f.border.value; + if (v || v == '0') { + if (v == '0') + img.style.border = '0'; + else + img.style.border = v + 'px solid black'; + } + } + + // Handle hspace + if (ty == 'hspace') { + dom.setStyle(img, 'marginLeft', ''); + dom.setStyle(img, 'marginRight', ''); + + v = f.hspace.value; + if (v) { + img.style.marginLeft = v + 'px'; + img.style.marginRight = v + 'px'; + } + } + + // Handle vspace + if (ty == 'vspace') { + dom.setStyle(img, 'marginTop', ''); + dom.setStyle(img, 'marginBottom', ''); + + v = f.vspace.value; + if (v) { + img.style.marginTop = v + 'px'; + img.style.marginBottom = v + 'px'; + } + } + + // Merge + dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText)); + } + }, + + changeMouseMove : function() { + }, + + showPreviewImage : function(u, st) { + if (!u) { + tinyMCEPopup.dom.setHTML('prev', ''); + return; + } + + if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true)) + this.resetImageData(); + + u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u); + + if (!st) + tinyMCEPopup.dom.setHTML('prev', ''); + else + tinyMCEPopup.dom.setHTML('prev', ''); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js new file mode 100644 index 0000000..ef81f78 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advimage/langs/en_dlg.js @@ -0,0 +1,43 @@ +tinyMCE.addI18n('en.advimage_dlg',{ +tab_general:"General", +tab_appearance:"Appearance", +tab_advanced:"Advanced", +general:"General", +title:"Title", +preview:"Preview", +constrain_proportions:"Constrain proportions", +langdir:"Language direction", +langcode:"Language code", +long_desc:"Long description link", +style:"Style", +classes:"Classes", +ltr:"Left to right", +rtl:"Right to left", +id:"Id", +map:"Image map", +swap_image:"Swap image", +alt_image:"Alternative image", +mouseover:"for mouse over", +mouseout:"for mouse out", +misc:"Miscellaneous", +example_img:"Appearance preview image", +missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.", +dialog_title:"Insert/edit image", +src:"Image URL", +alt:"Image description", +list:"Image list", +border:"Border", +dimensions:"Dimensions", +vspace:"Vertical space", +hspace:"Horizontal space", +align:"Alignment", +align_baseline:"Baseline", +align_top:"Top", +align_middle:"Middle", +align_bottom:"Bottom", +align_texttop:"Text top", +align_textbottom:"Text bottom", +align_left:"Left", +align_right:"Right", +image_list:"Image list" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin.js new file mode 100644 index 0000000..4899f7b --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.AdvancedLinkPlugin',{init:function(ed,url){this.editor=ed;ed.addCommand('mceAdvLink',function(){var se=ed.selection;if(se.isCollapsed()&&!ed.dom.getParent(se.getNode(),'A'))return;ed.windowManager.open({file:url+'/link.htm',width:480+parseInt(ed.getLang('advlink.delta_width',0)),height:400+parseInt(ed.getLang('advlink.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('link',{title:'advlink.link_desc',cmd:'mceAdvLink'});ed.addShortcut('ctrl+k','advlink.advlink_desc','mceAdvLink');ed.onNodeChange.add(function(ed,cm,n,co){cm.setDisabled('link',co&&n.nodeName!='A');cm.setActive('link',n.nodeName=='A'&&!n.name);});},getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advlink',tinymce.plugins.AdvancedLinkPlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js new file mode 100644 index 0000000..2d7f0ee --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/editor_plugin_src.js @@ -0,0 +1,58 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { + init : function(ed, url) { + this.editor = ed; + + // Register commands + ed.addCommand('mceAdvLink', function() { + var se = ed.selection; + + // No selection and not in link + if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) + return; + + ed.windowManager.open({ + file : url + '/link.htm', + width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), + height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('link', { + title : 'advlink.link_desc', + cmd : 'mceAdvLink' + }); + + ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); + + ed.onNodeChange.add(function(ed, cm, n, co) { + cm.setDisabled('link', co && n.nodeName != 'A'); + cm.setActive('link', n.nodeName == 'A' && !n.name); + }); + }, + + getInfo : function() { + return { + longname : 'Advanced link', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/js/advlink.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/js/advlink.js new file mode 100644 index 0000000..6ca8fc6 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/js/advlink.js @@ -0,0 +1,528 @@ +/* Functions for the advlink plugin popup */ + +tinyMCEPopup.requireLangPack(); + +var templates = { + "window.open" : "window.open('${url}','${target}','${options}')" +}; + +function preinit() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); +} + +function changeClass() { + var f = document.forms[0]; + + f.classes.value = getSelectValue(f, 'classlist'); +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + var formObj = document.forms[0]; + var inst = tinyMCEPopup.editor; + var elm = inst.selection.getNode(); + var action = "insert"; + var html; + + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink'); + document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink'); + document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href'); + document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href'); + document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target'); + + // Link list + html = getLinkListHTML('linklisthref','href'); + if (html == "") + document.getElementById("linklisthrefrow").style.display = 'none'; + else + document.getElementById("linklisthrefcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '260px'; + + if (isVisible('popupurlbrowser')) + document.getElementById('popupurl').style.width = '180px'; + + elm = inst.dom.getParent(elm, "A"); + if (elm != null && elm.nodeName == "A") + action = "update"; + + formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true); + + setPopupControlsDisabled(true); + + if (action == "update") { + var href = inst.dom.getAttrib(elm, 'href'); + var onclick = inst.dom.getAttrib(elm, 'onclick'); + + // Setup form data + setFormValue('href', href); + setFormValue('title', inst.dom.getAttrib(elm, 'title')); + setFormValue('id', inst.dom.getAttrib(elm, 'id')); + setFormValue('style', inst.dom.getAttrib(elm, "style")); + setFormValue('rel', inst.dom.getAttrib(elm, 'rel')); + setFormValue('rev', inst.dom.getAttrib(elm, 'rev')); + setFormValue('charset', inst.dom.getAttrib(elm, 'charset')); + setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang')); + setFormValue('dir', inst.dom.getAttrib(elm, 'dir')); + setFormValue('lang', inst.dom.getAttrib(elm, 'lang')); + setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : "")); + setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : "")); + setFormValue('type', inst.dom.getAttrib(elm, 'type')); + setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus')); + setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur')); + setFormValue('onclick', onclick); + setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick')); + setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown')); + setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup')); + setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover')); + setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove')); + setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout')); + setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress')); + setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown')); + setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup')); + setFormValue('target', inst.dom.getAttrib(elm, 'target')); + setFormValue('classes', inst.dom.getAttrib(elm, 'class')); + + // Parse onclick data + if (onclick != null && onclick.indexOf('window.open') != -1) + parseWindowOpen(onclick); + else + parseFunction(onclick); + + // Select by the values + selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir')); + selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel')); + selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev')); + selectByValue(formObj, 'linklisthref', href); + + if (href.charAt(0) == '#') + selectByValue(formObj, 'anchorlist', href); + + addClassesToList('classlist', 'advlink_styles'); + + selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true); + selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true); + } else + addClassesToList('classlist', 'advlink_styles'); +} + +function checkPrefix(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external'))) + n.value = 'http://' + n.value; +} + +function setFormValue(name, value) { + document.forms[0].elements[name].value = value; +} + +function parseWindowOpen(onclick) { + var formObj = document.forms[0]; + + // Preprocess center code + if (onclick.indexOf('return false;') != -1) { + formObj.popupreturn.checked = true; + onclick = onclick.replace('return false;', ''); + } else + formObj.popupreturn.checked = false; + + var onClickData = parseLink(onclick); + + if (onClickData != null) { + formObj.ispopup.checked = true; + setPopupControlsDisabled(false); + + var onClickWindowOptions = parseOptions(onClickData['options']); + var url = onClickData['url']; + + formObj.popupname.value = onClickData['target']; + formObj.popupurl.value = url; + formObj.popupwidth.value = getOption(onClickWindowOptions, 'width'); + formObj.popupheight.value = getOption(onClickWindowOptions, 'height'); + + formObj.popupleft.value = getOption(onClickWindowOptions, 'left'); + formObj.popuptop.value = getOption(onClickWindowOptions, 'top'); + + if (formObj.popupleft.value.indexOf('screen') != -1) + formObj.popupleft.value = "c"; + + if (formObj.popuptop.value.indexOf('screen') != -1) + formObj.popuptop.value = "c"; + + formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes"; + formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes"; + formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes"; + formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes"; + formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes"; + formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes"; + formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes"; + + buildOnClick(); + } +} + +function parseFunction(onclick) { + var formObj = document.forms[0]; + var onClickData = parseLink(onclick); + + // TODO: Add stuff here +} + +function getOption(opts, name) { + return typeof(opts[name]) == "undefined" ? "" : opts[name]; +} + +function setPopupControlsDisabled(state) { + var formObj = document.forms[0]; + + formObj.popupname.disabled = state; + formObj.popupurl.disabled = state; + formObj.popupwidth.disabled = state; + formObj.popupheight.disabled = state; + formObj.popupleft.disabled = state; + formObj.popuptop.disabled = state; + formObj.popuplocation.disabled = state; + formObj.popupscrollbars.disabled = state; + formObj.popupmenubar.disabled = state; + formObj.popupresizable.disabled = state; + formObj.popuptoolbar.disabled = state; + formObj.popupstatus.disabled = state; + formObj.popupreturn.disabled = state; + formObj.popupdependent.disabled = state; + + setBrowserDisabled('popupurlbrowser', state); +} + +function parseLink(link) { + link = link.replace(new RegExp(''', 'g'), "'"); + + var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1"); + + // Is function name a template function + var template = templates[fnName]; + if (template) { + // Build regexp + var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi")); + var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\("; + var replaceStr = ""; + for (var i=0; i'); + for (var i=0; i'; + html += ''; + + for (i=0; i' + name + ''; + } + + html += ''; + + return html; +} + +function insertAction() { + var inst = tinyMCEPopup.editor; + var elm, elementArray, i; + + elm = inst.selection.getNode(); + checkPrefix(document.forms[0].href); + + elm = inst.dom.getParent(elm, "A"); + + // Remove element if there is no href + if (!document.forms[0].href.value) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + i = inst.selection.getBookmark(); + inst.dom.remove(elm, 1); + inst.selection.moveToBookmark(i); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (elm == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';}); + for (i=0; i' + tinyMCELinkList[i][0] + ''; + + html += ''; + + return html; + + // tinyMCE.debug('-- image list start --', html, '-- image list end --'); +} + +function getTargetListHTML(elm_id, target_form_element) { + var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';'); + var html = ''; + + html += ''; + + return html; +} + +// While loading +preinit(); +tinyMCEPopup.onInit.add(init); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js new file mode 100644 index 0000000..8ef9c79 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/langs/en_dlg.js @@ -0,0 +1,52 @@ +tinyMCE.addI18n('en.advlink_dlg',{ +title:"Insert/edit link", +url:"Link URL", +target:"Target", +titlefield:"Title", +is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +list:"Link list", +general_tab:"General", +popup_tab:"Popup", +events_tab:"Events", +advanced_tab:"Advanced", +general_props:"General properties", +popup_props:"Popup properties", +event_props:"Events", +advanced_props:"Advanced properties", +popup_opts:"Options", +anchor_names:"Anchors", +target_same:"Open in this window / frame", +target_parent:"Open in parent window / frame", +target_top:"Open in top frame (replaces all frames)", +target_blank:"Open in new window", +popup:"Javascript popup", +popup_url:"Popup URL", +popup_name:"Window name", +popup_return:"Insert 'return false'", +popup_scrollbars:"Show scrollbars", +popup_statusbar:"Show status bar", +popup_toolbar:"Show toolbars", +popup_menubar:"Show menu bar", +popup_location:"Show location bar", +popup_resizable:"Make window resizable", +popup_dependent:"Dependent (Mozilla/Firefox only)", +popup_size:"Size", +popup_position:"Position (X/Y)", +id:"Id", +style:"Style", +classes:"Classes", +target_name:"Target name", +langdir:"Language direction", +target_langcode:"Target language", +langcode:"Language code", +encoding:"Target character encoding", +mime:"Target MIME type", +rel:"Relationship page to target", +rev:"Relationship target to page", +tabindex:"Tabindex", +accesskey:"Accesskey", +ltr:"Left to right", +rtl:"Right to left", +link_list:"Link list" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/link.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/link.htm new file mode 100644 index 0000000..bb8e654 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/advlink/link.htm @@ -0,0 +1,339 @@ + + + + {#advlink_dlg.title} + + + + + + + + + +
+ + +
+
+
+ {#advlink_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
 
 
 
+ +
+
+
+ + + +
+
+ {#advlink_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+ +
+
+ {#advlink_dlg.event_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin.js new file mode 100644 index 0000000..31423da --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});ed.addButton('fullpage',{title:'fullpage.desc',cmd:'mceFullPageProperties'});ed.onBeforeSetContent.add(t._setContent,t);ed.onSetContent.add(t._setBodyAttribs,t);ed.onGetContent.add(t._getContent,t);},getInfo:function(){return{longname:'Fullpage',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);for(i=0,len=bdattr.length;i',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('\n';t.head+=ed.getParam('fullpage_default_doctype','');t.head+='\n\n\n'+ed.getParam('fullpage_default_title','Untitled document')+'\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='\n\n';t.foot='\n\n';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js new file mode 100644 index 0000000..985eb1a --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/editor_plugin_src.js @@ -0,0 +1,140 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:26 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.FullPagePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + + // Register commands + ed.addCommand('mceFullPageProperties', function() { + ed.windowManager.open({ + file : url + '/fullpage.htm', + width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)), + height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + head_html : t.head + }); + }); + + // Register buttons + ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'}); + + ed.onBeforeSetContent.add(t._setContent, t); + ed.onSetContent.add(t._setBodyAttribs, t); + ed.onGetContent.add(t._getContent, t); + }, + + getInfo : function() { + return { + longname : 'Fullpage', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + _setBodyAttribs : function(ed, o) { + var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i); + + if (attr && attr[1]) { + bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g); + + for(i = 0, len = bdattr.length; i < len; i++) { + kv = bdattr[i].split('='); + k = kv[0].replace(/\s/,''); + v = kv[1]; + + if (v) { + v = v.replace(/^\s+/,'').replace(/\s+$/,''); + t = v.match(/^["'](.*)["']$/); + + if (t) + v = t[1]; + } else + v = k; + + ed.dom.setAttrib(ed.getBody(), 'style', v); + } + } + }, + + _createSerializer : function() { + return new tinymce.dom.Serializer({ + dom : this.editor.dom, + apply_source_formatting : true + }); + }, + + _setContent : function(ed, o) { + var t = this, sp, ep, c = o.content, v, st = ''; + + // Parse out head, body and footer + c = c.replace(/<(\/?)BODY/gi, '<$1body'); + sp = c.indexOf('', sp); + t.head = c.substring(0, sp + 1); + + ep = c.indexOf('\n'; + + t.head += ed.getParam('fullpage_default_doctype', ''); + t.head += '\n\n\n' + ed.getParam('fullpage_default_title', 'Untitled document') + '\n'; + + if (v = ed.getParam('fullpage_default_encoding')) + t.head += '\n'; + + if (v = ed.getParam('fullpage_default_font_family')) + st += 'font-family: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_font_size')) + st += 'font-size: ' + v + ';'; + + if (v = ed.getParam('fullpage_default_text_color')) + st += 'color: ' + v + ';'; + + t.head += '\n\n'; + t.foot = '\n\n'; + } + }, + + _getContent : function(ed, o) { + var t = this; + + o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot); + } + }); + + // Register plugin + tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/fullpage.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/fullpage.htm new file mode 100644 index 0000000..eabc823 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/fullpage.htm @@ -0,0 +1,577 @@ + + + + {#fullpage_dlg.title} + + + + + + + + +
+ + +
+
+
+ {#fullpage_dlg.meta_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
 
 
 
 
  + +
+
+ +
+ {#fullpage_dlg.langprops} + + + + + + + + + + + + + + + + + + + + + + +
+ +
  + +
 
+ +
 
+
+
+ +
+
+ {#fullpage_dlg.appearance_textprops} + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+
+ +
+ {#fullpage_dlg.appearance_bgprops} + + + + + + + + + + +
+ + + + + +
 
+
+ + + + + +
 
+
+
+ +
+ {#fullpage_dlg.appearance_marginprops} + + + + + + + + + + + + + + +
+
+ +
+ {#fullpage_dlg.appearance_linkprops} + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
 
+
+ + + + + +
 
+
  
+
+ +
+ {#fullpage_dlg.appearance_style} + + + + + + + + + + +
+ + + + +
 
+
+
+ +
+ + +
+ {#fullpage_dlg.head_elements} + +
+
+
+ + +
+
+ + +
+
+
+ +
+
+ +
+ {#fullpage_dlg.meta_element} + + + + + + + + + + + + + + +
+ + +
+ +
+ {#fullpage_dlg.title_element} + + + + + + +
+ + +
+ +
+ {#fullpage_dlg.script_element} + + + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+ +
+ +
+
+ + +
+ +
+ {#fullpage_dlg.style_element} + + + +
+ +
+
+ + + + + + + + + +
+
+ +
+ +
+
+ + +
+ +
+ {#fullpage_dlg.base_element} + + + + + + + + + + +
+ + +
+ + + +
+ {#fullpage_dlg.comment_element} + + + + +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/js/fullpage.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/js/fullpage.js new file mode 100644 index 0000000..d87af1e --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/fullpage/js/fullpage.js @@ -0,0 +1,462 @@ +tinyMCEPopup.requireLangPack(); + +var doc; + +var defaultDocTypes = + 'XHTML 1.0 Transitional=,' + + 'XHTML 1.0 Frameset=,' + + 'XHTML 1.0 Strict=,' + + 'XHTML 1.1=,' + + 'HTML 4.01 Transitional=,' + + 'HTML 4.01 Strict=,' + + 'HTML 4.01 Frameset='; + +var defaultEncodings = + 'Western european (iso-8859-1)=iso-8859-1,' + + 'Central European (iso-8859-2)=iso-8859-2,' + + 'Unicode (UTF-8)=utf-8,' + + 'Chinese traditional (Big5)=big5,' + + 'Cyrillic (iso-8859-5)=iso-8859-5,' + + 'Japanese (iso-2022-jp)=iso-2022-jp,' + + 'Greek (iso-8859-7)=iso-8859-7,' + + 'Korean (iso-2022-kr)=iso-2022-kr,' + + 'ASCII (us-ascii)=us-ascii'; + +var defaultMediaTypes = + 'all=all,' + + 'screen=screen,' + + 'print=print,' + + 'tty=tty,' + + 'tv=tv,' + + 'projection=projection,' + + 'handheld=handheld,' + + 'braille=braille,' + + 'aural=aural'; + +var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings'; +var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px'; + +function init() { + var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style; + + // Setup doctype select box + doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(','); + for (i=0; i 1) + addSelectValue(f, 'doctypes', p[0], p[1]); + } + + // Setup fonts select box + fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';'); + for (i=0; i 1) + addSelectValue(f, 'fontface', p[0], p[1]); + } + + // Setup fontsize select box + fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(','); + for (i=0; i 1) { + addSelectValue(f, 'element_style_media', p[0], p[1]); + addSelectValue(f, 'element_link_media', p[0], p[1]); + } + } + + // Setup encodings select box + encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(','); + for (i=0; i 1) { + addSelectValue(f, 'docencoding', p[0], p[1]); + addSelectValue(f, 'element_script_charset', p[0], p[1]); + addSelectValue(f, 'element_link_charset', p[0], p[1]); + } + } + + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color'); + //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color'); + document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color'); + document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color'); + document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor'); + document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage'); + document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage'); + document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage'); + document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage'); + + // Resize some elements + if (isVisible('stylesheetbrowser')) + document.getElementById('stylesheet').style.width = '220px'; + + if (isVisible('link_href_browser')) + document.getElementById('element_link_href').style.width = '230px'; + + if (isVisible('bgimage_browser')) + document.getElementById('bgimage').style.width = '210px'; + + // Add iframe + dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}}); + doc = dom.get('documentIframe').contentWindow.document; + h = tinyMCEPopup.getWindowArg('head_html'); + + // Preprocess the HTML disable scripts and urls + h = h.replace(/';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/editor_plugin_src.js new file mode 100644 index 0000000..c48dd8d --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/editor_plugin_src.js @@ -0,0 +1,365 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:27 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.MediaPlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + function isMediaElm(n) { + return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); + }; + + ed.onPreInit.add(function() { + // Force in _value parameter this extra parameter is required for older Opera versions + ed.serializer.addRules('param[name|value|_value]'); + }); + + // Register commands + ed.addCommand('mceMedia', function() { + ed.windowManager.open({ + file : url + '/media.htm', + width : 430 + parseInt(ed.getLang('media.delta_width', 0)), + height : 470 + parseInt(ed.getLang('media.delta_height', 0)), + inline : 1 + }, { + plugin_url : url + }); + }); + + // Register buttons + ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); + }); + + ed.onInit.add(function() { + var lo = { + mceItemFlash : 'flash', + mceItemShockWave : 'shockwave', + mceItemWindowsMedia : 'windowsmedia', + mceItemQuickTime : 'quicktime', + mceItemRealMedia : 'realmedia' + }; + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(url + "/css/content.css"); + + if (ed.theme.onResolveName) { + ed.theme.onResolveName.add(function(th, o) { + if (o.name == 'img') { + each(lo, function(v, k) { + if (ed.dom.hasClass(o.node, k)) { + o.name = v; + o.title = ed.dom.getAttrib(o.node, 'title'); + return false; + } + }); + } + }); + } + + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { + m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); + } + }); + } + }); + + ed.onBeforeSetContent.add(function(ed, o) { + var h = o.content; + + h = h.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { + var o = t._parse(c); + + return '' + }); + + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)\/>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/(object|embed)([^>]*)>/gi, ''); + h = h.replace(/]*)>/gi, function(a, b) {return ''}); + h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam">'); + + o.content = h; + }); + + ed.onSetContent.add(function() { + t._spansToImgs(ed.getBody()); + }); + + ed.onPreProcess.add(function(ed, o) { + var dom = ed.dom; + + if (o.set) { + t._spansToImgs(o.node); + + each(dom.select('IMG', o.node), function(n) { + var p; + + if (isMediaElm(n)) { + p = t._parse(n.title); + dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); + dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); + } + }); + } + + if (o.get) { + each(dom.select('IMG', o.node), function(n) { + var ci, cb, mt; + + if (ed.getParam('media_use_script')) { + if (isMediaElm(n)) + n.className = n.className.replace(/mceItem/g, 'mceTemp'); + + return; + } + + switch (n.className) { + case 'mceItemFlash': + ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'application/x-shockwave-flash'; + break; + + case 'mceItemShockWave': + ci = '166b1bca-3f9c-11cf-8075-444553540000'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + mt = 'application/x-director'; + break; + + case 'mceItemWindowsMedia': + ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; + cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + mt = 'application/x-mplayer2'; + break; + + case 'mceItemQuickTime': + ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; + cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + mt = 'video/quicktime'; + break; + + case 'mceItemRealMedia': + ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; + cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + mt = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (ci) { + dom.replace(t._buildObj({ + classid : ci, + codebase : cb, + type : mt + }, n), n); + } + }); + } + }); + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/_value=/g, 'value='); + }); + + if (ed.getParam('media_use_script')) { + function getAttr(s, n) { + n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); + + return n ? ed.dom.decode(n[1]) : ''; + }; + + ed.onPostProcess.add(function(ed, o) { + o.content = o.content.replace(/]+>/g, function(im) { + var cl = getAttr(im, 'class'); + + if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { + at = t._parse(getAttr(im, 'title')); + at.width = getAttr(im, 'width'); + at.height = getAttr(im, 'height'); + im = ''; + } + + return im; + }); + }); + } + }, + + getInfo : function() { + return { + longname : 'Media', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private methods + + _buildObj : function(o, n) { + var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); + + p.width = o.width = dom.getAttrib(n, 'width') || 100; + p.height = o.height = dom.getAttrib(n, 'height') || 100; + + ob = dom.create('span', { + mce_name : 'object', + classid : "clsid:" + o.classid, + codebase : o.codebase, + width : o.width, + height : o.height + }); + + if (p.src) + p.src = ed.convertURL(p.src, 'src', n); + + each (p, function(v, k) { + if (!/^(width|height|codebase|classid)$/.test(k)) { + // Use url instead of src in IE for Windows media + if (o.type == 'application/x-mplayer2' && k == 'src') + k = 'url'; + + dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v}); + } + }); + + dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p)); + + return ob; + }, + + _spansToImgs : function(p) { + var t = this, dom = t.editor.dom, im, ci; + + each(dom.select('span', p), function(n) { + // Convert object into image + if (dom.getAttrib(n, 'class') == 'mceItemObject') { + ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); + + switch (ci) { + case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': + case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': + case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + + return; + } + + // Convert embed into image + if (dom.getAttrib(n, 'class') == 'mceItemEmbed') { + switch (dom.getAttrib(n, 'type')) { + case 'application/x-shockwave-flash': + dom.replace(t._createImg('mceItemFlash', n), n); + break; + + case 'application/x-director': + dom.replace(t._createImg('mceItemShockWave', n), n); + break; + + case 'application/x-mplayer2': + dom.replace(t._createImg('mceItemWindowsMedia', n), n); + break; + + case 'video/quicktime': + dom.replace(t._createImg('mceItemQuickTime', n), n); + break; + + case 'audio/x-pn-realaudio-plugin': + dom.replace(t._createImg('mceItemRealMedia', n), n); + break; + + default: + dom.replace(t._createImg('mceItemFlash', n), n); + } + } + }); + }, + + _createImg : function(cl, n) { + var im, dom = this.editor.dom, pa = {}, ti = ''; + + // Create image + im = dom.create('img', { + src : this.url + '/img/trans.gif', + width : dom.getAttrib(n, 'width') || 100, + height : dom.getAttrib(n, 'height') || 100, + 'class' : cl + }); + + // Setup base parameters + each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) { + var v = dom.getAttrib(n, na); + + if (v) + pa[na] = v; + }); + + // Add optional parameters + each(dom.select('span', n), function(n) { + if (dom.hasClass(n, 'mceItemParam')) + pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value'); + }); + + // Use src not movie + if (pa.movie) { + pa.src = pa.movie; + delete pa.movie; + } + + delete pa.width; + delete pa.height; + + im.title = this._serialize(pa); + + return im; + }, + + _parse : function(s) { + return tinymce.util.JSON.parse('{' + s + '}'); + }, + + _serialize : function(o) { + return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); + } + }); + + // Register plugin + tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flash.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flash.gif new file mode 100644 index 0000000..cb192e6 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flash.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flv_player.swf b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flv_player.swf new file mode 100644 index 0000000..042c2ab Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/flv_player.swf differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/quicktime.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/quicktime.gif new file mode 100644 index 0000000..3b04991 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/quicktime.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/realmedia.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/realmedia.gif new file mode 100644 index 0000000..fdfe0b9 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/realmedia.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/shockwave.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/shockwave.gif new file mode 100644 index 0000000..5f235df Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/shockwave.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/trans.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/trans.gif new file mode 100644 index 0000000..3884865 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/trans.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/windowsmedia.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/windowsmedia.gif new file mode 100644 index 0000000..ab50f2d Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/img/windowsmedia.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/js/embed.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/js/embed.js new file mode 100644 index 0000000..6fe25de --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/media/js/embed.js @@ -0,0 +1,73 @@ +/** + * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. + */ + +function writeFlash(p) { + writeEmbed( + 'D27CDB6E-AE6D-11cf-96B8-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'application/x-shockwave-flash', + p + ); +} + +function writeShockWave(p) { + writeEmbed( + '166B1BCA-3F9C-11CF-8075-444553540000', + 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', + 'application/x-director', + p + ); +} + +function writeQuickTime(p) { + writeEmbed( + '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', + 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', + 'video/quicktime', + p + ); +} + +function writeRealMedia(p) { + writeEmbed( + 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', + 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', + 'audio/x-pn-realaudio-plugin', + p + ); +} + +function writeWindowsMedia(p) { + p.url = p.src; + writeEmbed( + '6BF52A52-394A-11D3-B153-00C04F79FAA6', + 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', + 'application/x-mplayer2', + p + ); +} + +function writeEmbed(cls, cb, mt, p) { + var h = '', n; + + h += ''; + + h += ''); + +function init() { + var pl = "", f, val; + var type = "flash", fe, i; + + ed = tinyMCEPopup.editor; + + tinyMCEPopup.resizeToInnerSize(); + f = document.forms[0] + + fe = ed.selection.getNode(); + if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + pl = fe.title; + + switch (ed.dom.getAttrib(fe, 'class')) { + case 'mceItemFlash': + type = 'flash'; + break; + + case 'mceItemFlashVideo': + type = 'flv'; + break; + + case 'mceItemShockWave': + type = 'shockwave'; + break; + + case 'mceItemWindowsMedia': + type = 'wmp'; + break; + + case 'mceItemQuickTime': + type = 'qt'; + break; + + case 'mceItemRealMedia': + type = 'rmp'; + break; + } + + document.forms[0].insert.value = ed.getLang('update', 'Insert', true); + } + + document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); + document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var html = getMediaListHTML('medialist','src','media','media'); + if (html == "") + document.getElementById("linklistrow").style.display = 'none'; + else + document.getElementById("linklistcontainer").innerHTML = html; + + // Resize some elements + if (isVisible('filebrowser')) + document.getElementById('src').style.width = '230px'; + + // Setup form + if (pl != "") { + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + switch (type) { + case "flash": + setBool(pl, 'flash', 'play'); + setBool(pl, 'flash', 'loop'); + setBool(pl, 'flash', 'menu'); + setBool(pl, 'flash', 'swliveconnect'); + setStr(pl, 'flash', 'quality'); + setStr(pl, 'flash', 'scale'); + setStr(pl, 'flash', 'salign'); + setStr(pl, 'flash', 'wmode'); + setStr(pl, 'flash', 'base'); + setStr(pl, 'flash', 'flashvars'); + break; + + case "qt": + setBool(pl, 'qt', 'loop'); + setBool(pl, 'qt', 'autoplay'); + setBool(pl, 'qt', 'cache'); + setBool(pl, 'qt', 'controller'); + setBool(pl, 'qt', 'correction'); + setBool(pl, 'qt', 'enablejavascript'); + setBool(pl, 'qt', 'kioskmode'); + setBool(pl, 'qt', 'autohref'); + setBool(pl, 'qt', 'playeveryframe'); + setBool(pl, 'qt', 'tarsetcache'); + setStr(pl, 'qt', 'scale'); + setStr(pl, 'qt', 'starttime'); + setStr(pl, 'qt', 'endtime'); + setStr(pl, 'qt', 'tarset'); + setStr(pl, 'qt', 'qtsrcchokespeed'); + setStr(pl, 'qt', 'volume'); + setStr(pl, 'qt', 'qtsrc'); + break; + + case "shockwave": + setBool(pl, 'shockwave', 'sound'); + setBool(pl, 'shockwave', 'progress'); + setBool(pl, 'shockwave', 'autostart'); + setBool(pl, 'shockwave', 'swliveconnect'); + setStr(pl, 'shockwave', 'swvolume'); + setStr(pl, 'shockwave', 'swstretchstyle'); + setStr(pl, 'shockwave', 'swstretchhalign'); + setStr(pl, 'shockwave', 'swstretchvalign'); + break; + + case "wmp": + setBool(pl, 'wmp', 'autostart'); + setBool(pl, 'wmp', 'enabled'); + setBool(pl, 'wmp', 'enablecontextmenu'); + setBool(pl, 'wmp', 'fullscreen'); + setBool(pl, 'wmp', 'invokeurls'); + setBool(pl, 'wmp', 'mute'); + setBool(pl, 'wmp', 'stretchtofit'); + setBool(pl, 'wmp', 'windowlessvideo'); + setStr(pl, 'wmp', 'balance'); + setStr(pl, 'wmp', 'baseurl'); + setStr(pl, 'wmp', 'captioningid'); + setStr(pl, 'wmp', 'currentmarker'); + setStr(pl, 'wmp', 'currentposition'); + setStr(pl, 'wmp', 'defaultframe'); + setStr(pl, 'wmp', 'playcount'); + setStr(pl, 'wmp', 'rate'); + setStr(pl, 'wmp', 'uimode'); + setStr(pl, 'wmp', 'volume'); + break; + + case "rmp": + setBool(pl, 'rmp', 'autostart'); + setBool(pl, 'rmp', 'loop'); + setBool(pl, 'rmp', 'autogotourl'); + setBool(pl, 'rmp', 'center'); + setBool(pl, 'rmp', 'imagestatus'); + setBool(pl, 'rmp', 'maintainaspect'); + setBool(pl, 'rmp', 'nojava'); + setBool(pl, 'rmp', 'prefetch'); + setBool(pl, 'rmp', 'shuffle'); + setStr(pl, 'rmp', 'console'); + setStr(pl, 'rmp', 'controls'); + setStr(pl, 'rmp', 'numloop'); + setStr(pl, 'rmp', 'scriptcallbacks'); + break; + } + + setStr(pl, null, 'src'); + setStr(pl, null, 'id'); + setStr(pl, null, 'name'); + setStr(pl, null, 'vspace'); + setStr(pl, null, 'hspace'); + setStr(pl, null, 'bgcolor'); + setStr(pl, null, 'align'); + setStr(pl, null, 'width'); + setStr(pl, null, 'height'); + + if ((val = ed.dom.getAttrib(fe, "width")) != "") + pl.width = f.width.value = val; + + if ((val = ed.dom.getAttrib(fe, "height")) != "") + pl.height = f.height.value = val; + + oldWidth = pl.width ? parseInt(pl.width) : 0; + oldHeight = pl.height ? parseInt(pl.height) : 0; + } else + oldWidth = oldHeight = 0; + + selectByValue(f, 'media_type', type); + changedType(type); + updateColor('bgcolor_pick', 'bgcolor'); + + TinyMCE_EditableSelects.init(); + generatePreview(); +} + +function insertMedia() { + var fe, f = document.forms[0], h; + + tinyMCEPopup.restoreSelection(); + + if (!AutoValidator.validate(f)) { + alert(ed.getLang('invalid_data')); + return false; + } + + f.width.value = f.width.value == "" ? 100 : f.width.value; + f.height.value = f.height.value == "" ? 100 : f.height.value; + + fe = ed.selection.getNode(); + if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) { + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + fe.className = "mceItemFlash"; + break; + + case "flv": + fe.className = "mceItemFlashVideo"; + break; + + case "shockwave": + fe.className = "mceItemShockWave"; + break; + + case "qt": + fe.className = "mceItemQuickTime"; + break; + + case "wmp": + fe.className = "mceItemWindowsMedia"; + break; + + case "rmp": + fe.className = "mceItemRealMedia"; + break; + } + + if (fe.width != f.width.value || fe.height != f.height.height) + ed.execCommand('mceRepaint'); + + fe.title = serializeParameters(); + fe.width = f.width.value; + fe.height = f.height.value; + fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); + fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); + fe.align = f.align.options[f.align.selectedIndex].value; + } else { + h = ' 0) { + var html = ""; + + html += ''; + + return html; + } + + return ""; +} + +function getType(v) { + var fo, i, c, el, x, f = document.forms[0]; + + fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.match(/watch\?v=(.+)(.*)/)) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1]; + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } + + for (i=0; i 0 ? s.substring(0, s.length - 1) : s; + + return s; +} + +function setBool(pl, p, n) { + if (typeof(pl[n]) == "undefined") + return; + + document.forms[0].elements[p + "_" + n].checked = pl[n]; +} + +function setStr(pl, p, n) { + var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; + + if (typeof(pl[n]) == "undefined") + return; + + if (e.type == "text") + e.value = pl[n]; + else + selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); +} + +function getBool(p, n, d, tv, fv) { + var v = document.forms[0].elements[p + "_" + n].checked; + + tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; + fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; + + return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); +} + +function getStr(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + if (n == 'src') + v = tinyMCEPopup.editor.convertURL(v, 'src', null); + + return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); +} + +function getInt(p, n, d) { + var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; + var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; + + return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); +} + +function jsEncode(s) { + s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); + s = s.replace(new RegExp('"', 'g'), '\\"'); + s = s.replace(new RegExp("'", 'g'), "\\'"); + + return s; +} + +function generatePreview(c) { + var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; + + p.innerHTML = ''; + + nw = parseInt(f.width.value); + nh = parseInt(f.height.value); + + if (f.width.value != "" && f.height.value != "") { + if (f.constrain.checked) { + if (c == 'width' && oldWidth != 0) { + wp = nw / oldWidth; + nh = Math.round(wp * nh); + f.height.value = nh; + } else if (c == 'height' && oldHeight != 0) { + hp = nh / oldHeight; + nw = Math.round(hp * nw); + f.width.value = nw; + } + } + } + + if (f.width.value != "") + oldWidth = nw; + + if (f.height.value != "") + oldHeight = nh; + + // After constrain + pl = serializeParameters(); + + switch (f.media_type.options[f.media_type.selectedIndex].value) { + case "flash": + cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; + type = 'application/x-shockwave-flash'; + break; + + case "shockwave": + cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; + codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; + type = 'application/x-director'; + break; + + case "qt": + cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; + codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; + type = 'video/quicktime'; + break; + + case "wmp": + cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'application/x-mplayer2'; + break; + + case "rmp": + cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; + codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; + type = 'audio/x-pn-realaudio-plugin'; + break; + } + + if (pl == '') { + p.innerHTML = ''; + return; + } + + pl = tinyMCEPopup.editor.plugins.media._parse(pl); + + if (!pl.src) { + p.innerHTML = ''; + return; + } + + pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src); + pl.width = !pl.width ? 100 : pl.width; + pl.height = !pl.height ? 100 : pl.height; + pl.id = !pl.id ? 'obj' : pl.id; + pl.name = !pl.name ? 'eobj' : pl.name; + pl.align = !pl.align ? '' : pl.align; + + // Avoid annoying warning about insecure items + if (!tinymce.isIE || document.location.protocol != 'https:') { + h += ''; + + for (n in pl) { + h += ''; + + // Add extra url parameter if it's an absolute URL + if (n == 'src' && pl[n].indexOf('://') != -1) + h += ''; + } + } + + h += ' + + + {#media_dlg.title} + + + + + + + + + + +
+ + +
+
+
+ {#media_dlg.general} + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
 
+
 
+ + + + + + +
x   
+
+
+ +
+ {#media_dlg.preview} + +
+
+ +
+
+ {#media_dlg.advanced} + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
 
+
+
+ +
+ {#media_dlg.flash_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + + + + + + + +
+
+ +
+ {#media_dlg.flv_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.qt_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+  
+ + + + + +
 
+
+
+ +
+ {#media_dlg.wmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+ +
+ {#media_dlg.rmp_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+   +
+
+ +
+ {#media_dlg.shockwave_options} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/blank.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/blank.htm new file mode 100644 index 0000000..f841206 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/blank.htm @@ -0,0 +1,22 @@ + + +blank_page + + + + + + + + + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/editor_plugin.js new file mode 100644 index 0000000..4a35002 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i

');content=content.replace(/\r\r/g,'

');content=content.replace(/\n\n/g,'

');if((pos=content.indexOf('

'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="

";before+=content.substring(0,pos);for(var i=0;i";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="

";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'
');content=content.replace(/\r/g,'
');content=content.replace(/\n/g,'
');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i(.*?)<\/p>','gi'),'

$1

');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)
","gi"),"

"+middot+"$1

");content=content.replace(new RegExp('','gi'),""+bull);content=content.replace(/<\/o:p>/gi,"");content=content.replace(new RegExp('
]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*

 <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('

','

','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/ <\/h[1-6]>/gi,'

  

');content=content.replace(//gi,'

');content=content.replace(/<\/h[1-6]>/gi,'

');content=content.replace(/ <\/b>/gi,'  ');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i 0) + ed.execCommand('delete'); + + if (html && html.length > 0) + ed.execCommand('mcePasteWord', false, html); + + return Event.cancel(e); + }, + + _insertText : function(content, bLinebreaks) { + content = this.editor.dom.encode(content); + + if (content && content.length > 0) { + if (bLinebreaks) { + // Special paragraph treatment + if (this.editor.getParam("paste_create_paragraphs", true)) { + var rl = this.editor.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i

'); + content = content.replace(/\r\r/g, '

'); + content = content.replace(/\n\n/g, '

'); + + // Has paragraphs + if ((pos = content.indexOf('

')) != -1) { + this.editor.execCommand("Delete"); + + var node = this.editor.selection.getNode(); + + // Get list of elements to break + var breakElms = []; + + do { + if (node.nodeType == 1) { + // Don't break tables and break at body + if (node.nodeName == "TD" || node.nodeName == "BODY") + break; + + breakElms[breakElms.length] = node; + } + } while(node = node.parentNode); + + var before = "", after = "

"; + before += content.substring(0, pos); + + for (var i=0; i"; + after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; + } + + before += "

"; + content = before + content.substring(pos+7) + after; + } + } + + if (this.editor.getParam("paste_create_linebreaks", true)) { + content = content.replace(/\r\n/g, '
'); + content = content.replace(/\r/g, '
'); + content = content.replace(/\n/g, '
'); + } + } + + this.editor.execCommand("mceInsertRawHTML", false, content); + } + }, + + _insertWordContent : function(content) { + var t = this, ed = t.editor; + + if (content && content.length > 0) { + // Cleanup Word content + var bull = String.fromCharCode(8226); + var middot = String.fromCharCode(183); + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'before', content); + + var rl = ed.getParam("paste_replace_list", '\u2122,TM,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); + for (var i=0; i(.*?)<\/p>', 'gi'), '

$1

'); + } + + content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); + content = content.replace(new RegExp(bull + "(.*?)
", "gi"), "

" + middot + "$1

"); + content = content.replace(new RegExp('', 'gi'), "" + bull); // Covert to bull list + content = content.replace(/<\/o:p>/gi, ""); + content = content.replace(new RegExp('
]*>/gi, ""); + + if (this.editor.getParam("paste_remove_styles", true)) + content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); + + content = content.replace(/<\/?font[^>]*>/gi, ""); + + // Strips class attributes. + switch (this.editor.getParam("paste_strip_class_attributes", "all")) { + case "all": + content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); + break; + + case "mso": + content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); + break; + } + + content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI()); + content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); + content = content.replace(/<\\?\?xml[^>]*>/gi, ""); + content = content.replace(/<\/?\w+:[^>]*>/gi, ""); + content = content.replace(/-- page break --\s*

 <\/p>/gi, ""); // Remove pagebreaks + content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks + + // content = content.replace(/\/? */gi, "");   + // content = content.replace(/

 <\/p>/gi, ''); + + if (!this.editor.getParam('force_p_newlines')) { + content = content.replace('', '' ,'gi'); + content = content.replace('

', '

' ,'gi'); + } + + if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) { + content = content.replace(/<\/?p[^>]*>/gi, ""); + } + + content = content.replace(/<\/?div[^>]*>/gi, ""); + + // Convert all middlot lists to UL lists + if (this.editor.getParam("paste_convert_middot_lists", true)) { + var div = ed.dom.create("div", null, content); + + // Convert all middot paragraphs to li elements + var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList"); + + while (this._convertMiddots(div, "--list--")) ; // bull + while (this._convertMiddots(div, middot, className)) ; // Middot + while (this._convertMiddots(div, bull)) ; // bull + + content = div.innerHTML; + } + + // Replace all headers with strong and fix some other issues + if (this.editor.getParam("paste_convert_headers_to_strong", false)) { + content = content.replace(/ <\/h[1-6]>/gi, '

  

'); + content = content.replace(//gi, '

'); + content = content.replace(/<\/h[1-6]>/gi, '

'); + content = content.replace(/ <\/b>/gi, '  '); + content = content.replace(/^( )*/gi, ''); + } + + content = content.replace(/--list--/gi, ""); // Remove --list-- + + if (ed.getParam('paste_insert_word_content_callback')) + content = ed.execCallback('paste_insert_word_content_callback', 'after', content); + + // Insert cleaned content + this.editor.execCommand("mceInsertContent", false, content); + + if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) { + var ed = this.editor; + + window.setTimeout(function() { + ed.execCommand("mceCleanup"); + }, 1); // Do normal cleanup detached from this thread + } + } + }, + + _reEscape : function(s) { + var l = "?.\\*[](){}+^$:"; + var o = ""; + + for (var i=0; i + + {#paste.paste_text_desc} + + + + + + +
+
{#paste.paste_text_desc}
+ +
+ +
+ +
+ +
{#paste_dlg.text_title}
+ + + +
+
+ +
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/pasteword.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/pasteword.htm new file mode 100644 index 0000000..f96d478 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/paste/pasteword.htm @@ -0,0 +1,29 @@ + + + + {#paste.paste_word_desc} + + + + + + +
+
{#paste.paste_word_desc}
+ +
{#paste_dlg.word_title}
+ +
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/preview/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/preview/editor_plugin.js new file mode 100644 index 0000000..766ebf8 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/preview/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.Preview',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePreview',t._preview,t);ed.addButton('preview',{title:'preview.preview_desc',cmd:'mcePreview'});},getInfo:function(){return{longname:'Preview',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_preview:function(){var ed=this.editor,win,html,c,pos,pos2,css,i,page=ed.getParam("plugin_preview_pageurl",null),w=ed.getParam("plugin_preview_width","550"),h=ed.getParam("plugin_preview_height","600");if(page){ed.windowManager.open({file:ed.getParam("plugin_preview_pageurl",null),width:w,height:h},{resizable:"yes",scrollbars:"yes",inline:1});}else{win=window.open("","mcePreview","menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width="+w+",height="+h);html="";c=ed.getContent();pos=c.indexOf('',pos);pos2=c.lastIndexOf('');c=c.substring(pos+1,pos2);}html+=ed.getParam('doctype');html+='';html+='';html+=''+ed.getLang('preview.preview_desc')+'';html+='';html+='';for(i=0;i';html+='';html+='';html+=c;html+='';html+='';win.document.write(html);win.document.close();}},_onLoad:function(w,d){var t=this,nl,i,el=[],sv,ne;t._doc=d;w.writeFlash=t._writeFlash;w.writeShockWave=t._writeShockWave;w.writeQuickTime=t._writeQuickTime;w.writeRealMedia=t._writeRealMedia;w.writeWindowsMedia=t._writeWindowsMedia;w.writeEmbed=t._writeEmbed;nl=d.getElementsByTagName("script");for(i=0;i';for(n in p)h+='';h+='', pos); + pos2 = c.lastIndexOf(''); + c = c.substring(pos + 1, pos2); + } + + html += ed.getParam('doctype'); + html += ''; + html += ''; + html += '' + ed.getLang('preview.preview_desc') + ''; + html += ''; + html += ''; + + for (i=0; i'; + + html += ''; + html += ''; + html += c; + html += ''; + html += ''; + + win.document.write(html); + win.document.close(); + } + }, + + _onLoad : function(w, d) { + var t = this, nl, i, el = [], sv, ne; + + t._doc = d; + w.writeFlash = t._writeFlash; + w.writeShockWave = t._writeShockWave; + w.writeQuickTime = t._writeQuickTime; + w.writeRealMedia = t._writeRealMedia; + w.writeWindowsMedia = t._writeWindowsMedia; + w.writeEmbed = t._writeEmbed; + + nl = d.getElementsByTagName("script"); + for (i=0; i'; + + h += ''; + + h += ' \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin.js new file mode 100644 index 0000000..f722c2f --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'XX');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g,'');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin_src.js new file mode 100644 index 0000000..26989ff --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/safari/editor_plugin_src.js @@ -0,0 +1,460 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit; + + tinymce.create('tinymce.plugins.Safari', { + init : function(ed) { + var t = this, dom; + + // Ignore on non webkit + if (!tinymce.isWebKit) + return; + + t.editor = ed; + t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; + t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; + + // Safari will crash if the build in createlink command is used +/* ed.addCommand('CreateLink', function(u, v) { + ed.execCommand("mceInsertContent", false, '' + ed.selection.getContent() + ''); + });*/ + + ed.onPaste.add(function(ed, e) { + function removeStyles(e) { + e = e.target; + + if (e.nodeType == 1) { + e.style.cssText = ''; + + each(ed.dom.select('*', e), function(e) { + e.style.cssText = ''; + }); + } + }; + + Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles); + + window.setTimeout(function() { + Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles); + }, 0); + }); + + ed.onKeyUp.add(function(ed, e) { + var h, b; + + // If backspace or delete key + if (e.keyCode == 46 || e.keyCode == 8) { + b = ed.getBody(); + h = b.innerHTML; + + // If there is no text content or images or hr elements then remove everything + if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) + ed.setContent('', {format : 'raw'}); + } + }); + + // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 + ed.addCommand('FormatBlock', function(u, v) { + var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); + + if (e) + dom.replace(dom.create(v), e, 1); + else + ed.getDoc().execCommand("FormatBlock", false, v); + }); + + // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 + ed.addCommand('mceInsertContent', function(u, v) { + ed.getDoc().execCommand("InsertText", false, 'mce_marker'); + ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + 'XX'); + ed.selection.select(ed.dom.get('_mce_tmp')); + ed.getDoc().execCommand("Delete", false, ' '); + }); + + // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973 + ed.onKeyPress.add(function(ed, e) { + if (e.keyCode == 13 && (e.shiftKey || ed.settings.force_br_newlines && ed.selection.getNode().nodeName != 'LI')) { + t._insertBR(ed); + Event.cancel(e); + } + }); + + // Safari returns incorrect values + ed.addQueryValueHandler('FontSize', function(u, v) { + var e, v; + + // Check for the real font size at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Check for the real font size at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize)) + return tinymce.inArray(t.namedFontSizes, v) + 1; + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontSize'); + }); + + // Safari returns incorrect values + ed.addQueryValueHandler('FontName', function(u, v) { + var e, v; + + // Check for the real font name at the start of selection + if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Check for the real font name at the end of selection + if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily)) + return v.replace(/, /g, ','); + + // Return default value it's better than nothing right! + return ed.getDoc().queryCommandValue('FontName'); + }); + + // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName == 'IMG') { + t.selElm = e; + ed.selection.select(e); + } else + t.selElm = null; + }); + +/* ed.onBeforeExecCommand.add(function(ed, c, b) { + var r = t.bookmarkRng; + + // Restore selection + if (r) { + ed.selection.setRng(r); + t.bookmarkRng = null; + //console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + });*/ + + ed.onInit.add(function() { + t._fixWebKitSpans(); + +/* ed.windowManager.onOpen.add(function() { + var r = ed.selection.getRng(); + + // Store selection if valid + if (r.startContainer != ed.getDoc()) { + t.bookmarkRng = r.cloneRange(); + //console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset); + } + }); + + ed.windowManager.onClose.add(function() { + t.bookmarkRng = null; + });*/ + + if (isOldWebKit) + t._patchSafari2x(ed); + }); + + ed.onSetContent.add(function() { + dom = ed.dom; + + // Convert strong,b,em,u,strike to spans + each(['strong','b','em','u','strike','sub','sup','a'], function(v) { + each(grep(dom.select(v)).reverse(), function(n) { + var nn = n.nodeName.toLowerCase(), st; + + // Convert anchors into images + if (nn == 'a') { + if (n.name) + dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); + + return; + } + + switch (nn) { + case 'b': + case 'strong': + if (nn == 'b') + nn = 'strong'; + + st = 'font-weight: bold;'; + break; + + case 'em': + st = 'font-style: italic;'; + break; + + case 'u': + st = 'text-decoration: underline;'; + break; + + case 'sub': + st = 'vertical-align: sub;'; + break; + + case 'sup': + st = 'vertical-align: super;'; + break; + + case 'strike': + st = 'text-decoration: line-through;'; + break; + } + + dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); + }); + }); + }); + + ed.onPreProcess.add(function(ed, o) { + dom = ed.dom; + + each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { + var v, bg; + + if (o.get) { + if (dom.hasClass(n, 'Apple-style-span')) { + bg = n.style.backgroundColor; + + switch (dom.getAttrib(n, 'mce_name')) { + case 'font': + if (!ed.settings.convert_fonts_to_spans) + dom.setAttrib(n, 'style', ''); + break; + + case 'strong': + case 'em': + case 'sub': + case 'sup': + dom.setAttrib(n, 'style', ''); + break; + + case 'strike': + case 'u': + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + else + dom.setAttrib(n, 'mce_name', ''); + + break; + + default: + if (!ed.settings.inline_styles) + dom.setAttrib(n, 'style', ''); + } + + + if (bg) + n.style.backgroundColor = bg; + } + } + + if (dom.hasClass(n, 'mceItemRemoved')) + dom.remove(n, 1); + }); + }); + + ed.onPostProcess.add(function(ed, o) { + // Safari adds BR at end of all block elements + o.content = o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g, ''); + + // Safari adds id="undefined" to HR elements + o.content = o.content.replace(/ id=\"undefined\"/g, ''); + }); + }, + + getInfo : function() { + return { + longname : 'Safari compatibility', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Internal methods + + _fixWebKitSpans : function() { + var t = this, ed = t.editor; + + if (!isOldWebKit) { + // Use mutator events on new WebKit + Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { + e = e.target; + + if (e && e.nodeType == 1) + t._fixAppleSpan(e); + }); + } else { + // Do post command processing in old WebKit since the browser crashes on Mutator events :( + ed.onExecCommand.add(function() { + each(ed.dom.select('span'), function(n) { + t._fixAppleSpan(n); + }); + + ed.nodeChanged(); + }); + } + }, + + _fixAppleSpan : function(e) { + var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; + + if (dom.getAttrib(e, 'mce_fixed')) + return; + + // Handle Apple style spans + if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { + st = e.style; + + if (!s.convert_fonts_to_spans) { + if (st.fontSize) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); + } + + if (st.fontFamily) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'face', st.fontFamily); + } + + if (st.color) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setAttrib(e, 'color', dom.toHex(st.color)); + } + + if (st.backgroundColor) { + dom.setAttrib(e, 'mce_name', 'font'); + dom.setStyle(e, 'background-color', st.backgroundColor); + } + } else { + if (st.fontSize) + dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); + } + + if (st.fontWeight == 'bold') + dom.setAttrib(e, 'mce_name', 'strong'); + + if (st.fontStyle == 'italic') + dom.setAttrib(e, 'mce_name', 'em'); + + if (st.textDecoration == 'underline') + dom.setAttrib(e, 'mce_name', 'u'); + + if (st.textDecoration == 'line-through') + dom.setAttrib(e, 'mce_name', 'strike'); + + if (st.verticalAlign == 'super') + dom.setAttrib(e, 'mce_name', 'sup'); + + if (st.verticalAlign == 'sub') + dom.setAttrib(e, 'mce_name', 'sub'); + + dom.setAttrib(e, 'mce_fixed', '1'); + } + }, + + _patchSafari2x : function(ed) { + var t = this, setContent, getNode, dom = ed.dom, lr; + + // Inline dialogs + if (ed.windowManager.onBeforeOpen) { + ed.windowManager.onBeforeOpen.add(function() { + r = ed.selection.getRng(); + }); + } + + // Fake select on 2.x + ed.selection.select = function(n) { + this.getSel().setBaseAndExtent(n, 0, n, 1); + }; + + getNode = ed.selection.getNode; + ed.selection.getNode = function() { + return t.selElm || getNode.call(this); + }; + + // Fake range on Safari 2.x + ed.selection.getRng = function() { + var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di; + + // Fake range on Safari 2.x + if (s.anchorNode) { + r = d.createRange(); + + try { + // Setup before range + rb = d.createRange(); + rb.setStart(s.anchorNode, s.anchorOffset); + rb.collapse(1); + + // Setup after range + ra = d.createRange(); + ra.setStart(s.focusNode, s.focusOffset); + ra.collapse(1); + + // Setup start/end points by comparing locations + di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; + r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset); + r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset); + + lr = r; + } catch (ex) { + // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!! + } + } + + return r || lr; + }; + + // Fix setContent so it works + setContent = ed.selection.setContent; + ed.selection.setContent = function(h, s) { + var r = this.getRng(), b; + + try { + setContent.call(this, h, s); + } catch (ex) { + // Workaround for Safari 2.x + b = dom.create('body'); + b.innerHTML = h; + + each(b.childNodes, function(n) { + r.insertNode(n.cloneNode(true)); + }); + } + }; + }, + + _insertBR : function(ed) { + var dom = ed.dom, s = ed.selection, r = s.getRng(), br; + + // Insert BR element + r.insertNode(br = dom.create('br')); + + // Place caret after BR + r.setStartAfter(br); + r.setEndAfter(br); + s.setRng(r); + + // Could not place caret after BR then insert an nbsp entity and move the caret + if (s.getSel().focusNode == br.previousSibling) { + s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br)); + s.collapse(1); + } + + // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117 + ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y); + } + }); + + // Register plugin + tinymce.PluginManager.add('safari', tinymce.plugins.Safari); +})(); + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js new file mode 100644 index 0000000..7fd913b --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js new file mode 100644 index 0000000..7633d62 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/editor_plugin_src.js @@ -0,0 +1,54 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.SearchReplacePlugin', { + init : function(ed, url) { + function open(m) { + ed.windowManager.open({ + file : url + '/searchreplace.htm', + width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)), + height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)), + inline : 1, + auto_focus : 0 + }, { + mode : m, + search_string : ed.selection.getContent({format : 'text'}), + plugin_url : url + }); + }; + + // Register commands + ed.addCommand('mceSearch', function() { + open('search'); + }); + + ed.addCommand('mceReplace', function() { + open('replace'); + }); + + // Register buttons + ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'}); + ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'}); + + ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch'); + }, + + getInfo : function() { + return { + longname : 'Search/Replace', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js new file mode 100644 index 0000000..492298e --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/js/searchreplace.js @@ -0,0 +1,117 @@ +tinyMCEPopup.requireLangPack(); + +var SearchReplaceDialog = { + init : function(ed) { + var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode"); + + this.switchMode(m); + + f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string"); + + // Focus input field + f[m + '_panel_searchstring'].focus(); + }, + + switchMode : function(m) { + var f, lm = this.lastMode; + + if (lm != m) { + f = document.forms[0]; + + if (lm) { + f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value; + f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked; + f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked; + f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked; + } + + mcTabs.displayTab(m + '_tab', m + '_panel'); + document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none"; + document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none"; + this.lastMode = m; + } + }, + + searchNext : function(a) { + var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0; + + // Get input + f = document.forms[0]; + s = f[m + '_panel_searchstring'].value; + b = f[m + '_panel_backwardsu'].checked; + ca = f[m + '_panel_casesensitivebox'].checked; + rs = f['replace_panel_replacestring'].value; + + function fix() { + // Correct Firefox graphics glitches + r = se.getRng().cloneRange(); + ed.getDoc().execCommand('SelectAll', false, null); + se.setRng(r); + }; + + function replace() { + if (tinymce.isIE) + ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE + else + ed.getDoc().execCommand('InsertHTML', false, rs); + }; + + // IE flags + if (ca) + fl = fl | 4; + + switch (a) { + case 'all': + if (tinymce.isIE) { + while (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + replace(); + fo = 1; + } + + tinyMCEPopup.storeSelection(); + } else { + while (w.find(s, ca, b, false, false, false, false)) { + replace(); + fo = 1; + } + } + + if (fo) + wm.alert(ed.getLang('searchreplace_dlg.allreplaced')); + else + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + + return; + + case 'current': + replace(); + break; + } + + se.collapse(b); + r = se.getRng(); + + // Whats the point + if (!s) + return; + + if (tinymce.isIE) { + if (r.findText(s, b ? -1 : 1, fl)) { + r.scrollIntoView(); + r.select(); + } else + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + + tinyMCEPopup.storeSelection(); + } else { + if (!w.find(s, ca, b, false, false, false, false)) + wm.alert(ed.getLang('searchreplace_dlg.notfound')); + else + fix(); + } + } +}; + +tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js new file mode 100644 index 0000000..3dd3453 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/langs/en_dlg.js @@ -0,0 +1,16 @@ +tinyMCE.addI18n('en.searchreplace_dlg',{ +searchnext_desc:"Find again", +notfound:"The search has been completed. The search string could not be found.", +search_title:"Find", +replace_title:"Find/Replace", +allreplaced:"All occurrences of the search string were replaced.", +findwhat:"Find what", +replacewith:"Replace with", +direction:"Direction", +up:"Up", +down:"Down", +mcase:"Match case", +findnext:"Find next", +replace:"Replace", +replaceall:"Replace all" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm new file mode 100644 index 0000000..90e80d0 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/searchreplace/searchreplace.htm @@ -0,0 +1,105 @@ + + + + {#searchreplace_dlg.replace_title} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + +
+
+
+ +
+ +
+
+ + + +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin.js new file mode 100644 index 0000000..6ebaa91 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.StylePlugin',{init:function(ed,url){ed.addCommand('mceStyleProps',function(){ed.windowManager.open({file:url+'/props.htm',width:480+parseInt(ed.getLang('style.delta_width',0)),height:320+parseInt(ed.getLang('style.delta_height',0)),inline:1},{plugin_url:url,style_text:ed.selection.getNode().style.cssText});});ed.addCommand('mceSetElementStyle',function(ui,v){if(e=ed.selection.getNode()){ed.dom.setAttrib(e,'style',v);ed.execCommand('mceRepaint');}});ed.onNodeChange.add(function(ed,cm,n){cm.setDisabled('styleprops',n.nodeName==='BODY');});ed.addButton('styleprops',{title:'style.desc',cmd:'mceStyleProps'});},getInfo:function(){return{longname:'Style',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('style',tinymce.plugins.StylePlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin_src.js new file mode 100644 index 0000000..507c841 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/editor_plugin_src.js @@ -0,0 +1,52 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + tinymce.create('tinymce.plugins.StylePlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceStyleProps', function() { + ed.windowManager.open({ + file : url + '/props.htm', + width : 480 + parseInt(ed.getLang('style.delta_width', 0)), + height : 320 + parseInt(ed.getLang('style.delta_height', 0)), + inline : 1 + }, { + plugin_url : url, + style_text : ed.selection.getNode().style.cssText + }); + }); + + ed.addCommand('mceSetElementStyle', function(ui, v) { + if (e = ed.selection.getNode()) { + ed.dom.setAttrib(e, 'style', v); + ed.execCommand('mceRepaint'); + } + }); + + ed.onNodeChange.add(function(ed, cm, n) { + cm.setDisabled('styleprops', n.nodeName === 'BODY'); + }); + + // Register buttons + ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'}); + }, + + getInfo : function() { + return { + longname : 'Style', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/js/props.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/js/props.js new file mode 100644 index 0000000..4fdfceb --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/js/props.js @@ -0,0 +1,641 @@ +tinyMCEPopup.requireLangPack(); + +var defaultFonts = "" + + "Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Courier New, Courier, mono=Courier New, Courier, mono;" + + "Times New Roman, Times, serif=Times New Roman, Times, serif;" + + "Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" + + "Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" + + "Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif"; + +var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger"; +var defaultMeasurement = "+pixels=px;points=pt;em;in;cm;mm;picas;ems;exs;%"; +var defaultSpacingMeasurement = "pixels=px;points=pt;in;cm;mm;picas;+ems;exs;%"; +var defaultIndentMeasurement = "pixels=px;+points=pt;in;cm;mm;picas;ems;exs;%"; +var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900"; +var defaultTextStyle = "normal;italic;oblique"; +var defaultVariant = "normal;small-caps"; +var defaultLineHeight = "normal"; +var defaultAttachment = "fixed;scroll"; +var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y"; +var defaultPosH = "left;center;right"; +var defaultPosV = "top;center;bottom"; +var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom"; +var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none"; +var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset"; +var defaultBorderWidth = "thin;medium;thick"; +var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none"; + +function init() { + var ce = document.getElementById('container'), h; + + ce.style.cssText = tinyMCEPopup.getWindowArg('style_text'); + + h = getBrowserHTML('background_image_browser','background_image','image','advimage'); + document.getElementById("background_image_browser").innerHTML = h; + + document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color'); + document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color'); + document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top'); + document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right'); + document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom'); + document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left'); + + fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true); + fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true); + fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true); + fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true); + fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true); + fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true); + fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true); + fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true); + fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true); + + fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true); + fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true); + + fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true); + fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true); + fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true); + fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true); + fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true); + fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true); + fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true); + fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true); + + fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true); + fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true); + fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true); + fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true); + + fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true); + fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true); + + fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true); + fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true); + + fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true); + fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true); + + fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true); + + fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true); + + fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true); + fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true); + + TinyMCE_EditableSelects.init(); + setupFormData(); + showDisabledControls(); +} + +function setupFormData() { + var ce = document.getElementById('container'), f = document.forms[0], s, b, i; + + // Setup text fields + + selectByValue(f, 'text_font', ce.style.fontFamily, true, true); + selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true); + selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize)); + selectByValue(f, 'text_weight', ce.style.fontWeight, true, true); + selectByValue(f, 'text_style', ce.style.fontStyle, true, true); + selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true); + selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight)); + selectByValue(f, 'text_case', ce.style.textTransform, true, true); + selectByValue(f, 'text_variant', ce.style.fontVariant, true, true); + f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color); + updateColor('text_color_pick', 'text_color'); + f.text_underline.checked = inStr(ce.style.textDecoration, 'underline'); + f.text_overline.checked = inStr(ce.style.textDecoration, 'overline'); + f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through'); + f.text_blink.checked = inStr(ce.style.textDecoration, 'blink'); + + // Setup background fields + + f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor); + updateColor('background_color_pick', 'background_color'); + f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true); + selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true); + selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true); + selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0))); + selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true); + selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1))); + + // Setup block fields + + selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true); + selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing)); + selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true); + selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing)); + selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true); + selectByValue(f, 'block_text_align', ce.style.textAlign, true, true); + f.block_text_indent.value = getNum(ce.style.textIndent); + selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent)); + selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true); + selectByValue(f, 'block_display', ce.style.display, true, true); + + // Setup box fields + + f.box_width.value = getNum(ce.style.width); + selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width)); + + f.box_height.value = getNum(ce.style.height); + selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height)); + + if (tinymce.isGecko) + selectByValue(f, 'box_float', ce.style.cssFloat, true, true); + else + selectByValue(f, 'box_float', ce.style.styleFloat, true, true); + + selectByValue(f, 'box_clear', ce.style.clear, true, true); + + setupBox(f, ce, 'box_padding', 'padding', ''); + setupBox(f, ce, 'box_margin', 'margin', ''); + + // Setup border fields + + setupBox(f, ce, 'border_style', 'border', 'Style'); + setupBox(f, ce, 'border_width', 'border', 'Width'); + setupBox(f, ce, 'border_color', 'border', 'Color'); + + updateColor('border_color_top_pick', 'border_color_top'); + updateColor('border_color_right_pick', 'border_color_right'); + updateColor('border_color_bottom_pick', 'border_color_bottom'); + updateColor('border_color_left_pick', 'border_color_left'); + + f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value); + f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value); + f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value); + f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value); + + // Setup list fields + + selectByValue(f, 'list_type', ce.style.listStyleType, true, true); + selectByValue(f, 'list_position', ce.style.listStylePosition, true, true); + f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + + // Setup box fields + + selectByValue(f, 'positioning_type', ce.style.position, true, true); + selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true); + selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true); + f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : ""; + + f.positioning_width.value = getNum(ce.style.width); + selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width)); + + f.positioning_height.value = getNum(ce.style.height); + selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height)); + + setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']); + + s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1"); + s = s.replace(/,/g, ' '); + + if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = getNum(getVal(s, 1)); + selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1))); + f.positioning_clip_bottom.value = getNum(getVal(s, 2)); + selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2))); + f.positioning_clip_left.value = getNum(getVal(s, 3)); + selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3))); + } else { + f.positioning_clip_top.value = getNum(getVal(s, 0)); + selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0))); + f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value; + } + +// setupBox(f, ce, '', 'border', 'Color'); +} + +function getMeasurement(s) { + return s.replace(/^([0-9]+)(.*)$/, "$2"); +} + +function getNum(s) { + if (new RegExp('^[0-9]+[a-z%]+$', 'gi').test(s)) + return s.replace(/[^0-9]/g, ''); + + return s; +} + +function inStr(s, n) { + return new RegExp(n, 'gi').test(s); +} + +function getVal(s, i) { + var a = s.split(' '); + + if (a.length > 1) + return a[i]; + + return ""; +} + +function setValue(f, n, v) { + if (f.elements[n].type == "text") + f.elements[n].value = v; + else + selectByValue(f, n, v, true, true); +} + +function setupBox(f, ce, fp, pr, sf, b) { + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (isSame(ce, pr, sf, b)) { + f.elements[fp + "_same"].checked = true; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + f.elements[fp + "_right"].value = ""; + f.elements[fp + "_right"].disabled = true; + f.elements[fp + "_bottom"].value = ""; + f.elements[fp + "_bottom"].disabled = true; + f.elements[fp + "_left"].value = ""; + f.elements[fp + "_left"].disabled = true; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + f.elements[fp + "_left_measurement"].disabled = true; + f.elements[fp + "_bottom_measurement"].disabled = true; + f.elements[fp + "_right_measurement"].disabled = true; + } + } else { + f.elements[fp + "_same"].checked = false; + + setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf])); + f.elements[fp + "_top"].disabled = false; + + setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf])); + f.elements[fp + "_right"].disabled = false; + + setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf])); + f.elements[fp + "_bottom"].disabled = false; + + setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left"].disabled = false; + + if (f.elements[fp + "_top_measurement"]) { + selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf])); + selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf])); + selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf])); + selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf])); + f.elements[fp + "_left_measurement"].disabled = false; + f.elements[fp + "_bottom_measurement"].disabled = false; + f.elements[fp + "_right_measurement"].disabled = false; + } + } +} + +function isSame(e, pr, sf, b) { + var a = [], i, x; + + if (typeof(b) == "undefined") + b = ['Top', 'Right', 'Bottom', 'Left']; + + if (typeof(sf) == "undefined" || sf == null) + sf = ""; + + a[0] = e.style[pr + b[0] + sf]; + a[1] = e.style[pr + b[1] + sf]; + a[2] = e.style[pr + b[2] + sf]; + a[3] = e.style[pr + b[3] + sf]; + + for (i=0; i 0 ? s.substring(1) : s; + + if (f.text_none.checked) + s = "none"; + + ce.style.textDecoration = s; + + // Build background styles + + ce.style.backgroundColor = f.background_color.value; + ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : ""; + ce.style.backgroundRepeat = f.background_repeat.value; + ce.style.backgroundAttachment = f.background_attachment.value; + + if (f.background_hpos.value != "") { + s = ""; + s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " "; + s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : ""); + ce.style.backgroundPosition = s; + } + + // Build block styles + + ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : ""); + ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : ""); + ce.style.verticalAlign = f.block_vertical_alignment.value; + ce.style.textAlign = f.block_text_align.value; + ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : ""); + ce.style.whiteSpace = f.block_whitespace.value; + ce.style.display = f.block_display.value; + + // Build box styles + + ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : ""); + ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : ""); + ce.style.styleFloat = f.box_float.value; + + if (tinymce.isGecko) + ce.style.cssFloat = f.box_float.value; + + ce.style.clear = f.box_clear.value; + + if (!f.box_padding_same.checked) { + ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : ""); + ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : ""); + ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : ""); + } else + ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : ""); + + if (!f.box_margin_same.checked) { + ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : ""); + ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : ""); + ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : ""); + } else + ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : ""); + + // Build border styles + + if (!f.border_style_same.checked) { + ce.style.borderTopStyle = f.border_style_top.value; + ce.style.borderRightStyle = f.border_style_right.value; + ce.style.borderBottomStyle = f.border_style_bottom.value; + ce.style.borderLeftStyle = f.border_style_left.value; + } else + ce.style.borderStyle = f.border_style_top.value; + + if (!f.border_width_same.checked) { + ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : ""); + ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : ""); + ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : ""); + ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : ""); + } else + ce.style.borderWidth = f.border_width_top.value; + + if (!f.border_color_same.checked) { + ce.style.borderTopColor = f.border_color_top.value; + ce.style.borderRightColor = f.border_color_right.value; + ce.style.borderBottomColor = f.border_color_bottom.value; + ce.style.borderLeftColor = f.border_color_left.value; + } else + ce.style.borderColor = f.border_color_top.value; + + // Build list styles + + ce.style.listStyleType = f.list_type.value; + ce.style.listStylePosition = f.list_position.value; + ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : ""; + + // Build positioning styles + + ce.style.position = f.positioning_type.value; + ce.style.visibility = f.positioning_visibility.value; + + if (ce.style.width == "") + ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : ""); + + if (ce.style.height == "") + ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : ""); + + ce.style.zIndex = f.positioning_zindex.value; + ce.style.overflow = f.positioning_overflow.value; + + if (!f.positioning_placement_same.checked) { + ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : ""); + ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : ""); + ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : ""); + } else { + s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : ""); + ce.style.top = s; + ce.style.right = s; + ce.style.bottom = s; + ce.style.left = s; + } + + if (!f.positioning_clip_same.checked) { + s = "rect("; + s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " "; + s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto"); + s += ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } else { + s = "rect("; + t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto"; + s += t + " "; + s += t + " "; + s += t + " "; + s += t + ")"; + + if (s != "rect(auto auto auto auto)") + ce.style.clip = s; + } + + ce.style.cssText = ce.style.cssText; +} + +function isNum(s) { + return new RegExp('[0-9]+', 'g').test(s); +} + +function showDisabledControls() { + var f = document.forms, i, a; + + for (i=0; i 1) { + addSelectValue(f, s, p[0], p[1]); + + if (se) + selectByValue(f, s, p[1]); + } else { + addSelectValue(f, s, p[0], p[0]); + + if (se) + selectByValue(f, s, p[0]); + } + } +} + +function toggleSame(ce, pre) { + var el = document.forms[0].elements, i; + + if (ce.checked) { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = true; + el[pre + "_bottom"].disabled = true; + el[pre + "_left"].disabled = true; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = true; + el[pre + "_bottom_measurement"].disabled = true; + el[pre + "_left_measurement"].disabled = true; + } + } else { + el[pre + "_top"].disabled = false; + el[pre + "_right"].disabled = false; + el[pre + "_bottom"].disabled = false; + el[pre + "_left"].disabled = false; + + if (el[pre + "_top_measurement"]) { + el[pre + "_top_measurement"].disabled = false; + el[pre + "_right_measurement"].disabled = false; + el[pre + "_bottom_measurement"].disabled = false; + el[pre + "_left_measurement"].disabled = false; + } + } + + showDisabledControls(); +} + +function synch(fr, to) { + var f = document.forms[0]; + + f.elements[to].value = f.elements[fr].value; + + if (f.elements[fr + "_measurement"]) + selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value); +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/langs/en_dlg.js new file mode 100644 index 0000000..d9d7762 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/langs/en_dlg.js @@ -0,0 +1,63 @@ +tinyMCE.addI18n('en.style_dlg',{ +title:"Edit CSS Style", +apply:"Apply", +text_tab:"Text", +background_tab:"Background", +block_tab:"Block", +box_tab:"Box", +border_tab:"Border", +list_tab:"List", +positioning_tab:"Positioning", +text_props:"Text", +text_font:"Font", +text_size:"Size", +text_weight:"Weight", +text_style:"Style", +text_variant:"Variant", +text_lineheight:"Line height", +text_case:"Case", +text_color:"Color", +text_decoration:"Decoration", +text_overline:"overline", +text_underline:"underline", +text_striketrough:"strikethrough", +text_blink:"blink", +text_none:"none", +background_color:"Background color", +background_image:"Background image", +background_repeat:"Repeat", +background_attachment:"Attachment", +background_hpos:"Horizontal position", +background_vpos:"Vertical position", +block_wordspacing:"Word spacing", +block_letterspacing:"Letter spacing", +block_vertical_alignment:"Vertical alignment", +block_text_align:"Text align", +block_text_indent:"Text indent", +block_whitespace:"Whitespace", +block_display:"Display", +box_width:"Width", +box_height:"Height", +box_float:"Float", +box_clear:"Clear", +padding:"Padding", +same:"Same for all", +top:"Top", +right:"Right", +bottom:"Bottom", +left:"Left", +margin:"Margin", +style:"Style", +width:"Width", +height:"Height", +color:"Color", +list_type:"Type", +bullet_image:"Bullet image", +position:"Position", +positioning_type:"Type", +visibility:"Visibility", +zindex:"Z-index", +overflow:"Overflow", +placement:"Placement", +clip:"Clip" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/props.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/props.htm new file mode 100644 index 0000000..54538e3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/style/props.htm @@ -0,0 +1,731 @@ + + + + {#style_dlg.title} + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
 
+
+ +
+ + + +
+ + + + + + +
+ +  
+
+ +
+ + + + + +
 
+
{#style_dlg.text_decoration} + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
 
+
+ + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + +
+ + + + + + +
 
+
   
+ + + + + + +
 
+
   
+
+
+ {#style_dlg.padding} + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+
+ +
+
+ {#style_dlg.margin} + + + + + + + + + + + + + + + + + + + + + + +
 
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+ + + + + + +
 
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  {#style_dlg.style} {#style_dlg.width} {#style_dlg.color}
      
{#style_dlg.top}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.right}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.bottom}   + + + + + + +
 
+
  + + + + + +
 
+
{#style_dlg.left}   + + + + + + +
 
+
  + + + + + +
 
+
+
+ +
+ + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
   
+ + + + + + +
 
+
   
+ + + + + + +
 
+
   
+ +
+
+ {#style_dlg.placement} + + + + + + + + + + + + + + + + + + + + + + +
 
{#style_dlg.top} + + + + + + +
 
+
{#style_dlg.right} + + + + + + +
 
+
{#style_dlg.bottom} + + + + + + +
 
+
{#style_dlg.left} + + + + + + +
 
+
+
+
+ +
+
+ {#style_dlg.clip} + + + + + + + + + + + + + + + + + + + + + + +
 
{#style_dlg.top} + + + + + + +
 
+
{#style_dlg.right} + + + + + + +
 
+
{#style_dlg.bottom} + + + + + + +
 
+
{#style_dlg.left} + + + + + + +
 
+
+
+
+
+
+
+ +
+
+
+ +
 
+
+
+ +
+ +
+
+
+ +
+
+
+ + + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/cell.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/cell.htm new file mode 100644 index 0000000..c931731 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/cell.htm @@ -0,0 +1,184 @@ + + + + {#table_dlg.cell_title} + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin.js new file mode 100644 index 0000000..085882a --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin.js @@ -0,0 +1 @@ +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TablePlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;each([['table','table.desc','mceInsertTable',true],['delete_table','table.del','mceTableDelete'],['delete_col','table.delete_col_desc','mceTableDeleteCol'],['delete_row','table.delete_row_desc','mceTableDeleteRow'],['col_after','table.col_after_desc','mceTableInsertColAfter'],['col_before','table.col_before_desc','mceTableInsertColBefore'],['row_after','table.row_after_desc','mceTableInsertRowAfter'],['row_before','table.row_before_desc','mceTableInsertRowBefore'],['row_props','table.row_desc','mceTableRowProps',true],['cell_props','table.cell_desc','mceTableCellProps',true],['split_cells','table.split_cells_desc','mceTableSplitCells',true],['merge_cells','table.merge_cells_desc','mceTableMergeCells',true]],function(c){ed.addButton(c[0],{title:c[1],cmd:c[2],ui:c[3]});});ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){var sm,se=ed.selection,el=se.getNode()||ed.getBody();if(ed.dom.getParent(e,'td')||ed.dom.getParent(e,'th')){m.removeAll();if(el.nodeName=='A'&&!ed.dom.getAttrib(el,'name')){m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});m.addSeparator();}if(el.nodeName=='IMG'&&el.className.indexOf('mceItem')==-1){m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();}m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true,value:{action:'insert'}});m.add({title:'table.props_desc',icon:'table_props',cmd:'mceInsertTable',ui:true});m.add({title:'table.del',icon:'delete_table',cmd:'mceTableDelete',ui:true});m.addSeparator();sm=m.addMenu({title:'table.cell'});sm.add({title:'table.cell_desc',icon:'cell_props',cmd:'mceTableCellProps',ui:true});sm.add({title:'table.split_cells_desc',icon:'split_cells',cmd:'mceTableSplitCells',ui:true});sm.add({title:'table.merge_cells_desc',icon:'merge_cells',cmd:'mceTableMergeCells',ui:true});sm=m.addMenu({title:'table.row'});sm.add({title:'table.row_desc',icon:'row_props',cmd:'mceTableRowProps',ui:true});sm.add({title:'table.row_before_desc',icon:'row_before',cmd:'mceTableInsertRowBefore'});sm.add({title:'table.row_after_desc',icon:'row_after',cmd:'mceTableInsertRowAfter'});sm.add({title:'table.delete_row_desc',icon:'delete_row',cmd:'mceTableDeleteRow'});sm.addSeparator();sm.add({title:'table.cut_row_desc',icon:'cut',cmd:'mceTableCutRow'});sm.add({title:'table.copy_row_desc',icon:'copy',cmd:'mceTableCopyRow'});sm.add({title:'table.paste_row_before_desc',icon:'paste',cmd:'mceTablePasteRowBefore'});sm.add({title:'table.paste_row_after_desc',icon:'paste',cmd:'mceTablePasteRowAfter'});sm=m.addMenu({title:'table.col'});sm.add({title:'table.col_before_desc',icon:'col_before',cmd:'mceTableInsertColBefore'});sm.add({title:'table.col_after_desc',icon:'col_after',cmd:'mceTableInsertColAfter'});sm.add({title:'table.delete_col_desc',icon:'delete_col',cmd:'mceTableDeleteCol'});}else m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true});});}});ed.onKeyDown.add(function(ed,e){if(e.keyCode==9&&ed.dom.getParent(ed.selection.getNode(),'TABLE')){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(ed.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(e);}ed.undoManager.add();}});if(!tinymce.isIE){if(ed.getParam('table_selection',true)){ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='TABLE')ed.selection.select(e);});}}ed.onNodeChange.add(function(ed,cm,n){var p=ed.dom.getParent(n,'td,th,caption');cm.setActive('table',n.nodeName==='TABLE'||!!p);if(p&&p.nodeName==='CAPTION')p=null;cm.setDisabled('delete_table',!p);cm.setDisabled('delete_col',!p);cm.setDisabled('delete_table',!p);cm.setDisabled('delete_row',!p);cm.setDisabled('col_after',!p);cm.setDisabled('col_before',!p);cm.setDisabled('row_after',!p);cm.setDisabled('row_before',!p);cm.setDisabled('row_props',!p);cm.setDisabled('cell_props',!p);cm.setDisabled('split_cells',!p||(parseInt(ed.dom.getAttrib(p,'colspan','1'))<2&&parseInt(ed.dom.getAttrib(p,'rowspan','1'))<2));cm.setDisabled('merge_cells',!p);});if(!tinymce.isIE){ed.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?'<$1$2> ':'<$1$2>
');});}},execCommand:function(cmd,ui,val){var ed=this.editor,b;switch(cmd){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":ed.execCommand('mceBeginUndoLevel');this._doExecCommand(cmd,ui,val);ed.execCommand('mceEndUndoLevel');return true;}return false;},getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_doExecCommand:function(command,user_interface,value){var inst=this.editor,ed=inst,url=this.url;var focusElm=inst.selection.getNode();var trElm=inst.dom.getParent(focusElm,"tr");var tdElm=inst.dom.getParent(focusElm,"td,th");var tableElm=inst.dom.getParent(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function select(dx,dy){var td;grid=getTableGrid(tableElm);dx=dx||0;dy=dy||0;dx=Math.max(cpos.cellindex+dx,0);dy=Math.max(cpos.rowindex+dy,0);inst.execCommand('mceRepaint');td=getCell(grid,dy,dx);if(td){inst.selection.select(td.firstChild||td);inst.selection.collapse(1);}};function makeTD(){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';}function getColRowSpan(td){var colspan=inst.dom.getAttrib(td,"colspan");var rowspan=inst.dom.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){var x,y;for(y=0;y1){for(var i=x;i1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i';if(tinymce.isIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=inst.dom.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i';}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableMoveToNextRow":var nextCell=getNextCell(tableElm,tdElm);if(!nextCell){inst.execCommand("mceTableInsertRowAfter",tdElm);nextCell=getNextCell(tableElm,tdElm);}inst.selection.select(nextCell);inst.selection.collapse(true);return true;case"mceTableRowProps":if(trElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/row.htm',width:400+parseInt(inst.getLang('table.rowprops_delta_width',0)),height:295+parseInt(inst.getLang('table.rowprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/cell.htm',width:400+parseInt(inst.getLang('table.cellprops_delta_width',0)),height:295+parseInt(inst.getLang('table.cellprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceInsertTable":if(user_interface){inst.windowManager.open({url:url+'/table.htm',width:400+parseInt(inst.getLang('table.table_delta_width',0)),height:320+parseInt(inst.getLang('table.table_delta_height',0)),inline:1},{plugin_url:url,action:value?value.action:0});}return true;case"mceTableDelete":var table=inst.dom.getParent(inst.selection.getNode(),"table");if(table){table.parentNode.removeChild(table);inst.execCommand('mceRepaint');}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);select(0,1);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='
';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}select(0,1);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);select(0,-1);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
';newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}select();break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='
';newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}select(1);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if((grid.length>1&&grid[0].length<=1)&&tableElm.nodeName=='TBODY'){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}select(-1);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i';trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");break;case"mceTableMergeCells":var rows=[];var sel=inst.selection.getSel();var grid=getTableGrid(tableElm);if(tinymce.isIE||sel.rangeCount==1){if(user_interface){var sp=getColRowSpan(tdElm);inst.windowManager.open({url:url+'/merge_cells.htm',width:240+parseInt(inst.getLang('table.merge_cells_delta_width',0)),height:110+parseInt(inst.getLang('table.merge_cells_delta_height',0)),inline:1},{action:"update",numcols:sp.colspan,numrows:sp.rowspan,plugin_url:url});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y0)rows[rows.length]=rowCells;var td=getCell(grid,cpos.rowindex,cpos.cellindex);each(ed.dom.select('br',td),function(e,i){if(i>0&&ed.dom.getAttrib('mce_bogus'))ed.dom.remove(e);});}}}else{var cells=[];var sel=inst.selection.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i0)rows[rows.length]=rowCells;}var curRow=[];var lastTR=null;for(var y=0;ycolSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;xrowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}each(ed.dom.select('br',tdElm),function(e,i){if(i>0&&ed.dom.getAttrib(e,'mce_bogus'))ed.dom.remove(e);});break;}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");inst.addVisual(tableElm);inst.nodeChanged();}return true;}return false;}});tinymce.PluginManager.add('table',tinymce.plugins.TablePlugin);})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin_src.js new file mode 100644 index 0000000..65727ef --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/editor_plugin_src.js @@ -0,0 +1,1115 @@ +/** + * $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:29 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var each = tinymce.each; + + tinymce.create('tinymce.plugins.TablePlugin', { + init : function(ed, url) { + var t = this; + + t.editor = ed; + t.url = url; + + // Register buttons + each([ + ['table', 'table.desc', 'mceInsertTable', true], + ['delete_table', 'table.del', 'mceTableDelete'], + ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'], + ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'], + ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'], + ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'], + ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'], + ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'], + ['row_props', 'table.row_desc', 'mceTableRowProps', true], + ['cell_props', 'table.cell_desc', 'mceTableCellProps', true], + ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true], + ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true] + ], function(c) { + ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]}); + }); + + ed.onInit.add(function() { + if (ed && ed.plugins.contextmenu) { + ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { + var sm, se = ed.selection, el = se.getNode() || ed.getBody(); + + if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) { + m.removeAll(); + + if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) { + m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); + m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); + m.addSeparator(); + } + + if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) { + m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); + m.addSeparator(); + } + + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}}); + m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true}); + m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true}); + m.addSeparator(); + + // Cell menu + sm = m.addMenu({title : 'table.cell'}); + sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true}); + sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true}); + sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true}); + + // Row menu + sm = m.addMenu({title : 'table.row'}); + sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true}); + sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'}); + sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'}); + sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'}); + sm.addSeparator(); + sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'}); + sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'}); + sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}); + sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}); + + // Column menu + sm = m.addMenu({title : 'table.col'}); + sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'}); + sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'}); + sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'}); + } else + m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true}); + }); + } + }); + + // Add undo level when new rows are created using the tab key + ed.onKeyDown.add(function(ed, e) { + if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) { + if (!tinymce.isGecko && !tinymce.isOpera) { + tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true); + return tinymce.dom.Event.cancel(e); + } + + ed.undoManager.add(); + } + }); + + // Select whole table is a table border is clicked + if (!tinymce.isIE) { + if (ed.getParam('table_selection', true)) { + ed.onClick.add(function(ed, e) { + e = e.target; + + if (e.nodeName === 'TABLE') + ed.selection.select(e); + }); + } + } + + ed.onNodeChange.add(function(ed, cm, n) { + var p = ed.dom.getParent(n, 'td,th,caption'); + + cm.setActive('table', n.nodeName === 'TABLE' || !!p); + if (p && p.nodeName === 'CAPTION') + p = null; + + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_col', !p); + cm.setDisabled('delete_table', !p); + cm.setDisabled('delete_row', !p); + cm.setDisabled('col_after', !p); + cm.setDisabled('col_before', !p); + cm.setDisabled('row_after', !p); + cm.setDisabled('row_before', !p); + cm.setDisabled('row_props', !p); + cm.setDisabled('cell_props', !p); + cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2)); + cm.setDisabled('merge_cells', !p); + }); + + // Padd empty table cells + if (!tinymce.isIE) { + ed.onBeforeSetContent.add(function(ed, o) { + if (o.initial) + o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> ' : '<$1$2>
'); + }); + } + }, + + execCommand : function(cmd, ui, val) { + var ed = this.editor, b; + + // Is table command + switch (cmd) { + case "mceTableMoveToNextRow": + case "mceInsertTable": + case "mceTableRowProps": + case "mceTableCellProps": + case "mceTableSplitCells": + case "mceTableMergeCells": + case "mceTableInsertRowBefore": + case "mceTableInsertRowAfter": + case "mceTableDeleteRow": + case "mceTableInsertColBefore": + case "mceTableInsertColAfter": + case "mceTableDeleteCol": + case "mceTableCutRow": + case "mceTableCopyRow": + case "mceTablePasteRowBefore": + case "mceTablePasteRowAfter": + case "mceTableDelete": + ed.execCommand('mceBeginUndoLevel'); + this._doExecCommand(cmd, ui, val); + ed.execCommand('mceEndUndoLevel'); + + return true; + } + + // Pass to next handler in chain + return false; + }, + + getInfo : function() { + return { + longname : 'Tables', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + }, + + // Private plugin internal methods + + /** + * Executes the table commands. + */ + _doExecCommand : function(command, user_interface, value) { + var inst = this.editor, ed = inst, url = this.url; + var focusElm = inst.selection.getNode(); + var trElm = inst.dom.getParent(focusElm, "tr"); + var tdElm = inst.dom.getParent(focusElm, "td,th"); + var tableElm = inst.dom.getParent(focusElm, "table"); + var doc = inst.contentWindow.document; + var tableBorder = tableElm ? tableElm.getAttribute("border") : ""; + + // Get first TD if no TD found + if (trElm && tdElm == null) + tdElm = trElm.cells[0]; + + function inArray(ar, v) { + for (var i=0; i 0 && inArray(ar[i], v)) + return true; + + // Found value + if (ar[i] == v) + return true; + } + + return false; + } + + function select(dx, dy) { + var td; + + grid = getTableGrid(tableElm); + dx = dx || 0; + dy = dy || 0; + dx = Math.max(cpos.cellindex + dx, 0); + dy = Math.max(cpos.rowindex + dy, 0); + + // Recalculate grid and select + inst.execCommand('mceRepaint'); + td = getCell(grid, dy, dx); + + if (td) { + inst.selection.select(td.firstChild || td); + inst.selection.collapse(1); + } + }; + + function makeTD() { + var newTD = doc.createElement("td"); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + } + + function getColRowSpan(td) { + var colspan = inst.dom.getAttrib(td, "colspan"); + var rowspan = inst.dom.getAttrib(td, "rowspan"); + + colspan = colspan == "" ? 1 : parseInt(colspan); + rowspan = rowspan == "" ? 1 : parseInt(rowspan); + + return {colspan : colspan, rowspan : rowspan}; + } + + function getCellPos(grid, td) { + var x, y; + + for (y=0; y 1) { // Remove due to colspan + for (var i=x; i 1) + td.rowSpan = sd.rowspan + 1; + + lastElm = td; + } + + deleteMarked(tableElm); + } + } + + function prevElm(node, name) { + while ((node = node.previousSibling) != null) { + if (node.nodeName == name) + return node; + } + + return null; + } + + function nextElm(node, names) { + var namesAr = names.split(','); + + while ((node = node.nextSibling) != null) { + for (var i=0; i 1) { + do { + var nexttd = nextElm(td, "TD,TH"); + + if (td._delete) + td.parentNode.removeChild(td); + } while ((td = nexttd) != null); + } + } while ((tr = next) != null); + } + + function addRows(td_elm, tr_elm, rowspan) { + // Add rows + td_elm.rowSpan = 1; + var trNext = nextElm(tr_elm, "TR"); + for (var i=1; i 1) { + var newTD = cells[x].cloneNode(true); + var sd = getColRowSpan(cells[x]); + + newTD.rowSpan = sd.rowspan - 1; + + var nextTD = nextTR.cells[x]; + + if (nextTD == null) + nextTR.appendChild(newTD); + else + nextTR.insertBefore(newTD, nextTD); + } + } + + // Delete cells + var lastTDElm = null; + for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd.rowspan > 1) { + tdElm.rowSpan = sd.rowspan - 1; + } else { + trElm = tdElm.parentNode; + + if (trElm.parentNode) + trElm._delete = true; + } + + lastTDElm = tdElm; + } + } + + deleteMarked(tableElm); + + select(0, -1); + break; + + case "mceTableInsertColBefore": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + + newTD.rowSpan = tdElm.rowSpan; + + tdElm.parentNode.insertBefore(newTD, tdElm); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(); + break; + + case "mceTableInsertColAfter": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] == 1) { + var newTD = doc.createElement(tdElm.nodeName); + + if (!tinymce.isIE) + newTD.innerHTML = '
'; + + newTD.rowSpan = tdElm.rowSpan; + + var nextTD = nextElm(tdElm, "TD,TH"); + if (nextTD == null) + tdElm.parentNode.appendChild(newTD); + else + nextTD.parentNode.insertBefore(newTD, nextTD); + } else + tdElm.colSpan++; + + lastTDElm = tdElm; + } + } + + select(1); + break; + + case "mceTableDeleteCol": + if (!trElm || !tdElm) + return true; + + var grid = getTableGrid(tableElm); + var cpos = getCellPos(grid, tdElm); + var lastTDElm = null; + + // Only one col, remove whole table + if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') { + inst.dom.remove(inst.dom.getParent(tableElm, "table")); + return true; + } + + // Delete cells + for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) { + if (tdElm != lastTDElm) { + var sd = getColRowSpan(tdElm); + + if (sd['colspan'] > 1) + tdElm.colSpan = sd['colspan'] - 1; + else { + if (tdElm.parentNode) + tdElm.parentNode.removeChild(tdElm); + } + + lastTDElm = tdElm; + } + } + + select(-1); + break; + + case "mceTableSplitCells": + if (!trElm || !tdElm) + return true; + + var spandata = getColRowSpan(tdElm); + + var colspan = spandata["colspan"]; + var rowspan = spandata["rowspan"]; + + // Needs splitting + if (colspan > 1 || rowspan > 1) { + // Generate cols + tdElm.colSpan = 1; + for (var i=1; i 1) + addRows(newTD, trElm, rowspan); + } + + addRows(tdElm, trElm, rowspan); + } + + // Apply visual aids + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + break; + + case "mceTableMergeCells": + var rows = []; + var sel = inst.selection.getSel(); + var grid = getTableGrid(tableElm); + + if (tinymce.isIE || sel.rangeCount == 1) { + if (user_interface) { + // Setup template + var sp = getColRowSpan(tdElm); + + inst.windowManager.open({ + url : url + '/merge_cells.htm', + width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)), + height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)), + inline : 1 + }, { + action : "update", + numcols : sp.colspan, + numrows : sp.rowspan, + plugin_url : url + }); + + return true; + } else { + var numRows = parseInt(value['numrows']); + var numCols = parseInt(value['numcols']); + var cpos = getCellPos(grid, tdElm); + + if (("" + numRows) == "NaN") + numRows = 1; + + if (("" + numCols) == "NaN") + numCols = 1; + + // Get rows and cells + var tRows = tableElm.rows; + for (var y=cpos.rowindex; y 0) + rows[rows.length] = rowCells; + + var td = getCell(grid, cpos.rowindex, cpos.cellindex); + each(ed.dom.select('br', td), function(e, i) { + if (i > 0 && ed.dom.getAttrib('mce_bogus')) + ed.dom.remove(e); + }); + } + + //return true; + } + } else { + var cells = []; + var sel = inst.selection.getSel(); + var lastTR = null; + var curRow = null; + var x1 = -1, y1 = -1, x2, y2; + + // Only one cell selected, whats the point? + if (sel.rangeCount < 2) + return true; + + // Get all selected cells + for (var i=0; i 0) + rows[rows.length] = rowCells; + } + + // Find selected cells in grid and box + var curRow = []; + var lastTR = null; + for (var y=0; y colSpan) + colSpan = rowColSpan; + + lastRowSpan = -1; + } + + // Validate vertical and get total rowspan + var lastColSpan = -1; + for (var x=0; x rowSpan) + rowSpan = colRowSpan; + + lastColSpan = -1; + } + + // Setup td + tdElm = rows[0][0]; + tdElm.rowSpan = rowSpan; + tdElm.colSpan = colSpan; + + // Merge cells + for (var y=0; y 0)) + tdElm.innerHTML += html; + + // Not current cell + if (rows[y][x] != tdElm && !rows[y][x]._deleted) { + var cpos = getCellPos(grid, rows[y][x]); + var tr = rows[y][x].parentNode; + + tr.removeChild(rows[y][x]); + rows[y][x]._deleted = true; + + // Empty TR, remove it + if (!tr.hasChildNodes()) { + tr.parentNode.removeChild(tr); + + var lastCell = null; + for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) { + if (cellElm != lastCell && cellElm.rowSpan > 1) + cellElm.rowSpan--; + + lastCell = cellElm; + } + + if (tdElm.rowSpan > 1) + tdElm.rowSpan--; + } + } + } + } + + // Remove all but one bogus br + each(ed.dom.select('br', tdElm), function(e, i) { + if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus')) + ed.dom.remove(e); + }); + + break; + } + + tableElm = inst.dom.getParent(inst.selection.getNode(), "table"); + inst.addVisual(tableElm); + inst.nodeChanged(); + } + + return true; + } + + // Pass to next handler in chain + return false; + } + }); + + // Register plugin + tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin); +})(); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/js/cell.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/js/cell.js new file mode 100644 index 0000000..feb7061 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/js/cell.js @@ -0,0 +1,259 @@ +tinyMCEPopup.requireLangPack(); + +var ed; + +function init() { + ed = tinyMCEPopup.editor; + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor') + + var inst = ed; + var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th"); + var formObj = document.forms[0]; + var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style")); + + // Get table cell data + var celltype = tdElm.nodeName.toLowerCase(); + var align = ed.dom.getAttrib(tdElm, 'align'); + var valign = ed.dom.getAttrib(tdElm, 'valign'); + var width = trimSize(getStyle(tdElm, 'width', 'width')); + var height = trimSize(getStyle(tdElm, 'height', 'height')); + var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor')); + var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor')); + var className = ed.dom.getAttrib(tdElm, 'class'); + var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");; + var id = ed.dom.getAttrib(tdElm, 'id'); + var lang = ed.dom.getAttrib(tdElm, 'lang'); + var dir = ed.dom.getAttrib(tdElm, 'dir'); + var scope = ed.dom.getAttrib(tdElm, 'scope'); + + // Setup form + addClassesToList('class', 'table_cell_styles'); + TinyMCE_EditableSelects.init(); + + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.backgroundimage.value = backgroundimage; + formObj.width.value = width; + formObj.height.value = height; + formObj.id.value = id; + formObj.lang.value = lang; + formObj.style.value = ed.dom.serializeStyle(st); + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'valign', valign); + selectByValue(formObj, 'class', className, true, true); + selectByValue(formObj, 'celltype', celltype); + selectByValue(formObj, 'dir', dir); + selectByValue(formObj, 'scope', scope); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); +} + +function updateAction() { + var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0]; + + tinyMCEPopup.restoreSelection(); + el = ed.selection.getNode(); + tdElm = ed.dom.getParent(el, "td,th"); + trElm = ed.dom.getParent(el, "tr"); + tableElm = ed.dom.getParent(el, "table"); + + ed.execCommand('mceBeginUndoLevel'); + + switch (getSelectValue(formObj, 'action')) { + case "cell": + var celltype = getSelectValue(formObj, 'celltype'); + var scope = getSelectValue(formObj, 'scope'); + + if (ed.getParam("accessibility_warnings")) { + if (celltype == "th" && scope == "") + var answer = confirm(ed.getLang('table_dlg.missing_scope', '', true)); + else + var answer = true; + + if (!answer) + return; + } + + updateCell(tdElm); + break; + + case "row": + var cell = trElm.firstChild; + + if (cell.nodeName != "TD" && cell.nodeName != "TH") + cell = nextCell(cell); + + do { + cell = updateCell(cell, true); + } while ((cell = nextCell(cell)) != null); + + break; + + case "all": + var rows = tableElm.getElementsByTagName("tr"); + + for (var i=0; i colLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); + return false; + } else if (rowLimit && rows > rowLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); + return false; + } else if (cellLimit && cols * rows > cellLimit) { + inst.windowManager.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); + return false; + } + + // Update table + if (action == "update") { + inst.execCommand('mceBeginUndoLevel'); + + dom.setAttrib(elm, 'cellPadding', cellpadding, true); + dom.setAttrib(elm, 'cellSpacing', cellspacing, true); + dom.setAttrib(elm, 'border', border); + dom.setAttrib(elm, 'align', align); + dom.setAttrib(elm, 'frame', frame); + dom.setAttrib(elm, 'rules', rules); + dom.setAttrib(elm, 'class', className); + dom.setAttrib(elm, 'style', style); + dom.setAttrib(elm, 'id', id); + dom.setAttrib(elm, 'summary', summary); + dom.setAttrib(elm, 'dir', dir); + dom.setAttrib(elm, 'lang', lang); + + capEl = inst.dom.select('caption', elm)[0]; + + if (capEl && !caption) + capEl.parentNode.removeChild(capEl); + + if (!capEl && caption) { + capEl = elm.ownerDocument.createElement('caption'); + + if (!tinymce.isIE) + capEl.innerHTML = '
'; + + elm.insertBefore(capEl, elm.firstChild); + } + + if (width && /(pt|em|cm)$/.test(width)) { + dom.setStyle(elm, 'width', width); + dom.setAttrib(elm, 'width', ''); + } else { + dom.setAttrib(elm, 'width', width, true); + dom.setStyle(elm, 'width', ''); + } + + // Remove these since they are not valid XHTML + dom.setAttrib(elm, 'borderColor', ''); + dom.setAttrib(elm, 'bgColor', ''); + dom.setAttrib(elm, 'background', ''); + + if (height) { + dom.setStyle(elm, 'height', height); + dom.setAttrib(elm, 'height', ''); + } + + if (background != '') + elm.style.backgroundImage = "url('" + background + "')"; + else + elm.style.backgroundImage = ''; + +/* if (tinyMCEPopup.getParam("inline_styles")) { + if (width != '') + elm.style.width = getCSSSize(width); + }*/ + + if (bordercolor != "") { + elm.style.borderColor = bordercolor; + elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle; + elm.style.borderWidth = border == "" ? "1px" : border; + } else + elm.style.borderColor = ''; + + elm.style.backgroundColor = bgcolor; + elm.style.height = getCSSSize(height); + + inst.addVisual(); + + // Fix for stange MSIE align bug + //elm.outerHTML = elm.outerHTML; + + inst.nodeChanged(); + inst.execCommand('mceEndUndoLevel'); + + // Repaint if dimensions changed + if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight) + inst.execCommand('mceRepaint'); + + tinyMCEPopup.close(); + return true; + } + + // Create new table + html += '/g, '>'); + + return ' ' + attrib + '="' + value + '"'; +} + +function init() { + tinyMCEPopup.resizeToInnerSize(); + + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); + document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor'); + document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); + + var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', ''); + var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = ""; + var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame; + var inst = tinyMCEPopup.editor, dom = inst.dom; + var formObj = document.forms[0]; + var elm = dom.getParent(inst.selection.getNode(), "table"); + + action = tinyMCEPopup.getWindowArg('action'); + + if (!action) + action = elm ? "update" : "insert"; + + if (elm && action != "insert") { + var rowsAr = elm.rows; + var cols = 0; + for (var i=0; i cols) + cols = rowsAr[i].cells.length; + + cols = cols; + rows = rowsAr.length; + + st = dom.parseStyle(dom.getAttrib(elm, "style")); + border = trimSize(getStyle(elm, 'border', 'borderWidth')); + cellpadding = dom.getAttrib(elm, 'cellpadding', ""); + cellspacing = dom.getAttrib(elm, 'cellspacing', ""); + width = trimSize(getStyle(elm, 'width', 'width')); + height = trimSize(getStyle(elm, 'height', 'height')); + bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor')); + bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor')); + align = dom.getAttrib(elm, 'align', align); + frame = dom.getAttrib(elm, 'frame'); + rules = dom.getAttrib(elm, 'rules'); + className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, '')); + id = dom.getAttrib(elm, 'id'); + summary = dom.getAttrib(elm, 'summary'); + style = dom.serializeStyle(st); + dir = dom.getAttrib(elm, 'dir'); + lang = dom.getAttrib(elm, 'lang'); + background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + formObj.caption.checked = elm.getElementsByTagName('caption').length > 0; + + orgTableWidth = width; + orgTableHeight = height; + + action = "update"; + formObj.insert.value = inst.getLang('update'); + } + + addClassesToList('class', "table_styles"); + TinyMCE_EditableSelects.init(); + + // Update form + selectByValue(formObj, 'align', align); + selectByValue(formObj, 'frame', frame); + selectByValue(formObj, 'rules', rules); + selectByValue(formObj, 'class', className, true, true); + formObj.cols.value = cols; + formObj.rows.value = rows; + formObj.border.value = border; + formObj.cellpadding.value = cellpadding; + formObj.cellspacing.value = cellspacing; + formObj.width.value = width; + formObj.height.value = height; + formObj.bordercolor.value = bordercolor; + formObj.bgcolor.value = bgcolor; + formObj.id.value = id; + formObj.summary.value = summary; + formObj.style.value = style; + formObj.dir.value = dir; + formObj.lang.value = lang; + formObj.backgroundimage.value = background; + + updateColor('bordercolor_pick', 'bordercolor'); + updateColor('bgcolor_pick', 'bgcolor'); + + // Resize some elements + if (isVisible('backgroundimagebrowser')) + document.getElementById('backgroundimage').style.width = '180px'; + + // Disable some fields in update mode + if (action == "update") { + formObj.cols.disabled = true; + formObj.rows.disabled = true; + } +} + +function changedSize() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + +/* var width = formObj.width.value; + if (width != "") + st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : ""; + else + st['width'] = "";*/ + + var height = formObj.height.value; + if (height != "") + st['height'] = getCSSSize(height); + else + st['height'] = ""; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBackgroundImage() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-image'] = "url('" + formObj.backgroundimage.value + "')"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedBorder() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + // Update border width if the element has a color + if (formObj.border.value != "" && formObj.bordercolor.value != "") + st['border-width'] = formObj.border.value + "px"; + + formObj.style.value = dom.serializeStyle(st); +} + +function changedColor() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + st['background-color'] = formObj.bgcolor.value; + + if (formObj.bordercolor.value != "") { + st['border-color'] = formObj.bordercolor.value; + + // Add border-width if it's missing + if (!st['border-width']) + st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px"; + } + + formObj.style.value = dom.serializeStyle(st); +} + +function changedStyle() { + var formObj = document.forms[0]; + var st = dom.parseStyle(formObj.style.value); + + if (st['background-image']) + formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"); + else + formObj.backgroundimage.value = ''; + + if (st['width']) + formObj.width.value = trimSize(st['width']); + + if (st['height']) + formObj.height.value = trimSize(st['height']); + + if (st['background-color']) { + formObj.bgcolor.value = st['background-color']; + updateColor('bgcolor_pick','bgcolor'); + } + + if (st['border-color']) { + formObj.bordercolor.value = st['border-color']; + updateColor('bordercolor_pick','bordercolor'); + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/langs/en_dlg.js new file mode 100644 index 0000000..a33c987 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/langs/en_dlg.js @@ -0,0 +1,74 @@ +tinyMCE.addI18n('en.table_dlg',{ +general_tab:"General", +advanced_tab:"Advanced", +general_props:"General properties", +advanced_props:"Advanced properties", +rowtype:"Row in table part", +title:"Insert/Modify table", +width:"Width", +height:"Height", +cols:"Cols", +rows:"Rows", +cellspacing:"Cellspacing", +cellpadding:"Cellpadding", +border:"Border", +align:"Alignment", +align_default:"Default", +align_left:"Left", +align_right:"Right", +align_middle:"Center", +row_title:"Table row properties", +cell_title:"Table cell properties", +cell_type:"Cell type", +valign:"Vertical alignment", +align_top:"Top", +align_bottom:"Bottom", +bordercolor:"Border color", +bgcolor:"Background color", +merge_cells_title:"Merge table cells", +id:"Id", +style:"Style", +langdir:"Language direction", +langcode:"Language code", +mime:"Target MIME type", +ltr:"Left to right", +rtl:"Right to left", +bgimage:"Background image", +summary:"Summary", +td:"Data", +th:"Header", +cell_cell:"Update current cell", +cell_row:"Update all cells in row", +cell_all:"Update all cells in table", +row_row:"Update current row", +row_odd:"Update odd rows in table", +row_even:"Update even rows in table", +row_all:"Update all rows in table", +thead:"Table Head", +tbody:"Table Body", +tfoot:"Table Foot", +scope:"Scope", +rowgroup:"Row Group", +colgroup:"Col Group", +col_limit:"You've exceeded the maximum number of columns of {$cols}.", +row_limit:"You've exceeded the maximum number of rows of {$rows}.", +cell_limit:"You've exceeded the maximum number of cells of {$cells}.", +missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.", +caption:"Table caption", +frame:"Frame", +frame_none:"none", +frame_groups:"groups", +frame_rows:"rows", +frame_cols:"cols", +frame_all:"all", +rules:"Rules", +rules_void:"void", +rules_above:"above", +rules_below:"below", +rules_hsides:"hsides", +rules_lhs:"lhs", +rules_rhs:"rhs", +rules_vsides:"vsides", +rules_box:"box", +rules_border:"border" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/merge_cells.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/merge_cells.htm new file mode 100644 index 0000000..f2dcbec --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/merge_cells.htm @@ -0,0 +1,38 @@ + + + + {#table_dlg.merge_cells_title} + + + + + + + +
+
+ {#table_dlg.merge_cells_title} + + + + + + + + + +
{#table_dlg.cols}:
{#table_dlg.rows}:
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/row.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/row.htm new file mode 100644 index 0000000..4a709d3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/row.htm @@ -0,0 +1,161 @@ + + + + {#table_dlg.row_title} + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/table.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/table.htm new file mode 100644 index 0000000..74982fa --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/plugins/table/table.htm @@ -0,0 +1,193 @@ + + + + {#table_dlg.title} + + + + + + + + + + +
+ + +
+
+
+ {#table_dlg.general_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+ {#table_dlg.advanced_props} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + +
 
+
+ +
+ +
+ +
+ + + + + +
 
+
+ + + + + +
 
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/about.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/about.htm new file mode 100644 index 0000000..4e73b14 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/about.htm @@ -0,0 +1,56 @@ + + + + {#advanced_dlg.about_title} + + + + + + + +
+
+

{#advanced_dlg.about_title}

+

Version: ()

+

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL + by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

+

Copyright © 2003-2008, Moxiecode Systems AB, All rights reserved.

+

For more information about this software visit the TinyMCE website.

+ +
+ Got Moxie? + Hosted By Sourceforge + Also on freshmeat +
+
+ +
+
+

{#advanced_dlg.about_loaded}

+ +
+
+ +

 

+
+
+ +
+
+
+
+ +
+
+ +
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/anchor.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/anchor.htm new file mode 100644 index 0000000..054cde5 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/anchor.htm @@ -0,0 +1,32 @@ + + + + {#advanced_dlg.anchor_title} + + + + + +
+ + + + + + + + +
{#advanced_dlg.anchor_title}
{#advanced_dlg.anchor_name}:
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/charmap.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/charmap.htm new file mode 100644 index 0000000..8ca0113 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/charmap.htm @@ -0,0 +1,54 @@ + + + + {#advanced_dlg.charmap_title} + + + + + + + + + + + + + + + + + +
{#advanced_dlg.charmap_title}
+ + + + + + + + + +
 
 
+
+ + + + + + + + + + + + + + + + +
HTML-Code
 
 
NUM-Code
 
+
+ + + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/color_picker.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/color_picker.htm new file mode 100644 index 0000000..4cab768 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/color_picker.htm @@ -0,0 +1,76 @@ + + + + {#advanced_dlg.colorpicker_title} + + + + + + +
+ + +
+
+
+ {#advanced_dlg.colorpicker_picker_title} +
+ + +
+ +
+ +
+
+
+
+ +
+
+ {#advanced_dlg.colorpicker_palette_title} +
+ +
+ +
+
+
+ +
+
+ {#advanced_dlg.colorpicker_named_title} +
+ +
+ +
+ +
+ {#advanced_dlg.colorpicker_name} +
+
+
+
+ +
+
+ +
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template.js new file mode 100644 index 0000000..eea384f --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template.js @@ -0,0 +1 @@ +(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID,explode=tinymce.explode;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s,v;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));if(s.skin_variant)DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(e){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var t=this,ed=t.editor,c,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});if(c){each(ed.getParam('theme_advanced_font_sizes',t.settings.theme_advanced_font_sizes,'hash'),function(v,k){c.add(k!=v?k:lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'mceFontSize'+v});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},''),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(v.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=(s['theme_advanced_container_'+c+'_align']||da).toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},''));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},''));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},''));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':' ');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(''+ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}()); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template_src.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template_src.js new file mode 100644 index 0000000..9a5b479 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/editor_template_src.js @@ -0,0 +1,1052 @@ +/** + * $Id: editor_template_src.js,v 1.1 2008/07/28 21:59:07 bao Exp $ + * + * @author Moxiecode + * @copyright Copyright Đ 2004-2008, Moxiecode Systems AB, All rights reserved. + */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('advanced'); + + tinymce.create('tinymce.themes.AdvancedTheme', { + // Control name lookup, format: title, command + controls : { + bold : ['bold_desc', 'Bold'], + italic : ['italic_desc', 'Italic'], + underline : ['underline_desc', 'Underline'], + strikethrough : ['striketrough_desc', 'Strikethrough'], + justifyleft : ['justifyleft_desc', 'JustifyLeft'], + justifycenter : ['justifycenter_desc', 'JustifyCenter'], + justifyright : ['justifyright_desc', 'JustifyRight'], + justifyfull : ['justifyfull_desc', 'JustifyFull'], + bullist : ['bullist_desc', 'InsertUnorderedList'], + numlist : ['numlist_desc', 'InsertOrderedList'], + outdent : ['outdent_desc', 'Outdent'], + indent : ['indent_desc', 'Indent'], + cut : ['cut_desc', 'Cut'], + copy : ['copy_desc', 'Copy'], + paste : ['paste_desc', 'Paste'], + undo : ['undo_desc', 'Undo'], + redo : ['redo_desc', 'Redo'], + link : ['link_desc', 'mceLink'], + unlink : ['unlink_desc', 'unlink'], + image : ['image_desc', 'mceImage'], + cleanup : ['cleanup_desc', 'mceCleanup'], + help : ['help_desc', 'mceHelp'], + code : ['code_desc', 'mceCodeEditor'], + hr : ['hr_desc', 'InsertHorizontalRule'], + removeformat : ['removeformat_desc', 'RemoveFormat'], + sub : ['sub_desc', 'subscript'], + sup : ['sup_desc', 'superscript'], + forecolor : ['forecolor_desc', 'ForeColor'], + forecolorpicker : ['forecolor_desc', 'mceForeColor'], + backcolor : ['backcolor_desc', 'HiliteColor'], + backcolorpicker : ['backcolor_desc', 'mceBackColor'], + charmap : ['charmap_desc', 'mceCharMap'], + visualaid : ['visualaid_desc', 'mceToggleVisualAid'], + anchor : ['anchor_desc', 'mceInsertAnchor'], + newdocument : ['newdocument_desc', 'mceNewDocument'], + blockquote : ['blockquote_desc', 'mceBlockQuote'] + }, + + stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], + + init : function(ed, url) { + var t = this, s, v; + + t.editor = ed; + t.url = url; + t.onResolveName = new tinymce.util.Dispatcher(this); + + // Default settings + t.settings = s = extend({ + theme_advanced_path : true, + theme_advanced_toolbar_location : 'bottom', + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", + theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", + theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", + theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", + theme_advanced_toolbar_align : "center", + theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", + theme_advanced_font_sizes : "1,2,3,4,5,6,7", + theme_advanced_more_colors : 1, + theme_advanced_row_height : 23, + theme_advanced_resize_horizontal : 1, + theme_advanced_resizing_use_cookie : 1 + }, ed.settings); + + if ((v = s.theme_advanced_path_location) && v != 'none') + s.theme_advanced_statusbar_location = s.theme_advanced_path_location; + + if (s.theme_advanced_statusbar_location == 'none') + s.theme_advanced_statusbar_location = 0; + + // Init editor + ed.onInit.add(function() { + ed.onNodeChange.add(t._nodeChanged, t); + + if (ed.settings.content_css !== false) + ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); + }); + + ed.onSetProgressState.add(function(ed, b, ti) { + var co, id = ed.id, tb; + + if (b) { + t.progressTimer = setTimeout(function() { + co = ed.getContainer(); + co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); + tb = DOM.get(ed.id + '_tbl'); + + DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); + DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); + }, ti || 0); + } else { + DOM.remove(id + '_blocker'); + DOM.remove(id + '_progress'); + clearTimeout(t.progressTimer); + } + }); + + DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css")); + + if (s.skin_variant) + DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css")); + }, + + createControl : function(n, cf) { + var cd, c; + + if (c = cf.createControl(n)) + return c; + + switch (n) { + case "styleselect": + return this._createStyleSelect(); + + case "formatselect": + return this._createBlockFormats(); + + case "fontselect": + return this._createFontSelect(); + + case "fontsizeselect": + return this._createFontSizeSelect(); + + case "forecolor": + return this._createForeColorMenu(); + + case "backcolor": + return this._createBackColorMenu(); + } + + if ((cd = this.controls[n])) + return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); + }, + + execCommand : function(cmd, ui, val) { + var f = this['_' + cmd]; + + if (f) { + f.call(this, ui, val); + return true; + } + + return false; + }, + + _importClasses : function(e) { + var ed = this.editor, c = ed.controlManager.get('styleselect'); + + if (c.getLength() == 0) { + each(ed.dom.getClasses(), function(o) { + c.add(o['class'], o['class']); + }); + } + }, + + _createStyleSelect : function(n) { + var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { + title : 'advanced.style_select', + onselect : function(v) { + if (c.selectedValue === v) { + ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); + c.select(); + return false; + } else + ed.execCommand('mceSetCSSClass', 0, v); + } + }); + + if (c) { + each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) { + if (v) + c.add(t.editor.translate(k), v); + }); + + c.onPostRender.add(function(ed, n) { + Event.add(n.id + '_text', 'focus', t._importClasses, t); + Event.add(n.id + '_text', 'mousedown', t._importClasses, t); + }); + } + + return c; + }, + + _createFontSelect : function() { + var c, t = this, ed = t.editor; + + c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); + if (c) { + each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) { + c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''}); + }); + } + + return c; + }, + + _createFontSizeSelect : function() { + var t = this, ed = t.editor, c, lo = [ + "1 (8 pt)", + "2 (10 pt)", + "3 (12 pt)", + "4 (14 pt)", + "5 (18 pt)", + "6 (24 pt)", + "7 (36 pt)" + ], fz = [8, 10, 12, 14, 18, 24, 36]; + + c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'}); + if (c) { + each(ed.getParam('theme_advanced_font_sizes', t.settings.theme_advanced_font_sizes, 'hash'), function(v, k) { + c.add(k != v ? k : lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'mceFontSize' + v}); + }); + } + + return c; + }, + + _createBlockFormats : function() { + var c, fmts = { + p : 'advanced.paragraph', + address : 'advanced.address', + pre : 'advanced.pre', + h1 : 'advanced.h1', + h2 : 'advanced.h2', + h3 : 'advanced.h3', + h4 : 'advanced.h4', + h5 : 'advanced.h5', + h6 : 'advanced.h6', + div : 'advanced.div', + blockquote : 'advanced.blockquote', + code : 'advanced.code', + dt : 'advanced.dt', + dd : 'advanced.dd', + samp : 'advanced.samp' + }, t = this; + + c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'}); + if (c) { + each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) { + c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v}); + }); + } + + return c; + }, + + _createForeColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_text_colors) + o.colors = v; + + o.title = 'advanced.forecolor_desc'; + o.cmd = 'ForeColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('forecolor', o); + + return c; + }, + + _createBackColorMenu : function() { + var c, t = this, s = t.settings, o = {}, v; + + if (s.theme_advanced_more_colors) { + o.more_colors_func = function() { + t._mceColorPicker(0, { + color : c.value, + func : function(co) { + c.setColor(co); + } + }); + }; + } + + if (v = s.theme_advanced_background_colors) + o.colors = v; + + o.title = 'advanced.backcolor_desc'; + o.cmd = 'HiliteColor'; + o.scope = this; + + c = t.editor.controlManager.createColorSplitButton('backcolor', o); + + return c; + }, + + renderUI : function(o) { + var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; + + n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')}); + + if (!DOM.boxModel) + n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); + + n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); + n = tb = DOM.add(n, 'tbody'); + + switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { + case "rowlayout": + ic = t._rowLayout(s, tb, o); + break; + + case "customlayout": + ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); + break; + + default: + ic = t._simpleLayout(s, tb, o, p); + } + + n = o.targetNode; + + // Add classes to first and last TRs + nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8 + DOM.addClass(nl[0], 'mceFirst'); + DOM.addClass(nl[nl.length - 1], 'mceLast'); + + // Add classes to first and last TDs + each(DOM.select('tr', tb), function(n) { + DOM.addClass(n.firstChild, 'mceFirst'); + DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast'); + }); + + if (DOM.get(s.theme_advanced_toolbar_container)) + DOM.get(s.theme_advanced_toolbar_container).appendChild(p); + else + DOM.insertAfter(p, n); + + Event.add(ed.id + '_path_row', 'click', function(e) { + e = e.target; + + if (e.nodeName == 'A') { + t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1')); + + return Event.cancel(e); + } + }); +/* + if (DOM.get(ed.id + '_path_row')) { + Event.add(ed.id + '_tbl', 'mouseover', function(e) { + var re; + + e = e.target; + + if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { + re = DOM.get(ed.id + '_path_row'); + t.lastPath = re.innerHTML; + DOM.setHTML(re, e.parentNode.title); + } + }); + + Event.add(ed.id + '_tbl', 'mouseout', function(e) { + if (t.lastPath) { + DOM.setHTML(ed.id + '_path_row', t.lastPath); + t.lastPath = 0; + } + }); + } +*/ + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + Event.add(DOM.add(p, 'a', {href : '#'}, ''), 'focus', function() {tinyMCE.get(ed.id).focus();}); + + if (s.theme_advanced_toolbar_location == 'external') + o.deltaHeight = 0; + + t.deltaHeight = o.deltaHeight; + o.targetNode = null; + + return { + iframeContainer : ic, + editorContainer : ed.id + '_parent', + sizeContainer : sc, + deltaHeight : o.deltaHeight + }; + }, + + getInfo : function() { + return { + longname : 'Advanced theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + }, + + resizeBy : function(dw, dh) { + var e = DOM.get(this.editor.id + '_tbl'); + + this.resizeTo(e.clientWidth + dw, e.clientHeight + dh); + }, + + resizeTo : function(w, h) { + var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh; + + // Boundery fix box + w = Math.max(s.theme_advanced_resizing_min_width || 100, w); + h = Math.max(s.theme_advanced_resizing_min_height || 100, h); + w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w); + h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h); + + // Calc difference between iframe and container + dh = e.clientHeight - ifr.clientHeight; + + // Resize iframe and container + DOM.setStyle(ifr, 'height', h - dh); + DOM.setStyles(e, {width : w, height : h}); + }, + + destroy : function() { + var id = this.editor.id; + + Event.clear(id + '_resize'); + Event.clear(id + '_path_row'); + Event.clear(id + '_external_close'); + }, + + // Internal functions + + _simpleLayout : function(s, tb, o, p) { + var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; + + // Create toolbar container at top + if (lo == 'top') + t._addToolbars(tb, o); + + // Create external toolbar + if (lo == 'external') { + n = c = DOM.create('div', {style : 'position:relative'}); + n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); + DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); + n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); + etb = DOM.add(n, 'tbody'); + + if (p.firstChild.className == 'mceOldBoxModel') + p.firstChild.appendChild(c); + else + p.insertBefore(c, p.firstChild); + + t._addToolbars(etb, o); + + ed.onMouseUp.add(function() { + var e = DOM.get(ed.id + '_external'); + DOM.show(e); + + DOM.hide(lastExtID); + + var f = Event.add(ed.id + '_external_close', 'click', function() { + DOM.hide(ed.id + '_external'); + Event.remove(ed.id + '_external_close', 'click', f); + }); + + DOM.show(e); + DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); + + // Fixes IE rendering bug + DOM.hide(e); + DOM.show(e); + e.style.filter = ''; + + lastExtID = ed.id + '_external'; + + e = null; + }); + } + + if (sl == 'top') + t._addStatusBar(tb, o); + + // Create iframe container + if (!s.theme_advanced_toolbar_container) { + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + } + + // Create toolbar container at bottom + if (lo == 'bottom') + t._addToolbars(tb, o); + + if (sl == 'bottom') + t._addStatusBar(tb, o); + + return ic; + }, + + _rowLayout : function(s, tb, o) { + var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a; + + dc = s.theme_advanced_containers_default_class || ''; + da = s.theme_advanced_containers_default_align || 'center'; + + each(explode(s.theme_advanced_containers || ''), function(c, i) { + var v = s['theme_advanced_container_' + c] || ''; + + switch (v.toLowerCase()) { + case 'mceeditor': + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); + break; + + case 'mceelementpath': + t._addStatusBar(tb, o); + break; + + default: + a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(tb, 'tr'), 'td', { + 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da + }); + + to = cf.createToolbar("toolbar" + i); + t._addControls(v, to); + DOM.setHTML(n, to.renderHTML()); + o.deltaHeight -= s.theme_advanced_row_height; + } + }); + + return ic; + }, + + _addControls : function(v, tb) { + var t = this, s = t.settings, di, cf = t.editor.controlManager; + + if (s.theme_advanced_disable && !t._disabled) { + di = {}; + + each(explode(s.theme_advanced_disable), function(v) { + di[v] = 1; + }); + + t._disabled = di; + } else + di = t._disabled; + + each(explode(v), function(n) { + var c; + + if (di && di[n]) + return; + + // Compatiblity with 2.x + if (n == 'tablecontrols') { + each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { + n = t.createControl(n, cf); + + if (n) + tb.add(n); + }); + + return; + } + + c = t.createControl(n, cf); + + if (c) + tb.add(c); + }); + }, + + _addToolbars : function(c, o) { + var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a; + + a = s.theme_advanced_toolbar_align.toLowerCase(); + a = 'mce' + t._ufirst(a); + + n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a}); + + if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) + h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '')); + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '')); + + // Create toolbar and add the controls + for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { + tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); + + if (s['theme_advanced_buttons' + i + '_add']) + v += ',' + s['theme_advanced_buttons' + i + '_add']; + + if (s['theme_advanced_buttons' + i + '_add_before']) + v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; + + t._addControls(v, tb); + + //n.appendChild(n = tb.render()); + h.push(tb.renderHTML()); + + o.deltaHeight -= s.theme_advanced_row_height; + } + + h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '')); + DOM.setHTML(n, h.join('')); + }, + + _addStatusBar : function(tb, o) { + var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; + + n = DOM.add(tb, 'tr'); + n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); + n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); + DOM.add(n, 'a', {href : '#', accesskey : 'x'}); + + if (s.theme_advanced_resizing && !tinymce.isOldWebKit) { + DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'}); + + if (s.theme_advanced_resizing_use_cookie) { + ed.onPostRender.add(function() { + var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); + + if (!o) + return; + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, o.cw) + 'px'; + + c.style.height = Math.max(10, o.ch) + 'px'; + DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px'; + }); + } + + ed.onPostRender.add(function() { + Event.add(ed.id + '_resize', 'mousedown', function(e) { + var c, p, w, h, n, pa; + + // Measure container + c = DOM.get(ed.id + '_tbl'); + w = c.clientWidth; + h = c.clientHeight; + + miw = s.theme_advanced_resizing_min_width || 100; + mih = s.theme_advanced_resizing_min_height || 100; + maw = s.theme_advanced_resizing_max_width || 0xFFFF; + mah = s.theme_advanced_resizing_max_height || 0xFFFF; + + // Setup placeholder + p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); + DOM.setStyles(p, {width : w, height : h}); + + // Replace with placeholder + DOM.hide(c); + DOM.show(p); + + // Create internal resize obj + r = { + x : e.screenX, + y : e.screenY, + w : w, + h : h, + dx : null, + dy : null + }; + + // Start listening + mf = Event.add(DOM.doc, 'mousemove', function(e) { + var w, h; + + // Calc delta values + r.dx = e.screenX - r.x; + r.dy = e.screenY - r.y; + + // Boundery fix box + w = Math.max(miw, r.w + r.dx); + h = Math.max(mih, r.h + r.dy); + w = Math.min(maw, w); + h = Math.min(mah, h); + + // Resize placeholder + if (s.theme_advanced_resize_horizontal) + p.style.width = w + 'px'; + + p.style.height = h + 'px'; + + return Event.cancel(e); + }); + + me = Event.add(DOM.doc, 'mouseup', function(e) { + var ifr; + + // Stop listening + Event.remove(DOM.doc, 'mousemove', mf); + Event.remove(DOM.doc, 'mouseup', me); + + c.style.display = ''; + DOM.remove(p); + + if (r.dx === null) + return; + + ifr = DOM.get(ed.id + '_ifr'); + + if (s.theme_advanced_resize_horizontal) + c.style.width = Math.max(10, r.w + r.dx) + 'px'; + + c.style.height = Math.max(10, r.h + r.dy) + 'px'; + ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px'; + + if (s.theme_advanced_resizing_use_cookie) { + Cookie.setHash("TinyMCE_" + ed.id + "_size", { + cw : r.w + r.dx, + ch : r.h + r.dy + }); + } + }); + + return Event.cancel(e); + }); + }); + } + + o.deltaHeight -= 21; + n = tb = null; + }, + + _nodeChanged : function(ed, cm, n, co) { + var t = this, p, de = 0, v, c, s = t.settings; + + tinymce.each(t.stateControls, function(c) { + cm.setActive(c, ed.queryCommandState(t.controls[c][1])); + }); + + cm.setActive('visualaid', ed.hasVisual); + cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); + cm.setDisabled('redo', !ed.undoManager.hasRedo()); + cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); + + p = DOM.getParent(n, 'A'); + if (c = cm.get('link')) { + if (!p || !p.name) { + c.setDisabled(!p && co); + c.setActive(!!p); + } + } + + if (c = cm.get('unlink')) { + c.setDisabled(!p && co); + c.setActive(!!p && !p.name); + } + + if (c = cm.get('anchor')) { + c.setActive(!!p && p.name); + + if (tinymce.isWebKit) { + p = DOM.getParent(n, 'IMG'); + c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); + } + } + + p = DOM.getParent(n, 'IMG'); + if (c = cm.get('image')) + c.setActive(!!p && n.className.indexOf('mceItem') == -1); + + if (c = cm.get('styleselect')) { + if (n.className) { + t._importClasses(); + c.select(n.className); + } else + c.select(); + } + + if (c = cm.get('formatselect')) { + p = DOM.getParent(n, DOM.isBlock); + + if (p) + c.select(p.nodeName.toLowerCase()); + } + + if (c = cm.get('fontselect')) + c.select(ed.queryCommandValue('FontName')); + + if (c = cm.get('fontsizeselect')) + c.select('' + ed.queryCommandValue('FontSize')); + + if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { + p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); + DOM.setHTML(p, ''); + + ed.dom.getParent(n, function(n) { + var na = n.nodeName.toLowerCase(), u, pi, ti = ''; + + // Ignore non element and hidden elements + if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) + return; + + // Fake name + if (v = DOM.getAttrib(n, 'mce_name')) + na = v; + + // Handle prefix + if (tinymce.isIE && n.scopeName !== 'HTML') + na = n.scopeName + ':' + na; + + // Remove internal prefix + na = na.replace(/mce\:/g, ''); + + // Handle node name + switch (na) { + case 'b': + na = 'strong'; + break; + + case 'i': + na = 'em'; + break; + + case 'img': + if (v = DOM.getAttrib(n, 'src')) + ti += 'src: ' + v + ' '; + + break; + + case 'a': + if (v = DOM.getAttrib(n, 'name')) { + ti += 'name: ' + v + ' '; + na += '#' + v; + } + + if (v = DOM.getAttrib(n, 'href')) + ti += 'href: ' + v + ' '; + + break; + + case 'font': + if (s.convert_fonts_to_spans) + na = 'span'; + + if (v = DOM.getAttrib(n, 'face')) + ti += 'font: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'size')) + ti += 'size: ' + v + ' '; + + if (v = DOM.getAttrib(n, 'color')) + ti += 'color: ' + v + ' '; + + break; + + case 'span': + if (v = DOM.getAttrib(n, 'style')) + ti += 'style: ' + v + ' '; + + break; + } + + if (v = DOM.getAttrib(n, 'id')) + ti += 'id: ' + v + ' '; + + if (v = n.className) { + v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); + + if (v && v.indexOf('mceItem') == -1) { + ti += 'class: ' + v + ' '; + + if (DOM.isBlock(n) || na == 'img' || na == 'span') + na += '.' + v; + } + } + + na = na.replace(/(html:)/g, ''); + na = {name : na, node : n, title : ti}; + t.onResolveName.dispatch(t, na); + ti = na.title; + na = na.name; + + //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; + pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na); + + if (p.hasChildNodes()) { + p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild); + p.insertBefore(pi, p.firstChild); + } else + p.appendChild(pi); + }, ed.getBody()); + } + }, + + // Commands gets called by execCommand + + _sel : function(v) { + this.editor.execCommand('mceSelectNodeDepth', false, v); + }, + + _mceInsertAnchor : function(ui, v) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/anchor.htm', + width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), + height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceCharMap : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/charmap.htm', + width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceHelp : function() { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/about.htm', + width : 480, + height : 380, + inline : true + }, { + theme_url : this.url + }); + }, + + _mceColorPicker : function(u, v) { + var ed = this.editor; + + v = v || {}; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/color_picker.htm', + width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), + height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), + close_previous : false, + inline : true + }, { + input_color : v.color, + func : v.func, + theme_url : this.url + }); + }, + + _mceCodeEditor : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/source_editor.htm', + width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), + height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), + inline : true, + resizable : true, + maximizable : true + }, { + theme_url : this.url + }); + }, + + _mceImage : function(ui, val) { + var ed = this.editor; + + // Internal image object like a flash placeholder + if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) + return; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/image.htm', + width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), + height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceLink : function(ui, val) { + var ed = this.editor; + + ed.windowManager.open({ + url : tinymce.baseURL + '/themes/advanced/link.htm', + width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), + height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), + inline : true + }, { + theme_url : this.url + }); + }, + + _mceNewDocument : function() { + var ed = this.editor; + + ed.windowManager.confirm('advanced.newdocument', function(s) { + if (s) + ed.execCommand('mceSetContent', false, ''); + }); + }, + + _mceForeColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.fgColor, + func : function(co) { + t.fgColor = co; + t.editor.execCommand('ForeColor', false, co); + } + }); + }, + + _mceBackColor : function() { + var t = this; + + this._mceColorPicker(0, { + color: t.bgColor, + func : function(co) { + t.bgColor = co; + t.editor.execCommand('HiliteColor', false, co); + } + }); + }, + + _ufirst : function(s) { + return s.substring(0, 1).toUpperCase() + s.substring(1); + } + }); + + tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); +}()); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/image.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/image.htm new file mode 100644 index 0000000..bd92b00 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/image.htm @@ -0,0 +1,86 @@ + + + + {#advanced_dlg.image_title} + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+ x +
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg new file mode 100644 index 0000000..b4c542d Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/colorpicker.jpg differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/icons.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/icons.gif new file mode 100644 index 0000000..ccac36f Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/img/icons.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/about.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/about.js new file mode 100644 index 0000000..277550f --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/about.js @@ -0,0 +1,72 @@ +tinyMCEPopup.requireLangPack(); + +function init() { + var ed, tcont; + + tinyMCEPopup.resizeToInnerSize(); + ed = tinyMCEPopup.editor; + + // Give FF some time + window.setTimeout('insertHelpIFrame();', 10); + + tcont = document.getElementById('plugintablecontainer'); + document.getElementById('plugins_tab').style.display = 'none'; + + var html = ""; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + tinymce.each(ed.plugins, function(p, n) { + var info; + + if (!p.getInfo) + return; + + html += ''; + + info = p.getInfo(); + + if (info.infourl != null && info.infourl != '') + html += ''; + else + html += ''; + + if (info.authorurl != null && info.authorurl != '') + html += ''; + else + html += ''; + + html += ''; + html += ''; + + document.getElementById('plugins_tab').style.display = ''; + + }); + + html += ''; + html += '
' + ed.getLang('advanced_dlg.about_plugin') + '' + ed.getLang('advanced_dlg.about_author') + '' + ed.getLang('advanced_dlg.about_version') + '
' + info.longname + '' + info.longname + '' + info.author + '' + info.author + '' + info.version + '
'; + + tcont.innerHTML = html; + + tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion; + tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate; +} + +function insertHelpIFrame() { + var html; + + if (tinyMCEPopup.getParam('docs_url')) { + html = ''; + document.getElementById('iframecontainer').innerHTML = html; + document.getElementById('help_tab').style.display = 'block'; + } +} + +tinyMCEPopup.onInit.add(init); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/anchor.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/anchor.js new file mode 100644 index 0000000..76f4f7d --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/anchor.js @@ -0,0 +1,37 @@ +tinyMCEPopup.requireLangPack(); + +var AnchorDialog = { + init : function(ed) { + var action, elm, f = document.forms[0]; + + this.editor = ed; + elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG'); + v = ed.dom.getAttrib(elm, 'name'); + + if (v) { + this.action = 'update'; + f.anchorName.value = v; + } + + f.insert.value = ed.getLang(elm ? 'update' : 'insert'); + }, + + update : function() { + var ed = this.editor; + + tinyMCEPopup.restoreSelection(); + + if (this.action != 'update') + ed.selection.collapse(1); + + // Webkit acts weird if empty inline element is inserted so we need to use a image instead + if (tinymce.isWebKit) + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'})); + else + ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, '')); + + tinyMCEPopup.close(); + } +}; + +tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/charmap.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/charmap.js new file mode 100644 index 0000000..d9fd8d3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/charmap.js @@ -0,0 +1,325 @@ +tinyMCEPopup.requireLangPack(); + +var charmap = [ + [' ', ' ', true, 'no-break space'], + ['&', '&', true, 'ampersand'], + ['"', '"', true, 'quotation mark'], +// finance + ['¢', '¢', true, 'cent sign'], + ['€', '€', true, 'euro sign'], + ['£', '£', true, 'pound sign'], + ['¥', '¥', true, 'yen sign'], +// signs + ['©', '©', true, 'copyright sign'], + ['®', '®', true, 'registered sign'], + ['™', '™', true, 'trade mark sign'], + ['‰', '‰', true, 'per mille sign'], + ['µ', 'µ', true, 'micro sign'], + ['·', '·', true, 'middle dot'], + ['•', '•', true, 'bullet'], + ['…', '…', true, 'three dot leader'], + ['′', '′', true, 'minutes / feet'], + ['″', '″', true, 'seconds / inches'], + ['§', '§', true, 'section sign'], + ['¶', '¶', true, 'paragraph sign'], + ['ß', 'ß', true, 'sharp s / ess-zed'], +// quotations + ['‹', '‹', true, 'single left-pointing angle quotation mark'], + ['›', '›', true, 'single right-pointing angle quotation mark'], + ['«', '«', true, 'left pointing guillemet'], + ['»', '»', true, 'right pointing guillemet'], + ['‘', '‘', true, 'left single quotation mark'], + ['’', '’', true, 'right single quotation mark'], + ['“', '“', true, 'left double quotation mark'], + ['”', '”', true, 'right double quotation mark'], + ['‚', '‚', true, 'single low-9 quotation mark'], + ['„', '„', true, 'double low-9 quotation mark'], + ['<', '<', true, 'less-than sign'], + ['>', '>', true, 'greater-than sign'], + ['≤', '≤', true, 'less-than or equal to'], + ['≥', '≥', true, 'greater-than or equal to'], + ['–', '–', true, 'en dash'], + ['—', '—', true, 'em dash'], + ['¯', '¯', true, 'macron'], + ['‾', '‾', true, 'overline'], + ['¤', '¤', true, 'currency sign'], + ['¦', '¦', true, 'broken bar'], + ['¨', '¨', true, 'diaeresis'], + ['¡', '¡', true, 'inverted exclamation mark'], + ['¿', '¿', true, 'turned question mark'], + ['ˆ', 'ˆ', true, 'circumflex accent'], + ['˜', '˜', true, 'small tilde'], + ['°', '°', true, 'degree sign'], + ['−', '−', true, 'minus sign'], + ['±', '±', true, 'plus-minus sign'], + ['÷', '÷', true, 'division sign'], + ['⁄', '⁄', true, 'fraction slash'], + ['×', '×', true, 'multiplication sign'], + ['¹', '¹', true, 'superscript one'], + ['²', '²', true, 'superscript two'], + ['³', '³', true, 'superscript three'], + ['¼', '¼', true, 'fraction one quarter'], + ['½', '½', true, 'fraction one half'], + ['¾', '¾', true, 'fraction three quarters'], +// math / logical + ['ƒ', 'ƒ', true, 'function / florin'], + ['∫', '∫', true, 'integral'], + ['∑', '∑', true, 'n-ary sumation'], + ['∞', '∞', true, 'infinity'], + ['√', '√', true, 'square root'], + ['∼', '∼', false,'similar to'], + ['≅', '≅', false,'approximately equal to'], + ['≈', '≈', true, 'almost equal to'], + ['≠', '≠', true, 'not equal to'], + ['≡', '≡', true, 'identical to'], + ['∈', '∈', false,'element of'], + ['∉', '∉', false,'not an element of'], + ['∋', '∋', false,'contains as member'], + ['∏', '∏', true, 'n-ary product'], + ['∧', '∧', false,'logical and'], + ['∨', '∨', false,'logical or'], + ['¬', '¬', true, 'not sign'], + ['∩', '∩', true, 'intersection'], + ['∪', '∪', false,'union'], + ['∂', '∂', true, 'partial differential'], + ['∀', '∀', false,'for all'], + ['∃', '∃', false,'there exists'], + ['∅', '∅', false,'diameter'], + ['∇', '∇', false,'backward difference'], + ['∗', '∗', false,'asterisk operator'], + ['∝', '∝', false,'proportional to'], + ['∠', '∠', false,'angle'], +// undefined + ['´', '´', true, 'acute accent'], + ['¸', '¸', true, 'cedilla'], + ['ª', 'ª', true, 'feminine ordinal indicator'], + ['º', 'º', true, 'masculine ordinal indicator'], + ['†', '†', true, 'dagger'], + ['‡', '‡', true, 'double dagger'], +// alphabetical special chars + ['À', 'À', true, 'A - grave'], + ['Á', 'Á', true, 'A - acute'], + ['Â', 'Â', true, 'A - circumflex'], + ['Ã', 'Ã', true, 'A - tilde'], + ['Ä', 'Ä', true, 'A - diaeresis'], + ['Å', 'Å', true, 'A - ring above'], + ['Æ', 'Æ', true, 'ligature AE'], + ['Ç', 'Ç', true, 'C - cedilla'], + ['È', 'È', true, 'E - grave'], + ['É', 'É', true, 'E - acute'], + ['Ê', 'Ê', true, 'E - circumflex'], + ['Ë', 'Ë', true, 'E - diaeresis'], + ['Ì', 'Ì', true, 'I - grave'], + ['Í', 'Í', true, 'I - acute'], + ['Î', 'Î', true, 'I - circumflex'], + ['Ï', 'Ï', true, 'I - diaeresis'], + ['Ð', 'Ð', true, 'ETH'], + ['Ñ', 'Ñ', true, 'N - tilde'], + ['Ò', 'Ò', true, 'O - grave'], + ['Ó', 'Ó', true, 'O - acute'], + ['Ô', 'Ô', true, 'O - circumflex'], + ['Õ', 'Õ', true, 'O - tilde'], + ['Ö', 'Ö', true, 'O - diaeresis'], + ['Ø', 'Ø', true, 'O - slash'], + ['Œ', 'Œ', true, 'ligature OE'], + ['Š', 'Š', true, 'S - caron'], + ['Ù', 'Ù', true, 'U - grave'], + ['Ú', 'Ú', true, 'U - acute'], + ['Û', 'Û', true, 'U - circumflex'], + ['Ü', 'Ü', true, 'U - diaeresis'], + ['Ý', 'Ý', true, 'Y - acute'], + ['Ÿ', 'Ÿ', true, 'Y - diaeresis'], + ['Þ', 'Þ', true, 'THORN'], + ['à', 'à', true, 'a - grave'], + ['á', 'á', true, 'a - acute'], + ['â', 'â', true, 'a - circumflex'], + ['ã', 'ã', true, 'a - tilde'], + ['ä', 'ä', true, 'a - diaeresis'], + ['å', 'å', true, 'a - ring above'], + ['æ', 'æ', true, 'ligature ae'], + ['ç', 'ç', true, 'c - cedilla'], + ['è', 'è', true, 'e - grave'], + ['é', 'é', true, 'e - acute'], + ['ê', 'ê', true, 'e - circumflex'], + ['ë', 'ë', true, 'e - diaeresis'], + ['ì', 'ì', true, 'i - grave'], + ['í', 'í', true, 'i - acute'], + ['î', 'î', true, 'i - circumflex'], + ['ï', 'ï', true, 'i - diaeresis'], + ['ð', 'ð', true, 'eth'], + ['ñ', 'ñ', true, 'n - tilde'], + ['ò', 'ò', true, 'o - grave'], + ['ó', 'ó', true, 'o - acute'], + ['ô', 'ô', true, 'o - circumflex'], + ['õ', 'õ', true, 'o - tilde'], + ['ö', 'ö', true, 'o - diaeresis'], + ['ø', 'ø', true, 'o slash'], + ['œ', 'œ', true, 'ligature oe'], + ['š', 'š', true, 's - caron'], + ['ù', 'ù', true, 'u - grave'], + ['ú', 'ú', true, 'u - acute'], + ['û', 'û', true, 'u - circumflex'], + ['ü', 'ü', true, 'u - diaeresis'], + ['ý', 'ý', true, 'y - acute'], + ['þ', 'þ', true, 'thorn'], + ['ÿ', 'ÿ', true, 'y - diaeresis'], + ['Α', 'Α', true, 'Alpha'], + ['Β', 'Β', true, 'Beta'], + ['Γ', 'Γ', true, 'Gamma'], + ['Δ', 'Δ', true, 'Delta'], + ['Ε', 'Ε', true, 'Epsilon'], + ['Ζ', 'Ζ', true, 'Zeta'], + ['Η', 'Η', true, 'Eta'], + ['Θ', 'Θ', true, 'Theta'], + ['Ι', 'Ι', true, 'Iota'], + ['Κ', 'Κ', true, 'Kappa'], + ['Λ', 'Λ', true, 'Lambda'], + ['Μ', 'Μ', true, 'Mu'], + ['Ν', 'Ν', true, 'Nu'], + ['Ξ', 'Ξ', true, 'Xi'], + ['Ο', 'Ο', true, 'Omicron'], + ['Π', 'Π', true, 'Pi'], + ['Ρ', 'Ρ', true, 'Rho'], + ['Σ', 'Σ', true, 'Sigma'], + ['Τ', 'Τ', true, 'Tau'], + ['Υ', 'Υ', true, 'Upsilon'], + ['Φ', 'Φ', true, 'Phi'], + ['Χ', 'Χ', true, 'Chi'], + ['Ψ', 'Ψ', true, 'Psi'], + ['Ω', 'Ω', true, 'Omega'], + ['α', 'α', true, 'alpha'], + ['β', 'β', true, 'beta'], + ['γ', 'γ', true, 'gamma'], + ['δ', 'δ', true, 'delta'], + ['ε', 'ε', true, 'epsilon'], + ['ζ', 'ζ', true, 'zeta'], + ['η', 'η', true, 'eta'], + ['θ', 'θ', true, 'theta'], + ['ι', 'ι', true, 'iota'], + ['κ', 'κ', true, 'kappa'], + ['λ', 'λ', true, 'lambda'], + ['μ', 'μ', true, 'mu'], + ['ν', 'ν', true, 'nu'], + ['ξ', 'ξ', true, 'xi'], + ['ο', 'ο', true, 'omicron'], + ['π', 'π', true, 'pi'], + ['ρ', 'ρ', true, 'rho'], + ['ς', 'ς', true, 'final sigma'], + ['σ', 'σ', true, 'sigma'], + ['τ', 'τ', true, 'tau'], + ['υ', 'υ', true, 'upsilon'], + ['φ', 'φ', true, 'phi'], + ['χ', 'χ', true, 'chi'], + ['ψ', 'ψ', true, 'psi'], + ['ω', 'ω', true, 'omega'], +// symbols + ['ℵ', 'ℵ', false,'alef symbol'], + ['ϖ', 'ϖ', false,'pi symbol'], + ['ℜ', 'ℜ', false,'real part symbol'], + ['ϑ','ϑ', false,'theta symbol'], + ['ϒ', 'ϒ', false,'upsilon - hook symbol'], + ['℘', '℘', false,'Weierstrass p'], + ['ℑ', 'ℑ', false,'imaginary part'], +// arrows + ['←', '←', true, 'leftwards arrow'], + ['↑', '↑', true, 'upwards arrow'], + ['→', '→', true, 'rightwards arrow'], + ['↓', '↓', true, 'downwards arrow'], + ['↔', '↔', true, 'left right arrow'], + ['↵', '↵', false,'carriage return'], + ['⇐', '⇐', false,'leftwards double arrow'], + ['⇑', '⇑', false,'upwards double arrow'], + ['⇒', '⇒', false,'rightwards double arrow'], + ['⇓', '⇓', false,'downwards double arrow'], + ['⇔', '⇔', false,'left right double arrow'], + ['∴', '∴', false,'therefore'], + ['⊂', '⊂', false,'subset of'], + ['⊃', '⊃', false,'superset of'], + ['⊄', '⊄', false,'not a subset of'], + ['⊆', '⊆', false,'subset of or equal to'], + ['⊇', '⊇', false,'superset of or equal to'], + ['⊕', '⊕', false,'circled plus'], + ['⊗', '⊗', false,'circled times'], + ['⊥', '⊥', false,'perpendicular'], + ['⋅', '⋅', false,'dot operator'], + ['⌈', '⌈', false,'left ceiling'], + ['⌉', '⌉', false,'right ceiling'], + ['⌊', '⌊', false,'left floor'], + ['⌋', '⌋', false,'right floor'], + ['⟨', '〈', false,'left-pointing angle bracket'], + ['⟩', '〉', false,'right-pointing angle bracket'], + ['◊', '◊', true,'lozenge'], + ['♠', '♠', false,'black spade suit'], + ['♣', '♣', true, 'black club suit'], + ['♥', '♥', true, 'black heart suit'], + ['♦', '♦', true, 'black diamond suit'], + [' ', ' ', false,'en space'], + [' ', ' ', false,'em space'], + [' ', ' ', false,'thin space'], + ['‌', '‌', false,'zero width non-joiner'], + ['‍', '‍', false,'zero width joiner'], + ['‎', '‎', false,'left-to-right mark'], + ['‏', '‏', false,'right-to-left mark'], + ['­', '­', false,'soft hyphen'] +]; + +tinyMCEPopup.onInit.add(function() { + tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML()); +}); + +function renderCharMapHTML() { + var charsPerRow = 20, tdWidth=20, tdHeight=20, i; + var html = ''; + var cols=-1; + + for (i=0; i' + + '' + + charmap[i][1] + + ''; + if ((cols+1) % charsPerRow == 0) + html += ''; + } + } + + if (cols % charsPerRow > 0) { + var padd = charsPerRow - (cols % charsPerRow); + for (var i=0; i '; + } + + html += '
'; + + return html; +} + +function insertChar(chr) { + tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';'); + + // Refocus in window + if (tinyMCEPopup.isWindow) + window.focus(); + + tinyMCEPopup.editor.focus(); + tinyMCEPopup.close(); +} + +function previewChar(codeA, codeB, codeN) { + var elmA = document.getElementById('codeA'); + var elmB = document.getElementById('codeB'); + var elmV = document.getElementById('codeV'); + var elmN = document.getElementById('codeN'); + + if (codeA=='#160;') { + elmV.innerHTML = '__'; + } else { + elmV.innerHTML = '&' + codeA; + } + + elmB.innerHTML = '&' + codeA; + elmA.innerHTML = '&' + codeB; + elmN.innerHTML = codeN; +} diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/color_picker.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/color_picker.js new file mode 100644 index 0000000..c1a65db --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/color_picker.js @@ -0,0 +1,253 @@ +tinyMCEPopup.requireLangPack(); + +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; + +var colors = [ + "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", + "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", + "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", + "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033", + "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399", + "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff", + "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333", + "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399", + "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff", + "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633", + "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699", + "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff", + "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633", + "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999", + "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff", + "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933", + "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999", + "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff", + "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33", + "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99", + "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff", + "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33", + "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99", + "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff", + "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", + "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", + "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" +]; + +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')); + + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func'); + + tinyMCEPopup.restoreSelection(); + + if (f) + f(color); + + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color.toLowerCase(); +} + +function convertRGBToHex(col) { + var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + + if (!col) + return col; + + var rgb = col.replace(re, "$1,$2,$3").split(','); + if (rgb.length == 3) { + r = parseInt(rgb[0]).toString(16); + g = parseInt(rgb[1]).toString(16); + b = parseInt(rgb[2]).toString(16); + + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; + + return "#" + r + g + b; + } + + return col; +} + +function convertHexToRGB(col) { + if (col.indexOf('#') != -1) { + col = col.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + + r = parseInt(col.substring(0, 2), 16); + g = parseInt(col.substring(2, 4), 16); + b = parseInt(col.substring(4, 6), 16); + + return {r : r, g : g, b : b}; + } + + return null; +} + +function generatePicker() { + var el = document.getElementById('light'), h = '', i; + + for (i = 0; i < detail; i++){ + h += '
'; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '' + + ''; + + for (i=0; i' + + '' + + ''; + if ((i+1) % 18 == 0) + h += ''; + } + + h += '
'; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colors').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colors').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image'); + if (isVisible('srcbrowser')) + document.getElementById('src').style.width = '180px'; + + e = ed.selection.getNode(); + + this.fillFileList('image_list', 'tinyMCEImageList'); + + if (e.nodeName == 'IMG') { + f.src.value = ed.dom.getAttrib(e, 'src'); + f.alt.value = ed.dom.getAttrib(e, 'alt'); + f.border.value = this.getAttrib(e, 'border'); + f.vspace.value = this.getAttrib(e, 'vspace'); + f.hspace.value = this.getAttrib(e, 'hspace'); + f.width.value = ed.dom.getAttrib(e, 'width'); + f.height.value = ed.dom.getAttrib(e, 'height'); + f.insert.value = ed.getLang('update'); + this.styleVal = ed.dom.getAttrib(e, 'style'); + selectByValue(f, 'image_list', f.src.value); + selectByValue(f, 'align', this.getAttrib(e, 'align')); + this.updateStyle(); + } + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + update : function() { + var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el; + + tinyMCEPopup.restoreSelection(); + + if (f.src.value === '') { + if (ed.selection.getNode().nodeName == 'IMG') { + ed.dom.remove(ed.selection.getNode()); + ed.execCommand('mceRepaint'); + } + + tinyMCEPopup.close(); + return; + } + + if (!ed.settings.inline_styles) { + args = tinymce.extend(args, { + vspace : nl.vspace.value, + hspace : nl.hspace.value, + border : nl.border.value, + align : getSelectValue(f, 'align') + }); + } else + args.style = this.styleVal; + + tinymce.extend(args, { + src : f.src.value, + alt : f.alt.value, + width : f.width.value, + height : f.height.value + }); + + el = ed.selection.getNode(); + + if (el && el.nodeName == 'IMG') { + ed.dom.setAttribs(el, args); + } else { + ed.execCommand('mceInsertContent', false, '', {skip_undo : 1}); + ed.dom.setAttribs('__mce_tmp', args); + ed.dom.setAttrib('__mce_tmp', 'id', ''); + ed.undoManager.add(); + } + + tinyMCEPopup.close(); + }, + + updateStyle : function() { + var dom = tinyMCEPopup.dom, st, v, f = document.forms[0]; + + if (tinyMCEPopup.editor.settings.inline_styles) { + st = tinyMCEPopup.dom.parseStyle(this.styleVal); + + // Handle align + v = getSelectValue(f, 'align'); + if (v) { + if (v == 'left' || v == 'right') { + st['float'] = v; + delete st['vertical-align']; + } else { + st['vertical-align'] = v; + delete st['float']; + } + } else { + delete st['float']; + delete st['vertical-align']; + } + + // Handle border + v = f.border.value; + if (v || v == '0') { + if (v == '0') + st['border'] = '0'; + else + st['border'] = v + 'px solid black'; + } else + delete st['border']; + + // Handle hspace + v = f.hspace.value; + if (v) { + delete st['margin']; + st['margin-left'] = v + 'px'; + st['margin-right'] = v + 'px'; + } else { + delete st['margin-left']; + delete st['margin-right']; + } + + // Handle vspace + v = f.vspace.value; + if (v) { + delete st['margin']; + st['margin-top'] = v + 'px'; + st['margin-bottom'] = v + 'px'; + } else { + delete st['margin-top']; + delete st['margin-bottom']; + } + + // Merge + st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st)); + this.styleVal = dom.serializeStyle(st); + } + }, + + getAttrib : function(e, at) { + var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2; + + if (ed.settings.inline_styles) { + switch (at) { + case 'align': + if (v = dom.getStyle(e, 'float')) + return v; + + if (v = dom.getStyle(e, 'vertical-align')) + return v; + + break; + + case 'hspace': + v = dom.getStyle(e, 'margin-left') + v2 = dom.getStyle(e, 'margin-right'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'vspace': + v = dom.getStyle(e, 'margin-top') + v2 = dom.getStyle(e, 'margin-bottom'); + if (v && v == v2) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + + case 'border': + v = 0; + + tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) { + sv = dom.getStyle(e, 'border-' + sv + '-width'); + + // False or not the same as prev + if (!sv || (sv != v && v !== 0)) { + v = 0; + return false; + } + + if (sv) + v = sv; + }); + + if (v) + return parseInt(v.replace(/[^0-9]/g, '')); + + break; + } + } + + if (v = dom.getAttrib(e, at)) + return v; + + return ''; + }, + + resetImageData : function() { + var f = document.forms[0]; + + f.width.value = f.height.value = ""; + }, + + updateImageData : function() { + var f = document.forms[0], t = ImageDialog; + + if (f.width.value == "") + f.width.value = t.preloadImg.width; + + if (f.height.value == "") + f.height.value = t.preloadImg.height; + }, + + getImageData : function() { + var f = document.forms[0]; + + this.preloadImg = new Image(); + this.preloadImg.onload = this.updateImageData; + this.preloadImg.onerror = this.resetImageData; + this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value); + } +}; + +ImageDialog.preInit(); +tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/link.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/link.js new file mode 100644 index 0000000..c8cb642 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/link.js @@ -0,0 +1,155 @@ +tinyMCEPopup.requireLangPack(); + +var LinkDialog = { + preInit : function() { + var url; + + if (url = tinyMCEPopup.getParam("external_link_list_url")) + document.write(''); + }, + + init : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor; + + // Setup browse button + document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link'); + if (isVisible('hrefbrowser')) + document.getElementById('href').style.width = '180px'; + + this.fillClassList('class_list'); + this.fillFileList('link_list', 'tinyMCELinkList'); + this.fillTargetList('target_list'); + + if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) { + f.href.value = ed.dom.getAttrib(e, 'href'); + f.linktitle.value = ed.dom.getAttrib(e, 'title'); + f.insert.value = ed.getLang('update'); + selectByValue(f, 'link_list', f.href.value); + selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target')); + selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class')); + } + }, + + update : function() { + var f = document.forms[0], ed = tinyMCEPopup.editor, e, b; + + tinyMCEPopup.restoreSelection(); + e = ed.dom.getParent(ed.selection.getNode(), 'A'); + + // Remove element if there is no href + if (!f.href.value) { + if (e) { + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + b = ed.selection.getBookmark(); + ed.dom.remove(e, 1); + ed.selection.moveToBookmark(b); + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + return; + } + } + + tinyMCEPopup.execCommand("mceBeginUndoLevel"); + + // Create new anchor elements + if (e == null) { + tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); + + tinymce.each(ed.dom.select("a"), function(n) { + if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { + e = n; + + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + }); + } else { + ed.dom.setAttribs(e, { + href : f.href.value, + title : f.linktitle.value, + target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null, + 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null + }); + } + + // Don't move caret if selection was image + if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { + ed.focus(); + ed.selection.select(e); + ed.selection.collapse(0); + tinyMCEPopup.storeSelection(); + } + + tinyMCEPopup.execCommand("mceEndUndoLevel"); + tinyMCEPopup.close(); + }, + + checkPrefix : function(n) { + if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external'))) + n.value = 'http://' + n.value; + }, + + fillFileList : function(id, l) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + l = window[l]; + + if (l && l.length > 0) { + lst.options[lst.options.length] = new Option('', ''); + + tinymce.each(l, function(o) { + lst.options[lst.options.length] = new Option(o[0], o[1]); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillClassList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; + + if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { + cl = []; + + tinymce.each(v.split(';'), function(v) { + var p = v.split('='); + + cl.push({'title' : p[0], 'class' : p[1]}); + }); + } else + cl = tinyMCEPopup.editor.dom.getClasses(); + + if (cl.length > 0) { + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + + tinymce.each(cl, function(o) { + lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); + }); + } else + dom.remove(dom.getParent(id, 'tr')); + }, + + fillTargetList : function(id) { + var dom = tinyMCEPopup.dom, lst = dom.get(id), v; + + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); + lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); + + if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { + tinymce.each(v.split(','), function(v) { + v = v.split('='); + lst.options[lst.options.length] = new Option(v[0], v[1]); + }); + } + } +}; + +LinkDialog.preInit(); +tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog); diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/source_editor.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/source_editor.js new file mode 100644 index 0000000..a6235a3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/js/source_editor.js @@ -0,0 +1,62 @@ +tinyMCEPopup.requireLangPack(); +tinyMCEPopup.onInit.add(onLoadInit); + +function saveContent() { + tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value); + tinyMCEPopup.close(); +} + +function onLoadInit() { + tinyMCEPopup.resizeToInnerSize(); + + // Remove Gecko spellchecking + if (tinymce.isGecko) + document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); + + document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent(); + + if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { + setWrap('soft'); + document.getElementById('wraped').checked = true; + } + + resizeInputs(); +} + +function setWrap(val) { + var v, n, s = document.getElementById('htmlSource'); + + s.wrap = val; + + if (!tinymce.isIE) { + v = s.value; + n = s.cloneNode(false); + n.setAttribute("wrap", val); + s.parentNode.replaceChild(n, s); + n.value = v; + } +} + +function toggleWordWrap(elm) { + if (elm.checked) + setWrap('soft'); + else + setWrap('off'); +} + +var wHeight=0, wWidth=0, owHeight=0, owWidth=0; + +function resizeInputs() { + var el = document.getElementById('htmlSource'); + + if (!tinymce.isIE) { + wHeight = self.innerHeight - 65; + wWidth = self.innerWidth - 16; + } else { + wHeight = document.body.clientHeight - 70; + wWidth = document.body.clientWidth - 16; + } + + el.style.height = Math.abs(wHeight) + 'px'; + el.style.width = Math.abs(wWidth) + 'px'; +} diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en.js new file mode 100644 index 0000000..52989e3 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en.js @@ -0,0 +1,62 @@ +tinyMCE.addI18n('en.advanced',{ +style_select:"Styles", +font_size:"Font size", +fontdefault:"Font family", +block:"Format", +paragraph:"Paragraph", +div:"Div", +address:"Address", +pre:"Preformatted", +h1:"Heading 1", +h2:"Heading 2", +h3:"Heading 3", +h4:"Heading 4", +h5:"Heading 5", +h6:"Heading 6", +blockquote:"Blockquote", +code:"Code", +samp:"Code sample", +dt:"Definition term ", +dd:"Definition description", +bold_desc:"Bold (Ctrl+B)", +italic_desc:"Italic (Ctrl+I)", +underline_desc:"Underline (Ctrl+U)", +striketrough_desc:"Strikethrough", +justifyleft_desc:"Align left", +justifycenter_desc:"Align center", +justifyright_desc:"Align right", +justifyfull_desc:"Align full", +bullist_desc:"Unordered list", +numlist_desc:"Ordered list", +outdent_desc:"Outdent", +indent_desc:"Indent", +undo_desc:"Undo (Ctrl+Z)", +redo_desc:"Redo (Ctrl+Y)", +link_desc:"Insert/edit link", +unlink_desc:"Unlink", +image_desc:"Insert/edit image", +cleanup_desc:"Cleanup messy code", +code_desc:"Edit HTML Source", +sub_desc:"Subscript", +sup_desc:"Superscript", +hr_desc:"Insert horizontal ruler", +removeformat_desc:"Remove formatting", +custom1_desc:"Your custom description here", +forecolor_desc:"Select text color", +backcolor_desc:"Select background color", +charmap_desc:"Insert custom character", +visualaid_desc:"Toggle guidelines/invisible elements", +anchor_desc:"Insert/edit anchor", +cut_desc:"Cut", +copy_desc:"Copy", +paste_desc:"Paste", +image_props_desc:"Image properties", +newdocument_desc:"New document", +help_desc:"Help", +blockquote_desc:"Blockquote", +clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?", +path:"Path", +newdocument:"Are you sure you want clear all contents?", +toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X", +more_colors:"More colors" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en_dlg.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en_dlg.js new file mode 100644 index 0000000..80e4941 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/langs/en_dlg.js @@ -0,0 +1,51 @@ +tinyMCE.addI18n('en.advanced_dlg',{ +about_title:"About TinyMCE", +about_general:"About", +about_help:"Help", +about_license:"License", +about_plugins:"Plugins", +about_plugin:"Plugin", +about_author:"Author", +about_version:"Version", +about_loaded:"Loaded plugins", +anchor_title:"Insert/edit anchor", +anchor_name:"Anchor name", +code_title:"HTML Source Editor", +code_wordwrap:"Word wrap", +colorpicker_title:"Select a color", +colorpicker_picker_tab:"Picker", +colorpicker_picker_title:"Color picker", +colorpicker_palette_tab:"Palette", +colorpicker_palette_title:"Palette colors", +colorpicker_named_tab:"Named", +colorpicker_named_title:"Named colors", +colorpicker_color:"Color:", +colorpicker_name:"Name:", +charmap_title:"Select custom character", +image_title:"Insert/edit image", +image_src:"Image URL", +image_alt:"Image description", +image_list:"Image list", +image_border:"Border", +image_dimensions:"Dimensions", +image_vspace:"Vertical space", +image_hspace:"Horizontal space", +image_align:"Alignment", +image_align_baseline:"Baseline", +image_align_top:"Top", +image_align_middle:"Middle", +image_align_bottom:"Bottom", +image_align_texttop:"Text top", +image_align_textbottom:"Text bottom", +image_align_left:"Left", +image_align_right:"Right", +link_title:"Insert/edit link", +link_url:"Link URL", +link_target:"Target", +link_target_same:"Open link in the same window", +link_target_blank:"Open link in a new window", +link_titlefield:"Title", +link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?", +link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?", +link_list:"Link list" +}); \ No newline at end of file diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/link.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/link.htm new file mode 100644 index 0000000..b647eed --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/link.htm @@ -0,0 +1,64 @@ + + + + {#advanced_dlg.link_title} + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
 
+
+
+ +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png new file mode 100644 index 0000000..7dd5841 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/buttons.png differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif new file mode 100644 index 0000000..2eafd79 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/items.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif new file mode 100644 index 0000000..85e31df Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_arrow.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif new file mode 100644 index 0000000..adfdddc Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/menu_check.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif new file mode 100644 index 0000000..5bb90fd Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/progress.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif new file mode 100644 index 0000000..ce4be63 Binary files /dev/null and b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/skins/default/img/tabs.gif differ diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/source_editor.htm b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/source_editor.htm new file mode 100644 index 0000000..5f047dc --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/themes/advanced/source_editor.htm @@ -0,0 +1,32 @@ + + + + {#advanced_dlg.code_title} + + + + + +
+
{#advanced_dlg.code_title}
+ +
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+
+
+ + diff --git a/site/slowtwitch.com/www/articles/static/fileman/tinymce/tiny_mce.js b/site/slowtwitch.com/www/articles/static/fileman/tinymce/tiny_mce.js new file mode 100644 index 0000000..72087e8 --- /dev/null +++ b/site/slowtwitch.com/www/articles/static/fileman/tinymce/tiny_mce.js @@ -0,0 +1 @@ +var tinymce={majorVersion:'3',minorVersion:'1.0.1',releaseDate:'2008-06-18',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base,p,v;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;t.query=tinyMCEPreInit.query;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i=items.length){for(i=0;i=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv="";if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:if(isIE&&n==='name'&&e.nodeName==='A'){v=e.name;break;}v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'tabindex':if(v===32768)v='';break;case'maxlength':if(v===2147483647)v='';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='
'+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='
'+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/

<\/p>|]+)><\/p>|/gi,' 

');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/]+)>|

/g,'');h=h.replace(/<\/p>/g,'');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x|]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/'/g,''');h=h.replace(/]+)\/>|/gi,'');if(s.keep_values){if(/|\/\/\s*-->|\]\]>|-->)\s*$/g,'');return s;};h=h.replace(/]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='';return''+b+'';});h=h.replace(/]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return''+b+'';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'<':return'<';case'>':return'>';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='';if(tinymce.relaxedDomain){if(isIE)u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('','g'),'');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'
');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='

'+o.content+'
';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(

( | |\s|\u00a0|)<\/p>[\r\n]*|
[\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'
');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'']);t.addShortcut('ctrl+7','',['FormatBlock',false,'

']);t.addShortcut('ctrl+8','',['FormatBlock',false,'

']);t.addShortcut('ctrl+9','',['FormatBlock',false,'
']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('
');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'

'):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index','gi');t.rePadd=new RegExp(']+)><\\\/p>|]+)\\\/>|]+)>\\s+<\\\/p>|

<\\\/p>||

\\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp(']+)>[\\s\\u00a0]+<\\\/p>|

[\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp(']+)>( | )<\\\/p>|

( | )<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp(']+)>\\s*
\\s*<\\\/p>|

\\s*
\\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*
\\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2>
');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2>
');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0');o.content=o.content.replace(t.reTrailBr,'');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('
',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'
');aft=ed.dom.add(sn,se.element,null,'
');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='
';if(isEmpty(aft))aft.innerHTML=isOpera?' ':'
';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(yvp.y+vp.h){ed.getWin().scrollTo(0,y'); + tinymce.ScriptLoader.markDone(u); + } + } + }, + + pickColor : function(e, element_id) { + this.execCommand('mceColorPicker', true, { + color : document.getElementById(element_id).value, + func : function(c) { + document.getElementById(element_id).value = c; + + try { + document.getElementById(element_id).onchange(); + } catch (ex) { + // Try fire event, ignore errors + } + } + }); + }, + + openBrowser : function(element_id, type, option) { + tinyMCEPopup.restoreSelection(); + this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window); + }, + + close : function() { + var t = this; + + // To avoid domain relaxing issue in Opera + function close() { + t.editor.windowManager.close(window); + tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup + }; + + if (tinymce.isOpera) + t.getWin().setTimeout(close, 0); + else + close(); + }, + + // Internal functions + + _restoreSelection : function() { + var e = window.event.srcElement; + + if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) + tinyMCEPopup.restoreSelection(); + }, + +/* _restoreSelection : function() { + var e = window.event.srcElement; + + // If user focus a non text input or textarea + if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text') + tinyMCEPopup.restoreSelection(); + },*/ + + _onDOMLoaded : function() { + var t = this, ti = document.title, bm, h; + + // Translate page + h = document.body.innerHTML; + + // Replace a=x with a="x" in IE + if (tinymce.isIE) + h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') + + document.dir = t.editor.getParam('directionality',''); + document.body.innerHTML = t.editor.translate(h); + document.title = ti = t.editor.translate(ti); + document.body.style.display = ''; + + // Restore selection in IE when focus is placed on a non textarea or input element of the type text + if (tinymce.isIE) + document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); + + t.restoreSelection(); + t.resizeToInnerSize(); + + // Set inline title + if (!t.isWindow) + t.editor.windowManager.setTitle(window, ti); + else + window.focus(); + + if (!tinymce.isIE && !t.isWindow) { + tinymce.dom.Event._add(document, 'focus', function() { + t.editor.windowManager.focus(t.id) + }); + } + + // Patch for accessibility + tinymce.each(t.dom.select('select'), function(e) { + e.onkeydown = tinyMCEPopup._accessHandler; + }); + + // Call onInit + // Init must be called before focus so the selection won't get lost by the focus call + tinymce.each(t.listeners, function(o) { + o.func.call(o.scope, t.editor); + }); + + // Move focus to window + if (t.getWindowArg('mce_auto_focus', true)) { + window.focus(); + + // Focus element with mceFocus class + tinymce.each(document.forms, function(f) { + tinymce.each(f.elements, function(e) { + if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) { + e.focus(); + return false; // Break loop + } + }); + }); + } + + document.onkeyup = tinyMCEPopup._closeWinKeyHandler; + }, + + _accessHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 13 || e.keyCode == 32) { + e = e.target || e.srcElement; + + if (e.onchange) + e.onchange(); + + return tinymce.dom.Event.cancel(e); + } + }, + + _closeWinKeyHandler : function(e) { + e = e || window.event; + + if (e.keyCode == 27) + tinyMCEPopup.close(); + }, + + _wait : function() { + var t = this, ti; + + if (tinymce.isIE && document.location.protocol != 'https:') { + // Fake DOMContentLoaded on IE + document.write('