code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
form { border: 1px red dotted; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/iframe.css
CSS
art
32
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Author: Maarten Molenschot, maarten@nrgmm.nl { "Insert a Form.": "Formulier invoegen", "Insert a text, password or hidden field.": "Tekst, wachtwoord of verborgen veld invoegen", "Insert a multi-line text field.": "Een tekstveld met meerdere lijnen invoegen", "Insert a select field.": "Een selectielijst invoegen", "Insert a check box.": "Een checkbox invoegen", "Insert a radio button.": "Een radio knop invoegen", "Insert a submit/reset button.": "Een verzend/wis knop invoegen" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/nl.js
JavaScript
art
561
// I18N constants // LANG: "de", ENCODING: UTF-8 // translated: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de { "Insert a Form.": "Email Form einfügen.", "Insert a text, password or hidden field.": "Passwort oder unsichtbares Feld einfügen.", "Insert a multi-line text field.": "Mehrzeiliges Textfeld einfügen.", "Insert a select field.": "Auswahlfeld einfügen.", "Insert a check box.": "Häkchenfeld einfügen", "Insert a radio button.": "Optionsfeld einfügen", "Insert a submit/reset button.": "Senden/zurücksetzen Schaltfläche" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/de.js
JavaScript
art
591
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Insert a Form.": "Insérer un formulaire", "Insert a text, password or hidden field.": "Insérer un texte, un mot de passe ou un champ invisible", "Insert a multi-line text field.": "Insérer un champ texte à lignes multiples", "Insert a select field.": "Insérer une boite de sélection", "Insert a check box.": "Insérer une case à cocher", "Insert a radio button.": "Insérer un bouton radio", "Insert a submit/reset button.": "Insérer un bouton de soumission/annulation" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/fr.js
JavaScript
art
546
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Insert a Form.": "フォームを挿入", "Insert a text, password or hidden field.": "テキスト/パスワード/非表示フィールドを挿入", "Insert a multi-line text field.": "複数行テキストフィールドを挿入", "Insert a select field.": "選択リストを挿入", "Insert a check box.": "チェックボックスを挿入", "Insert a radio button.": "ラジオボタンを挿入", "Insert a submit/reset button.": "送信/リセットボタンを挿入", "Form Editor": "フォームエディタ", "Form": "フォーム", "Text Field": "テキストフィールド", "Check Box/Radio Button": "チェックボックス/ラジオボタン", "Button": "ボタン", "Multi-line Field": "複数行フィールド", "Drop-Down/List Field": "ドロップダウン/リスト", "Action:": "アクション:", "Method:": "メソッド:", "Name:": "名前:", "Type:": "タイプ:", "Label:": "ラベル:", "Value:": "値:", "Width:": "幅:", "Height:": "高さ:", "Initial Value:": "初期値:", "Initial Value": "初期値", "Max Length:": "最大長:", "Selected by default:": "デフォルト選択:", "May Choose Multiple:": "複数選択可能:", "Options": "選択肢", "POST": "POST", "GET": "GET", 'Check Box ("Select Many")': "チェックボックス(複数選択)", 'Radio Button ("Select One")': "ラジオボタン(単一選択)", "normal text field": "標準テキストフィールド", "password": "パスワード", "hidden field": "非表示フィールド", "Submit": "送信", "Reset": "リセット", "chars": "文字", "px": "ピクセル", "%": "%", "items": "項目", "Add": "追加", "Delete": "削除", "Move Up": "上へ", "Move Down": "下へ", "Tip: Check boxes (select many) and radio buttons (select one only) that are choices for a single question should have the same Name to work correctly.": "ヒント:ひとつの質問について、複数のチェックボックス(複数選択)、または複数のラジオボタン(単一選択)がある場合、すべてに同じ名前を付けなければ正しく機能しません。", "Enter the name for new option.": "新しい選択肢に名前をつけてください。" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/ja.js
JavaScript
art
2,323
// I18N constants // LANG: "nb", ENCODING: UTF-8 // translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com { "Insert a Form.": "Sett inn skjema", "Insert a text, password or hidden field.": "Sett inn formfelt", "Insert a multi-line text field.": "Sett inn tekstfelt med flere linjer", "Insert a select field.": "Sett inn valgboks/ netrekksboks", "Insert a check box.": "Hakeboks", "Insert a radio button.": "Sett inn en radioknapp", "Insert a submit/reset button.": "Sett inn send-/nullstill knapp for skjemaet" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/nb.js
JavaScript
art
545
// I18N constants // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // Last revision: 05 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Enter the name for new option.": "Entre com o nome para nova opção", "Form Editor": "Editor de Formulários", "Insert a Form.": "Inserir um Formulário.", "Insert a check box.": "Inserir uma caixa de opção", "Insert a multi-line text field.": "Inserir um texto multi-linha.", "Insert a radio button.": "Inserir um campo de escolha", "Insert a select field.": "Inserir seleção.", "Insert a submit/reset button.": "Inserir um botão de envio/reset", "Insert a text, password or hidden field.": "Inserir um texto, senha ou campo escondido." }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/lang/pt_br.js
JavaScript
art
1,054
<div> <h1 id="[h1]"><l10n>Form Editor</l10n></h1> <fieldset id="[fs_form]"> <legend>Form</legend> <table> <tr> <th><label>Action:</label></th> <td><input type="text" size="25" name="[action]" id="[action]" /></td> <th><label>Method:</label></th> <td><select name="[method]" id="[method]"><option value="POST">POST</option><option value="GET">GET</option></select></td> </tr> </table> </fieldset> <fieldset id="[fs_text]"> <legend>Text Field</legend> <table> <tr> <th>Name:</th> <td> <input type="text" name="[text_name]" id="[text_name]" size="25" /> </td> <th>&nbsp;</th> <td>&nbsp;</td> </tr> <tr> <th>Type:</th> <td> <select name="[text_type]" id="[text_type]"> <option value="text">normal text field</option> <option value="password">password</option> <option value="hidden">hidden field</option> </select> </td> <th>Initial Value:</th> <td> <input type="text" name="[text_value]" id="[text_value]" size="25" /> </td> </tr> <tr> <th>Width:</th> <td> <input type="text" name="[text_width]" id="[text_width]" size="5" /> <select name="[text_width_units]" id="[text_width_units]"> <option value="em">chars</option> <option value="px">px</option > <option value="%">%</option> </select> </td> <th>Max Length:</th> <td> <input type="text" name="[text_maxlength]" id="[text_maxlength]" size="5" /> </td> </tr> </table> </fieldset> <fieldset id="[fs_cbrd]"> <legend>Check Box/Radio Button</legend> <table> <tr> <th>Name:</th> <td> <input type="text" name="[cbrd_name]" id="[cbrd_name]" size="25" /> </td> <th>Value:</th> <td> <input type="text" name="[cbrd_value]" id="[cbrd_value]" size="25" /> </td> </tr> <tr> <th>Type:</th> <td> <select name="[cbrd_type]" id="[cbrd_type]"> <option value="checkbox">Check Box ("Select Many")</option> <option value="radio">Radio Button ("Select One")</option> </select> </td> <th>Selected by default:</th> <td><input type="checkbox" name="[cbrd_checked]" id="[cbrd_checked]" value="1" /></td> </tr> <tr> <td colspan="4"> <p class="help"> Tip: Check boxes (select many) and radio buttons (select one only) that are choices for a single question should have the same Name to work correctly. </p> </td> </tr> </table> </fieldset> <fieldset id="[fs_button]"> <legend>Button</legend> <table> <tr> <th>Name:</th> <td> <input type="text" name="[button_name]" id="[button_name]" size="25" /> </td> <th>Label:</th> <td> <input type="text" name="[button_value]" id="[button_value]" size="25" /> </td> </tr> <tr> <th>Type:</th> <td> <select name="[button_type]" id="[button_type]"> <option value="submit">Submit</option> <option value="reset">Reset</option> </select> </td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </table> </fieldset> <fieldset id="[fs_textarea]"> <legend>Multi-line Field</legend> <table> <tr> <th>Name:</th> <td><input type="text" name="[textarea_name]" id="[textarea_name]" size="25" /></td> <th>Initial Value</th> </tr> <tr> <th>Width:</th> <td> <input type="text" name="[textarea_width]" id="[textarea_width]" size="5" /> <select name="[textarea_width_units]" id="[textarea_width_units]"> <option value="em">chars</option> <option value="px">px</option> <option value="%">%</option> </select> </td> <td rowspan="2"><textarea name="[textarea_value]" cols="40" rows="4" id="[textarea_value]"></textarea></td> </tr> <tr> <th>Height:</th> <td> <input type="text" name="[textarea_height]" id="[textarea_height]" size="5" /> <select name="[textarea_height_units]" id="[textarea_height_units]"> <option value="em">chars</option> <option value="px">px</option> </select> </td> </tr> </table> </fieldset> <fieldset id="[fs_select]"> <legend>Drop-Down/List Field</legend> <table> <tr> <th>Name:</th> <td> <input type="text" name="[select_name]" id="[select_name]" size="25" /> </td> <th colspan="2">Options</th> </tr> <tr> <th>May Choose Multiple:</th> <td> <input type="checkbox" name="[select_multiple]" id="[select_multiple]" size="25" value="1" /> </td> <td rowspan="3"> <select name="[select_options]" size="5" id="[select_options]" > </select> </td> <td rowspan="3"> <input name="button" type="button" id="[add_option]" value="Add" /> <br> <input name="button2" type="button" id="[del_option]" value="Delete" /> <br> <input name="button2" type="button" id="[up_option]" value="Move Up" /> <br> <input name="button2" type="button" id="[down_option]" value="Move Down" /> </td> </tr> <tr> <th>Width:</th> <td> <input type="text" name="[select_width]" id="[select_width]" size="5" /> <select name="[select_width_units]" id="[select_width_units]"> <option value="em">chars</option> <option value="px">px</option> <option value="%">%</option> </select> </td> </tr> <tr> <th>Height:</th> <td> <input type="text" name="[select_height]" id="[select_height]" size="5" /> <select name="[select_height_units]" id="[select_height_units]"> <option value="items">items</option> <option value="px">px</option> </select> </td> </tr> </table> </fieldset> </div>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/panel.html
HTML
art
6,257
/*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- -- FormOperations Plugin -- -- $HeadURL: http://svn.xinha.org/trunk/plugins/FormOperations/FormOperations.js $ -- $LastChangedDate: 2008-10-13 06:42:42 +1300 (Mon, 13 Oct 2008) $ -- $LastChangedRevision: 1084 $ -- $LastChangedBy: ray $ --------------------------------------------------------------------------*/ Xinha.Config.prototype.FormOperations = { // format for fields where multiple values may be selected // 'php' => FieldName[] // 'unmodified' => FieldName 'multiple_field_format': 'php', 'allow_edit_form' : false, 'default_form_action' : Xinha.getPluginDir('FormOperations') + '/formmail.php', 'default_form_html' : Xinha._geturlcontent(Xinha.getPluginDir('FormOperations') + '/default_form.html') }; FormOperations._pluginInfo = { name : "FormOperations", version : "1.0", developer: "James Sleeman", developer_url: "http://www.gogo.co.nz/", c_owner : "Gogo Internet Services", license : "htmlArea", sponsor : "Gogo Internet Services", sponsor_url : "http://www.gogo.co.nz/" }; function FormOperations(editor) { this.editor = editor; this.panel = false; this.html = false; this.ready = false; this.activeElement = null; this._preparePanel(); editor.config.pageStyleSheets.push(Xinha.getPluginDir('FormOperations') + '/iframe.css'); var toolbar = [ 'separator', 'insert_form', 'insert_text_field', 'insert_textarea_field', 'insert_select_field', 'insert_cb_field', 'insert_rb_field', 'insert_button' ]; this.editor.config.toolbar.push(toolbar); function pasteAndSelect(htmlTag) { var id = Xinha.uniq('fo'); htmlTag = htmlTag.replace(/^<([^ \/>]+)/i, '<$1 id="'+id+'"'); editor.insertHTML(htmlTag); var el = editor._doc.getElementById(id); el.setAttribute('id', ''); editor.selectNodeContents(el); editor.updateToolbar(); return el; } var buttonsImage = editor.imgURL('buttons.gif', 'FormOperations'); FormOperations.prototype._lc = function(string) { return Xinha._lc(string, 'FormOperations'); }; this.editor.config.btnList.insert_form = [ this._lc("Insert a Form."), [buttonsImage, 0, 0], false, function() { var form = null; if(editor.config.FormOperations.default_form_html) { form = pasteAndSelect(editor.config.FormOperations.default_form_html); } else { form = pasteAndSelect('<form>&nbsp;</form>'); } if(editor.config.FormOperations.default_form_action && !form.action) { form.action = editor.config.FormOperations.default_form_action; } } ]; this.editor.config.btnList.insert_text_field = [ this._lc("Insert a text, password or hidden field."), [buttonsImage, 1, 0], false, function() { pasteAndSelect('<input type="text" />'); }, 'form' ]; this.editor.config.btnList.insert_textarea_field = [ this._lc("Insert a multi-line text field."), [buttonsImage, 2, 0], false, function() { pasteAndSelect('<textarea> </textarea>'); }, 'form' ]; this.editor.config.btnList.insert_select_field = [ this._lc("Insert a select field."), [buttonsImage, 3, 0], false, function() { pasteAndSelect('<select> <option value="">Please Select...</option> </select>'); }, 'form' ]; this.editor.config.btnList.insert_cb_field = [ this._lc("Insert a check box."), [buttonsImage, 4, 0], false, function() { pasteAndSelect('<input type="checkbox" />'); }, 'form' ]; this.editor.config.btnList.insert_rb_field = [ this._lc("Insert a radio button."), [buttonsImage, 5, 0], false, function() { pasteAndSelect('<input type="radio" />'); }, 'form' ]; this.editor.config.btnList.insert_button = [ this._lc("Insert a submit/reset button."), [buttonsImage, 6, 0], false, function() { pasteAndSelect('<input type="submit" value="Send" />'); }, 'form' ]; } FormOperations.prototype.onGenerate = function() { // Gecko does not register click events on select lists inside the iframe // so the only way of detecting that is to do an event on mouse move. if( Xinha.is_gecko) { var editor = this.editor; var doc = this.editor._doc; Xinha._addEvents (doc, ["mousemove"], function (event) { return editor._editorEvent(event); }); } }; FormOperations.prototype._preparePanel = function () { var fo = this; if(this.html == false) { Xinha._getback(Xinha.getPluginDir('FormOperations') + '/panel.html', function(txt) { fo.html = txt; fo._preparePanel(); } ); return false; } if(typeof Xinha.Dialog == 'undefined') { Xinha._loadback (_editor_url + 'modules/Dialogs/XinhaDialog.js', function() { fo._preparePanel(); } ); return false; } if(typeof Xinha.PanelDialog == 'undefined') { Xinha._loadback (_editor_url + 'modules/Dialogs/panel-dialog.js', function() { fo._preparePanel(); } ); return false; } this.panel = new Xinha.PanelDialog(this.editor,'bottom',this.html,'FormOperations'); this.panel.hide(); this.ready = true; }; FormOperations.prototype.onUpdateToolbar = function() { if(!this.ready) return true; var activeElement = this.editor._activeElement(this.editor._getSelection()); if(activeElement != null) { if(activeElement == this.activeElement) return true; var tag = activeElement.tagName.toLowerCase(); this.hideAll(); if(tag === 'form') { if(this.editor.config.FormOperations.allow_edit_form) { this.showForm(activeElement); } else { this.panel.hide(); this.activeElement = null; this.panel.hide(); return true; } } else { if(this.editor.config.FormOperations.allow_edit_form && typeof activeElement.form != 'undefined' && activeElement.form) { this.showForm(activeElement.form); } switch(tag) { case 'form': { this.showForm(activeElement); } break; case 'input': { switch(activeElement.getAttribute('type').toLowerCase()) { case 'text' : case 'password': case 'hidden' : { this.showText(activeElement); } break; case 'radio' : case 'checkbox': { this.showCbRd(activeElement); } break; case 'submit' : case 'reset' : case 'button' : { this.showButton(activeElement); } break; } } break; case 'textarea': { this.showTextarea(activeElement); } break; case 'select': { this.showSelect(activeElement); } break; default: { this.activeElement = null; this.panel.hide(); return true; } } } this.panel.show(); //this.editor.scrollToElement(activeElement); this.activeElement = activeElement; return true; } else { this.activeElement = null; this.panel.hide(); return true; } }; FormOperations.prototype.hideAll = function() { this.panel.getElementById('fs_form').style.display = 'none'; this.panel.getElementById('fs_text').style.display = 'none'; this.panel.getElementById('fs_textarea').style.display = 'none'; this.panel.getElementById('fs_select').style.display = 'none'; this.panel.getElementById('fs_cbrd').style.display = 'none'; this.panel.getElementById('fs_button').style.display = 'none'; }; FormOperations.prototype.showForm = function(form) { this.panel.getElementById('fs_form').style.display = ''; var vals = { 'action' : form.action, 'method' : form.method.toUpperCase() } this.panel.setValues(vals); var f = form; this.panel.getElementById('action').onkeyup = function () { f.action = this.value; }; this.panel.getElementById('method').onchange = function () { f.method = this.options[this.selectedIndex].value; }; }; FormOperations.prototype.showText = function (input) { this.panel.getElementById('fs_text').style.display = ''; var vals = { 'text_name' : this.deformatName(input, input.name), 'text_value' : input.value, 'text_type' : input.type.toLowerCase(), 'text_width' : input.style.width ? parseFloat(input.style.width.replace(/[^0-9.]/, '')) : '', 'text_width_units': input.style.width ? input.style.width.replace(/[0-9.]/, '').toLowerCase() : 'ex', 'text_maxlength' : input.maxlength ? input.maxlength : '' } this.panel.setValues(vals); var i = input; var fo = this; this.panel.getElementById('text_name').onkeyup = function () { i.name = fo.formatName(i, this.value); } this.panel.getElementById('text_value').onkeyup = function () { i.value = this.value; } this.panel.getElementById('text_type').onchange = function () { if(!Xinha.is_ie) { i.type = this.options[this.selectedIndex].value; } else { // IE does not permit modifications of the type of a form field once it is set // We therefor have to destroy and recreate it. I swear, if I ever // meet any of the Internet Explorer development team I'm gonna // kick them in the nuts! var tmpContainer = fo.editor._doc.createElement('div'); if(!/type=/.test(i.outerHTML)) { tmpContainer.innerHTML = i.outerHTML.replace(/<INPUT/i, '<input type="'+ this.options[this.selectedIndex].value + '"'); } else { tmpContainer.innerHTML = i.outerHTML.replace(/type="?[a-z]+"?/i, 'type="' + this.options[this.selectedIndex].value + '"'); } var newElement = Xinha.removeFromParent(tmpContainer.childNodes[0]); i.parentNode.insertBefore(newElement, i); Xinha.removeFromParent(i); input = i = newElement; } } var w = this.panel.getElementById('text_width'); var wu = this.panel.getElementById('text_width_units'); this.panel.getElementById('text_width').onkeyup = this.panel.getElementById('text_width_units').onchange = function () { if(!w.value || isNaN(parseFloat(w.value))) { i.style.width = ''; } i.style.width = parseFloat(w.value) + wu.options[wu.selectedIndex].value; } this.panel.getElementById('text_maxlength').onkeyup = function () { i.maxlength = this.value; } }; FormOperations.prototype.showCbRd = function (input) { this.panel.getElementById('fs_cbrd').style.display = ''; var vals = { 'cbrd_name' : this.deformatName(input, input.name), 'cbrd_value' : input.value, 'cbrd_checked' : input.checked ? 1 : 0, 'cbrd_type' : input.type.toLowerCase() }; this.panel.setValues(vals); var i = input; var fo = this; this.panel.getElementById('cbrd_name').onkeyup = function () { i.name = fo.formatName(i, this.value); } this.panel.getElementById('cbrd_value').onkeyup = function () { i.value = this.value; } this.panel.getElementById('cbrd_type').onchange = function () { if(!Xinha.is_ie) { i.type = this.options[this.selectedIndex].value; } else { // IE does not permit modifications of the type of a form field once it is set // We therefor have to destroy and recreate it. I swear, if I ever // meet any of the Internet Explorer development team I'm gonna // kick them in the nuts! var tmpContainer = fo.editor._doc.createElement('div'); if(!/type=/.test(i.outerHTML)) { tmpContainer.innerHTML = i.outerHTML.replace(/<INPUT/i, '<input type="'+ this.options[this.selectedIndex].value + '"'); } else { tmpContainer.innerHTML = i.outerHTML.replace(/type="?[a-z]+"?/i, 'type="' + this.options[this.selectedIndex].value + '"'); } var newElement = Xinha.removeFromParent(tmpContainer.childNodes[0]); i.parentNode.insertBefore(newElement, i); Xinha.removeFromParent(i); input = i = newElement; } } this.panel.getElementById('cbrd_checked').onclick = function () { i.checked = this.checked; } }; FormOperations.prototype.showButton = function (input) { this.panel.getElementById('fs_button').style.display = ''; var vals = { 'button_name' : this.deformatName(input, input.name), 'button_value' : input.value, 'button_type' : input.type.toLowerCase() }; this.panel.setValues(vals); var i = input; var fo = this; this.panel.getElementById('button_name').onkeyup = function () { i.name = fo.formatName(i, this.value); }; this.panel.getElementById('button_value').onkeyup = function () { i.value = this.value; }; this.panel.getElementById('button_type').onchange = function () { if(!Xinha.is_ie) { i.type = this.options[this.selectedIndex].value; } else { // IE does not permit modifications of the type of a form field once it is set // We therefor have to destroy and recreate it. I swear, if I ever // meet any of the Internet Explorer development team I'm gonna // kick them in the nuts! var tmpContainer = fo.editor._doc.createElement('div'); if(!/type=/.test(i.outerHTML)) { tmpContainer.innerHTML = i.outerHTML.replace(/<INPUT/i, '<input type="'+ this.options[this.selectedIndex].value + '"'); } else { tmpContainer.innerHTML = i.outerHTML.replace(/type="?[a-z]+"?/i, 'type="' + this.options[this.selectedIndex].value + '"'); } var newElement = Xinha.removeFromParent(tmpContainer.childNodes[0]); i.parentNode.insertBefore(newElement, i); Xinha.removeFromParent(i); input = i = newElement; } }; }; FormOperations.prototype.showTextarea = function (input) { this.panel.getElementById('fs_textarea').style.display = ''; var vals = { 'textarea_name' : this.deformatName(input, input.name), 'textarea_value' : input.value, 'textarea_width' : input.style.width ? parseFloat(input.style.width.replace(/[^0-9.]/, '')) : '', 'textarea_width_units' : input.style.width ? input.style.width.replace(/[0-9.]/, '').toLowerCase() : 'ex', 'textarea_height' : input.style.height ? parseFloat(input.style.height.replace(/[^0-9.]/, '')) : '', 'textarea_height_units': input.style.height ? input.style.height.replace(/[0-9.]/, '').toLowerCase() : 'ex' }; this.panel.setValues(vals); var i = input; var fo = this; this.panel.getElementById('textarea_name').onkeyup = function () { i.name = fo.formatName(i, this.value); }; this.panel.getElementById('textarea_value').onkeyup = function () { i.value = i.innerHTML = this.value; }; var w = this.panel.getElementById('textarea_width'); var wu = this.panel.getElementById('textarea_width_units'); this.panel.getElementById('textarea_width').onkeyup = this.panel.getElementById('textarea_width_units').onchange = function () { if(!w.value || isNaN(parseFloat(w.value))) { i.style.width = ''; } i.style.width = parseFloat(w.value) + wu.options[wu.selectedIndex].value; }; var h = this.panel.getElementById('textarea_height'); var hu = this.panel.getElementById('textarea_height_units'); this.panel.getElementById('textarea_height').onkeyup = this.panel.getElementById('textarea_height_units').onchange = function () { if(!h.value || isNaN(parseFloat(h.value))) { i.style.height = ''; } i.style.height = parseFloat(h.value) + hu.options[hu.selectedIndex].value; }; }; FormOperations.prototype.showSelect = function (input) { this.panel.getElementById('fs_select').style.display = ''; var vals = { 'select_name' : this.deformatName(input, input.name), 'select_multiple' : input.multiple ? 1 : 0, 'select_width' : input.style.width ? parseFloat(input.style.width.replace(/[^0-9.]/, '')) : '', 'select_width_units' : input.style.width ? input.style.width.replace(/[0-9.]/, '').toLowerCase() : 'ex', 'select_height' : input.style.height ? parseFloat(input.style.height.replace(/[^0-9.]/, '')) : (input.size && input.size > 0 ? input.size : 1), 'select_height_units': input.style.height ? input.style.height.replace(/[0-9.]/, '').toLowerCase() : 'items' }; this.panel.setValues(vals); var i = input; var fo = this; this.panel.getElementById('select_name').onkeyup = function () { i.name = fo.formatName(i, this.value); }; this.panel.getElementById('select_multiple').onclick = function () { i.multiple = this.checked; }; var w = this.panel.getElementById('select_width'); var wu = this.panel.getElementById('select_width_units'); this.panel.getElementById('select_width').onkeyup = this.panel.getElementById('select_width_units').onchange = function () { if(!w.value || isNaN(parseFloat(w.value))) { i.style.width = ''; } i.style.width = parseFloat(w.value) + wu.options[wu.selectedIndex].value; }; var h = this.panel.getElementById('select_height'); var hu = this.panel.getElementById('select_height_units'); this.panel.getElementById('select_height').onkeyup = this.panel.getElementById('select_height_units').onchange = function () { if(!h.value || isNaN(parseFloat(h.value))) { i.style.height = ''; return; } if(hu.selectedIndex == 0) { i.style.height = ''; i.size = parseInt(h.value); } else { i.style.height = parseFloat(h.value) + hu.options[hu.selectedIndex].value; } }; var fo_sel = this.panel.getElementById('select_options'); this.arrayToOpts(this.optsToArray(input.options), fo_sel.options); this.panel.getElementById('add_option').onclick = function() { var txt = prompt(Xinha._lc("Enter the name for new option.", 'FormOperations')); if(txt == null) return; var newOpt = new Option(txt); var opts = fo.optsToArray(fo_sel.options); if(fo_sel.selectedIndex >= 0) { opts.splice(fo_sel.selectedIndex, 0, newOpt); } else { opts.push(newOpt); } fo.arrayToOpts(opts, input.options); fo.arrayToOpts(opts, fo_sel.options); }; this.panel.getElementById('del_option').onclick = function() { var opts = fo.optsToArray(fo_sel.options); var newOpts = [ ]; for(var i = 0; i < opts.length; i++) { if(opts[i].selected) continue; newOpts.push(opts[i]); } fo.arrayToOpts(newOpts, input.options); fo.arrayToOpts(newOpts, fo_sel.options); }; this.panel.getElementById('up_option').onclick = function() { if(!(fo_sel.selectedIndex > 0)) return; var opts = fo.optsToArray(fo_sel.options); var move = opts.splice(fo_sel.selectedIndex, 1).pop(); opts.splice(fo_sel.selectedIndex - 1, 0, move); fo.arrayToOpts(opts, input.options); fo.arrayToOpts(opts, fo_sel.options); }; this.panel.getElementById('down_option').onclick = function() { if(fo_sel.selectedIndex == fo_sel.options.length - 1) return; var opts = fo.optsToArray(fo_sel.options); var move = opts.splice(fo_sel.selectedIndex, 1).pop(); opts.splice(fo_sel.selectedIndex+1, 0, move); fo.arrayToOpts(opts, input.options); fo.arrayToOpts(opts, fo_sel.options); }; this.panel.getElementById('select_options').onchange = function() { fo.arrayToOpts(fo.optsToArray(fo_sel.options), input.options); }; }; FormOperations.prototype.optsToArray = function(o) { var a = [ ]; for(var i = 0; i < o.length; i++) { a.push( { 'text' : o[i].text, 'value' : o[i].value, 'defaultSelected' : o[i].defaultSelected, 'selected' : o[i].selected } ); } return a; }; FormOperations.prototype.arrayToOpts = function(a, o) { for(var i = o.length -1; i >= 0; i--) { o[i] = null; } for(var i = 0; i < a.length; i++) { o[i] = new Option(a[i].text, a[i].value, a[i].defaultSelected, a[i].selected); } }; FormOperations.prototype.formatName = function(input, name) { // Multiple name var mname = name; switch(this.editor.config.FormOperations.multiple_field_format) { case 'php': { mname += '[]'; } break; case 'unmodified': { // Leave as is. } break; default: { throw("Unknown multiple field format " + this.editor.config.FormOperations.multiple_field_format); } } if ( (input.tagName.toLowerCase() == 'select' && input.multiple) || (input.tagName.toLowerCase() == 'input' && input.type.toLowerCase() == 'checkbox') ) { name = mname; } return name; }; FormOperations.prototype.deformatName = function(input, name) { if(this.editor.config.FormOperations.multiple_field_format == 'php') { name = name.replace(/\[\]$/, ''); } return name; };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/FormOperations/FormOperations.js
JavaScript
art
21,651
/** * WYSIWYG Wrap Plugin * * The purpose of this plugin is to wrap the content being edited in Xinha * with certain elements of given ID and/or class when in the WYSIWYG view. * * The reason for this is to assist when styling content. * */ WysiwygWrap._pluginInfo = { name : "WYSIWYG Wrap", version : "1.0", developer : "James Sleeman", developer_url : "http://www.gogo.co.nz/", c_owner : "James Sleeman", license : "htmlArea" }; Xinha.Config.prototype.WysiwygWrap = { 'elements' : [ ] // 'elements' : [ 'div.class#id', 'ul', 'li' ] }; function WysiwygWrap(editor) { this.editor = editor; } /** Take HTML and wrap it with the elements. * * @param string * @return string */ WysiwygWrap.prototype.inwardHtml = function(html) { for(var x = this.editor.config.WysiwygWrap.elements.length - 1; x >= 0; x--) { var e = { tagName: this.editor.config.WysiwygWrap.elements[x], className: '', id: '' }; if(e.tagName.match(/#(.+)$/)) { e.id = RegExp.$1; e.tagName = e.tagName.replace(/#(.+)$/,''); } if(e.tagName.match(/[^.]*\.(.+)$/)) { e.className = RegExp.$1.replace('.', ' '); e.tagName = e.tagName.replace(/\..+$/, ''); } if(!e.tagName.length) { e.tagName = 'div'; } html = '<'+e.tagName+' id="'+e.id+'" class="'+e.className+'">'+html+'</'+e.tagName+'>'; } return html; } /** Take HTML and strip it from the elements. * * @param string * @return string */ WysiwygWrap.prototype.outwardHtml = function(html) { for(var x = 0; x < this.editor.config.WysiwygWrap.elements.length; x++) { var e = { tagName: this.editor.config.WysiwygWrap.elements[x], className: '', id: '' }; if(e.tagName.match(/#(.+)$/)) { e.id = RegExp.$1; e.tagName = e.tagName.replace(/#(.+)$/,''); } if(e.tagName.match(/[^.]*\.(.+)$/)) { e.className = RegExp.$1.replace('.', ' '); e.tagName = e.tagName.replace(/\..+$/, ''); } if(!e.tagName.length) { e.tagName = 'div'; } var r1 = new RegExp('^(\\s|\\n|\\r)*<'+e.tagName+'[^>]*>(\\s|\\n|\\r)*', 'i'); var r2 = new RegExp('(\\s|\\n|\\r)*</'+e.tagName+'[^>]*>(\\s|\\n|\\r)*$', 'i'); html = html.replace(r1, ''); html = html.replace(r2, ''); } return html; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/WysiwygWrap/WysiwygWrap.js
JavaScript
art
2,401
/*------------------------------------------*\ AsciiMathML Formula Editor for Xinha _______________________ Based on AsciiMathML by Peter Jipsen http://www.chapman.edu/~jipsen Including a table with math symbols for easy input modified from CharacterMap for ASCIIMathML by Peter Jipsen HTMLSource based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/) modified by Holger Hees Original Author - Bernhard Pfeifer novocaine@gmx.net See readme.txt This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (at http://www.gnu.org/licenses/lgpl.html) for more details. Raimund Meyer 11/23/2006 \*------------------------------------------*/ function Equation(editor) { this.editor = editor; var cfg = editor.config; var self = this; // register the toolbar buttons provided by this plugin cfg.registerButton({ id : "equation", tooltip : this._lc("Formula Editor"), image : editor.imgURL("equation.gif", "Equation"), textMode : false, action : function(editor, id) { self.buttonPress(editor, id); } }); cfg.addToolbarElement("equation", "inserthorizontalrule", -1); mathcolor = cfg.Equation.mathcolor; // change it to "" (to inherit) or any other color mathfontfamily = cfg.Equation.mathfontfamily; this.enabled = !Xinha.is_ie; if (this.enabled) { this.onBeforeSubmit = this.onBeforeUnload = function () {self.unParse();}; } if (typeof AMprocessNode != "function") { Xinha._loadback(Xinha.getPluginDir('Equation') + "/ASCIIMathML.js", function () { translate(); }); } } Xinha.Config.prototype.Equation = { "mathcolor" : "black", // change it to "" (to inherit) or any other color "mathfontfamily" : "serif" // change to "" to inherit (works in IE) // or another family (e.g. "arial") } Equation._pluginInfo = { name : "ASCIIMathML Formula Editor", version : "2.3 (2008-01-26)", developer : "Raimund Meyer", developer_url : "http://x-webservice.net", c_owner : "", sponsor : "", sponsor_url : "", license : "GNU/LGPL" }; Equation.prototype._lc = function(string) { return Xinha._lc(string, 'Equation'); }; Equation.prototype.onGenerate = function() { this.parse(); }; // avoid changing the formula in the editor Equation.prototype.onKeyPress = function(ev) { if (this.enabled) { e = this.editor; var span = e._getFirstAncestor(e.getSelection(),['span']); if ( span && span.className == "AM" ) { if ( ev.keyCode == 8 || // delete ev.keyCode == 46 ||// backspace ev.charCode // all character keys ) { // stop event Xinha._stopEvent(ev); return true; } } } return false; } Equation.prototype.onBeforeMode = function( mode ) { if (this.enabled && mode == 'textmode') { this.unParse(); } } Equation.prototype.onMode = function( mode ) { if (this.enabled && mode == 'wysiwyg') { this.parse(); } } Equation.prototype.parse = function () { if (this.enabled) { var doc = this.editor._doc; var spans = doc.getElementsByTagName("span"); for (var i = 0;i<spans.length;i++) { var node = spans[i]; if (node.className != 'AM') continue; if (node.innerHTML.indexOf(this.editor.cc) != -1) // avoid problems with source code position auxiliary character { node.innerHTML = node.innerHTML.replace(this.editor.cc,''); node.parentNode.insertBefore(doc.createTextNode(this.editor.cc), node); } node.title = node.innerHTML; // FF3 strict source document policy: // the span is taken from the editor document, processed in the plugin document, and put back in the editor var clone = node.cloneNode(true); try { document.adoptNode(clone); } catch (e) {} AMprocessNode(clone, false); try { doc.adoptNode(clone); } catch (e) {} node.parentNode.replaceChild(clone, node); // insert space before and after the protected node, otherwide one could get stuck clone.parentNode.insertBefore(doc.createTextNode(String.fromCharCode(32)),clone); clone.parentNode.insertBefore(doc.createTextNode(String.fromCharCode(32)),clone.nextSibling); } } } Equation.prototype.unParse = function () { var doc = this.editor._doc; var spans = doc.getElementsByTagName("span"); for (var i = 0;i<spans.length;i++) { var node = spans[i]; if (node.className.indexOf ("AM") == -1 || node.getElementsByTagName("math").length == 0) continue; var formula = '`' + node.getElementsByTagName('math')[0].getAttribute('title') + '`'; node.innerHTML = formula; node.setAttribute("title", null); } } Equation.prototype.buttonPress = function() { var self = this; var editor = this.editor; var args = {}; args['editor'] = editor; var parent = editor._getFirstAncestor(editor.getSelection(),['span']); if (parent) { args["editedNode"] = parent; } Dialog(Xinha.getPluginDir('Equation') + "/popups/dialog.html", function(params) { self.insert(params); }, args); }; Equation.prototype.insert = function (param) { if (typeof param == 'undefined' || param == null) return; if (typeof param["formula"] != "undefined") { var formula = (param["formula"] != '') ? param["formula"].replace(/^`?(.*)`?$/m,"`$1`") : ''; if (param["editedNode"] && (param["editedNode"].tagName.toLowerCase() == 'span')) { var span = param["editedNode"]; if (formula != '') { span.innerHTML = formula; if (this.enabled) span.title = formula; } else { span.parentNode.removeChild(span); } } else if (!param["editedNode"] && formula != '') { if (this.enabled) { var span = document.createElement('span'); span.className = 'AM'; this.editor.insertNodeAtSelection(span); span.innerHTML = formula; span.title = formula; } else { this.editor.insertHTML('<span class="AM">'+formula+'</span>'); } } if (this.enabled) this.parse();//AMprocessNode(this.editor._doc.body, false); } }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/Equation.js
JavaScript
art
6,621
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Author: Maarten Molenschot, maarten@nrgmm.nl { "AsciiMath Formula Input": "AsciiMath Formule Invoeren", "Formula Editor": "Formule Invoeren", "Input":"Invoer", "Preview":"Voorbeeld", "Based on ASCIIMathML by ": "Gebasseerd op ASCIIMathML van ", "For more information on AsciiMathML visit this page: ":"Voor meer informatie over AsciiMathML ga je naar: ", "Attention: Editing the formula in the editor is not possible, please use this dialog!" : "Let op! het bewerken van de formule in de editor is niet mogelijk, gebruik dit dialoog!" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/lang/nl.js
JavaScript
art
618
// I18N constants // //LANG: "base", ENCODING: UTF-8 //Author: Translator-Name, <email@example.com> // FOR TRANSLATORS: // // 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE // (at least a valid email address) // // 2. PLEASE TRY TO USE UTF-8 FOR ENCODING; // (if this is not possible, please include a comment // that states what encoding is necessary.) { "AsciiMath Formula Input": "AsciiMath Formeleditor", "Formula Editor": "Formeleditor", "Input":"Eingabe", "Preview":"Vorschau", "Based on ASCIIMathML by ": "Basiert auf ASCIIMathML von ", "For more information on AsciiMathML visit this page: ":"Für weitere Informationen besuchen Sie bitte diese Seite: ", 'Attention Internet Explorer users: Please note that there is no WYSIWYG representation of the formula in the editor!<br />You might wish to use <a href="http://www.mozilla.com" onclick="window.open(this.href,\'_blank\');return false;">Mozilla Firefox</a> instead.' : 'Achtung Internet Explorer-Benutzer: Die Formel wird im Editor nicht als WYSIWYG dargestellt.<br />Benutzen Sie <a href="http://www.mozilla.com" target="_blank">Mozilla Firefox</a> als Alternative.', "Show MathML" : "Zeige MathML" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/lang/de.js
JavaScript
art
1,204
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "AsciiMath Formula Input": "AsciiMath 数式入力", "Formula Editor": "数式エディタ", "Input":"入力", "Preview":"表示", "Based on ASCIIMathML by ": "Based on ASCIIMathML by ", "For more information on AsciiMathML visit this page: ":"AsciiMathの詳細はこのページにあります: ", "Attention: Editing the formula in the editor is not possible, please use this dialog!" : "注意: エディタで数式を編集することはできません。必ず、このダイアログを使用してください" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/lang/ja.js
JavaScript
art
588
// I18N constants // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // Last revision: 05 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "&quot;text&quot;": "&quot;text&quot;", "AsciiMath Formula Input": "Inserir Fórmula AsciiMath", "AsciiMathML Example": "Exemplo AsciiMathML", "Based on ASCIIMathML by": "Baseado no ASCIIMathML por", "Cancel": "Cancelar", "Equation": "Equação", "For more information on AsciiMathML visit this page:": "Para maiores informações do AsciiMathML visite este site:", "Formula Editor": "Editor de Fórmula", "Input": "Entrada", "Insert": "Inserir", "Preview": "Visualizar", "Select operation": "Selecionar operação", "`&quot;text&quot;`": "`&quot;texto&quot;`", // new messages - see: http://xinha.webfactional.com/wiki/TranslationChanges "Attention Internet Explorer users: Please note that there is no WYSIWYG representation of the formula in the editor! You might wish to use Mozilla Firefox instead.": "Atenção usuários do Internet Explorer: Observe que não é possível representar fórmulas no editor no modo de visualização! É preferivelmente que você utilize o Mozilla Firefox.", "Show MathML": "Mostrar MathML", // removed old messages - see: http://xinha.webfactional.com/wiki/TranslationChanges "Attention: Editing the formula in the editor is not possible, please use this dialog!": "Atenção: Não é possível editar a fórmula no editor. Ppor favor, utilize este caixa de diálogo!" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/lang/pt_br.js
JavaScript
art
1,836
/* ASCIIMathML.js ============== This file contains JavaScript functions to convert ASCII math notation and LaTeX to Presentation MathML. Simple graphics commands are also translated to SVG images. The conversion is done while the (X)HTML page loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet Explorer 6/7 + MathPlayer (http://www.dessci.com/en/products/mathplayer/) + Adobe SVGview 3.03 (http://www.adobe.com/svg/viewer/install/). Just add the next line to your (X)HTML page with this file in the same folder: <script type="text/javascript" src="ASCIIMathML.js"></script> (using the graphics in IE also requires the file "d.svg" in the same folder). This is a convenient and inexpensive solution for authoring MathML and SVG. Version 2.1 Oct 8, 2008, (c) Peter Jipsen http://www.chapman.edu/~jipsen This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js. Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js If you use it on a webpage, please send the URL to jipsen@chapman.edu The LaTeXMathML modifications were made by Douglas Woodall, June 2006. (for details see header on the LaTeXMathML part in middle of file) Extensive clean-up and improvements by Paulo Soares, Oct 2007. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (at http://www.gnu.org/licences/lgpl.html) for more details. */ var mathcolor = "blue"; // change it to "" (to inherit) or another color var mathfontsize = "1em"; // change to e.g. 1.2em for larger math var mathfontfamily = "serif"; // change to "" to inherit (works in IE) // or another family (e.g. "arial") var automathrecognize = false; // writing "amath" on page makes this true var checkForMathML = true; // check if browser can display MathML var notifyIfNoMathML = true; // display note at top if no MathML capability var alertIfNoMathML = false; // show alert box if no MathML capability var translateOnLoad = true; // set to false to do call translators from js var translateLaTeX = true; // false to preserve $..$, $$..$$ var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{} var translateASCIIMath = true; // false to preserve `..` var translateASCIIsvg = true; // false to preserve agraph.., \begin{graph}.. var avoidinnerHTML = false; // set true if assigning to innerHTML gives error var displaystyle = true; // puts limits above and below large operators var showasciiformulaonhover = true; // helps students learn ASCIIMath var decimalsign = "."; // change to "," if you like, beware of `(1,2)`! var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters var AMdocumentId = "wikitext" // PmWiki element containing math (default=body) var checkforprocessasciimathinmoodle = false; // true for systems like Moodle var dsvglocation = ""; // path to d.svg (blank if same as ASCIIMathML.js loc) /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ var isIE = document.createElementNS==null; var noMathML = false, translated = false; if (isIE) { // avoid adding MathPlayer info explicitly to each webpage document.write("<object id=\"mathplayer\"\ classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>"); document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>"); } // Add a stylesheet, replacing any previous custom stylesheet (adapted from TW) function setStylesheet(s) { var id = "AMMLcustomStyleSheet"; var n = document.getElementById(id); if(document.createStyleSheet) { // Test for IE's non-standard createStyleSheet method if(n) n.parentNode.removeChild(n); // This failed without the &nbsp; document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd","&nbsp;<style id='" + id + "'>" + s + "</style>"); } else { if(n) { n.replaceChild(document.createTextNode(s),n.firstChild); } else { n = document.createElement("style"); n.type = "text/css"; n.id = id; n.appendChild(document.createTextNode(s)); document.getElementsByTagName("head")[0].appendChild(n); } } } setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}"); function init(){ var msg, warnings = new Array(); if (document.getElementById==null){ alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer"); return null; } if (checkForMathML && (msg = checkMathML())) warnings.push(msg); if (checkIfSVGavailable && (msg = checkSVG())) warnings.push(msg); if (warnings.length>0) displayWarnings(warnings); if (!noMathML) initSymbols(); return true; } function checkMathML(){ if (navigator.appName.slice(0,8)=="Netscape") if (navigator.appVersion.slice(0,1)>="5") noMathML = null; else noMathML = true; else if (navigator.appName.slice(0,9)=="Microsoft") try { var ActiveX = new ActiveXObject("MathPlayer.Factory.1"); noMathML = null; } catch (e) { noMathML = true; } else if (navigator.appName.slice(0,5)=="Opera") if (navigator.appVersion.slice(0,3)>="9.5") noMathML = null; else noMathML = true; //noMathML = true; //uncomment to check if (noMathML && notifyIfNoMathML) { var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later."; if (alertIfNoMathML) alert(msg); else return msg; } } function hideWarning(){ var body = document.getElementsByTagName("body")[0]; body.removeChild(document.getElementById('AMMLwarningBox')); body.onclick = null; } function displayWarnings(warnings) { var i, frag, nd = createElementXHTML("div"); var body = document.getElementsByTagName("body")[0]; body.onclick=hideWarning; nd.id = 'AMMLwarningBox'; for (i=0; i<warnings.length; i++) { frag = createElementXHTML("div"); frag.appendChild(document.createTextNode(warnings[i])); frag.style.paddingBottom = "1.0em"; nd.appendChild(frag); } nd.appendChild(createElementXHTML("p")); nd.appendChild(document.createTextNode("For instructions see the ")); var an = createElementXHTML("a"); an.appendChild(document.createTextNode("ASCIIMathML")); an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html"); nd.appendChild(an); nd.appendChild(document.createTextNode(" homepage")); an = createElementXHTML("div"); an.id = 'AMMLcloseDiv'; an.appendChild(document.createTextNode('(click anywhere to close this warning)')); nd.appendChild(an); var body = document.getElementsByTagName("body")[0]; body.insertBefore(nd,body.childNodes[0]); } function translate(spanclassAM) { if (!translated) { // run this only once translated = true; var body = document.getElementsByTagName("body")[0]; var processN = document.getElementById(AMdocumentId); if (translateLaTeX) LMprocessNode((processN!=null?processN:body)); if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM); } } function createElementXHTML(t) { if (isIE) return document.createElement(t); else return document.createElementNS("http://www.w3.org/1999/xhtml",t); } function createMmlNode(t,frag) { if (isIE) var node = document.createElement("m:"+t); else var node = document.createElementNS("http://www.w3.org/1998/Math/MathML",t); if (frag) node.appendChild(frag); return node; } // character lists for Mozilla/Netscape fonts var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46]; var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128]; var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124]; var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4, RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8, LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13, MATRIX = 14;; // token types var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}; var AMsymbols = [ //some greek symbols {input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST}, {input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST}, {input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST}, {input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST}, {input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST}, {input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST}, {input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST}, {input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST}, {input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST}, {input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST}, {input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST}, {input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST}, {input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST}, {input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST}, {input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST}, {input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST}, {input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST}, {input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST}, {input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST}, {input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST}, {input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST}, {input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST}, {input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST}, {input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST}, {input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST}, {input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST}, {input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST}, {input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST}, {input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST}, {input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST}, {input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST}, {input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST}, {input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST}, {input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST}, {input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST}, {input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST}, //binary operation symbols //{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST}, {input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST}, {input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST}, {input:"//", tag:"mo", output:"/", tex:null, ttype:CONST}, {input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST}, {input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST}, {input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST}, {input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST}, {input:"@", tag:"mo", output:"\u26AC", tex:"circ", ttype:CONST}, {input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST}, {input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST}, {input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST}, {input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER}, {input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER}, {input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST}, {input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER}, {input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST}, {input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER}, {input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST}, {input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER}, {input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST}, {input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER}, //binary relation symbols {input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST}, {input:":=", tag:"mo", output:":=", tex:null, ttype:CONST}, {input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST}, {input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST}, {input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST}, {input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST}, {input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST}, {input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST}, {input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST}, {input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST}, {input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST}, {input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST}, {input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST}, {input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST}, {input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST}, {input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST}, {input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST}, {input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST}, {input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST}, {input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST}, {input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST}, {input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST}, //logical symbols {input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE}, {input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE}, {input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST}, {input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST}, {input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE}, {input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST}, {input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST}, {input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST}, {input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST}, {input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST}, {input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST}, {input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST}, //grouping brackets {input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET}, {input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET}, {input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET}, {input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET}, {input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET}, {input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET}, {input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT}, //{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT}, {input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET}, {input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET}, {input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET}, {input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET}, {input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true}, {input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true}, //miscellaneous symbols {input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST}, {input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION}, {input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION}, {input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION}, {input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION}, {input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST}, {input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST}, {input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST}, {input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST}, {input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST}, {input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST}, {input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST}, {input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST}, {input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST}, {input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST}, {input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST}, {input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST}, {input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST}, {input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST}, {input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST}, {input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST}, {input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST}, {input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST}, {input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST}, {input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST}, {input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST}, {input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST}, {input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST}, {input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST}, {input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST}, {input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST}, {input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST}, {input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true}, {input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true}, //standard functions {input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER}, {input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER}, {input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true}, {input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true}, {input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true}, {input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true}, {input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true}, {input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true}, {input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true}, {input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true}, {input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true}, {input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true}, {input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true}, {input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true}, {input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST}, {input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST}, {input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true}, {input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true}, {input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST}, {input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST}, {input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER}, {input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER}, //arrows {input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST}, {input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST}, {input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST}, {input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST}, {input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST}, {input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST}, {input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST}, {input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST}, {input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST}, {input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST}, {input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST}, {input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST}, {input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST}, //commands with argument {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY}, {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY}, {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY}, {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX}, {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY}, {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX}, {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX}, {input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true}, {input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true}, {input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true}, {input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true}, {input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true}, {input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true}, {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT}, {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT}, AMquote, {input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY}, {input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY}, {input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY}, {input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY}, {input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb}, {input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb}, {input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal}, {input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal}, {input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY}, {input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY}, {input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk}, {input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk} ]; function compareNames(s1,s2) { if (s1.input > s2.input) return 1 else return -1; } var AMnames = []; //list of input symbols function initSymbols() { var texsymbols = [], i; for (i=0; i<AMsymbols.length; i++) if (AMsymbols[i].tex) texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype}; AMsymbols = AMsymbols.concat(texsymbols); refreshSymbols(); } function refreshSymbols(){ var i; AMsymbols.sort(compareNames); for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input; LMsymbols.sort(compareNames); for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input; } function define(oldstr,newstr) { if(oldstr.substr(0,1)=="\\") LMsymbols = LMsymbols.concat([{input:oldstr, tag:"mo", output:newstr, ttype:DEFINITION}]); else AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr, tex:null, ttype:DEFINITION}]); refreshSymbols(); // this may be a problem if many symbols are defined! } function AMremoveCharsAndBlanks(str,n) { //remove n characters and any following blanks var st; if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") st = str.slice(n+1); else st = str.slice(n); for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1); return st.slice(i); } function position(arr, str, n) { // return position >=n where str appears or would be inserted // assumes arr is sorted if (n==0) { var h,m; n = -1; h = arr.length; while (n+1<h) { m = (n+h) >> 1; if (arr[m]<str) n = m; else h = m; } return h; } else for (var i=n; i<arr.length && arr[i]<str; i++); return i; // i=arr.length || arr[i]>=str } function AMgetSymbol(str) { //return maximal initial substring of str that appears in names //return null if there is none var k = 0; //new pos var j = 0; //old pos var mk; //match pos var st; var tagst; var match = ""; var more = true; for (var i=1; i<=str.length && more; i++) { st = str.slice(0,i); //initial substring of length i j = k; k = position(AMnames, st, j); if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){ match = AMnames[k]; mk = k; i = match.length; } more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k]; } AMpreviousSymbol=AMcurrentSymbol; if (match!=""){ AMcurrentSymbol=AMsymbols[mk].ttype; return AMsymbols[mk]; } // if str[0] is a digit or - return maxsubstring of digits.digits AMcurrentSymbol=CONST; k = 1; st = str.slice(0,1); var integ = true; while ("0"<=st && st<="9" && k<=str.length) { st = str.slice(k,k+1); k++; } if (st == decimalsign) { st = str.slice(k,k+1); if ("0"<=st && st<="9") { integ = false; k++; while ("0"<=st && st<="9" && k<=str.length) { st = str.slice(k,k+1); k++; } } } if ((integ && k>1) || k>2) { st = str.slice(0,k-1); tagst = "mn"; } else { k = 2; st = str.slice(0,1); //take 1 character tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); } if (st=="-" && AMpreviousSymbol==INFIX) { AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; } return {input:st, tag:tagst, output:st, ttype:CONST}; } function AMremoveBrackets(node) { var st; if (node.nodeName=="mrow") { st = node.firstChild.firstChild.nodeValue; if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild); } if (node.nodeName=="mrow") { st = node.lastChild.firstChild.nodeValue; if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild); } } /*Parsing ASCII math expressions with the following grammar v ::= [A-Za-z] | greek letters | numbers | other constant symbols u ::= sqrt | text | bb | other unary symbols for font commands b ::= frac | root | stackrel binary symbols l ::= ( | [ | { | (: | {: left brackets r ::= ) | ] | } | :) | :} right brackets S ::= v | lEr | uS | bSS Simple expression I ::= S_S | S^S | S_S^S | S Intermediate expression E ::= IE | I/I Expression Each terminal symbol is translated into a corresponding mathml node.*/ var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; function AMparseSexpr(str) { //parses str and returns [node,tailstr] var symbol, node, result, i, st,// rightvert = false, newFrag = document.createDocumentFragment(); str = AMremoveCharsAndBlanks(str,0); symbol = AMgetSymbol(str); //either a token or a bracket or empty if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) { return [null,str]; } if (symbol.ttype == DEFINITION) { str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); symbol = AMgetSymbol(str); } switch (symbol.ttype) { case UNDEROVER: case CONST: str = AMremoveCharsAndBlanks(str,symbol.input.length); return [createMmlNode(symbol.tag, //its a constant document.createTextNode(symbol.output)),str]; case LEFTBRACKET: //read (expr+) AMnestingDepth++; str = AMremoveCharsAndBlanks(str,symbol.input.length); result = AMparseExpr(str,true); AMnestingDepth--; if (typeof symbol.invisible == "boolean" && symbol.invisible) node = createMmlNode("mrow",result[0]); else { node = createMmlNode("mo",document.createTextNode(symbol.output)); node = createMmlNode("mrow",node); node.appendChild(result[0]); } return [node,result[1]]; case TEXT: if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length); if (str.charAt(0)=="{") i=str.indexOf("}"); else if (str.charAt(0)=="(") i=str.indexOf(")"); else if (str.charAt(0)=="[") i=str.indexOf("]"); else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1; else i = 0; if (i==-1) i = str.length; st = str.slice(1,i); if (st.charAt(0) == " ") { node = createMmlNode("mspace"); node.setAttribute("width","1ex"); newFrag.appendChild(node); } newFrag.appendChild( createMmlNode(symbol.tag,document.createTextNode(st))); if (st.charAt(st.length-1) == " ") { node = createMmlNode("mspace"); node.setAttribute("width","1ex"); newFrag.appendChild(node); } str = AMremoveCharsAndBlanks(str,i+1); return [createMmlNode("mrow",newFrag),str]; case UNARY: str = AMremoveCharsAndBlanks(str,symbol.input.length); result = AMparseSexpr(str); if (result[0]==null) return [createMmlNode(symbol.tag, document.createTextNode(symbol.output)),str]; if (typeof symbol.func == "boolean" && symbol.func) { // functions hack st = str.charAt(0); if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") { return [createMmlNode(symbol.tag, document.createTextNode(symbol.output)),str]; } else { node = createMmlNode("mrow", createMmlNode(symbol.tag,document.createTextNode(symbol.output))); node.appendChild(result[0]); return [node,result[1]]; } } AMremoveBrackets(result[0]); if (symbol.input == "sqrt") { // sqrt return [createMmlNode(symbol.tag,result[0]),result[1]]; } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent node = createMmlNode(symbol.tag,result[0]); node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output))); return [node,result[1]]; } else { // font change command if (!isIE && typeof symbol.codes != "undefined") { for (i=0; i<result[0].childNodes.length; i++) if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") { st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue: result[0].childNodes[i].firstChild.nodeValue); var newst = []; for (var j=0; j<st.length; j++) if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst + String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]); else newst = newst + st.charAt(j); if (result[0].nodeName=="mi") result[0]=createMmlNode("mo"). appendChild(document.createTextNode(newst)); else result[0].replaceChild(createMmlNode("mo"). appendChild(document.createTextNode(newst)), result[0].childNodes[i]); } } node = createMmlNode(symbol.tag,result[0]); node.setAttribute(symbol.atname,symbol.atval); return [node,result[1]]; } case BINARY: str = AMremoveCharsAndBlanks(str,symbol.input.length); result = AMparseSexpr(str); if (result[0]==null) return [createMmlNode("mo", document.createTextNode(symbol.input)),str]; AMremoveBrackets(result[0]); var result2 = AMparseSexpr(result[1]); if (result2[0]==null) return [createMmlNode("mo", document.createTextNode(symbol.input)),str]; AMremoveBrackets(result2[0]); if (symbol.input=="root" || symbol.input=="stackrel") newFrag.appendChild(result2[0]); newFrag.appendChild(result[0]); if (symbol.input=="frac") newFrag.appendChild(result2[0]); return [createMmlNode(symbol.tag,newFrag),result2[1]]; case INFIX: str = AMremoveCharsAndBlanks(str,symbol.input.length); return [createMmlNode("mo",document.createTextNode(symbol.output)),str]; case SPACE: str = AMremoveCharsAndBlanks(str,symbol.input.length); node = createMmlNode("mspace"); node.setAttribute("width","1ex"); newFrag.appendChild(node); newFrag.appendChild( createMmlNode(symbol.tag,document.createTextNode(symbol.output))); node = createMmlNode("mspace"); node.setAttribute("width","1ex"); newFrag.appendChild(node); return [createMmlNode("mrow",newFrag),str]; case LEFTRIGHT: // if (rightvert) return [null,str]; else rightvert = true; AMnestingDepth++; str = AMremoveCharsAndBlanks(str,symbol.input.length); result = AMparseExpr(str,false); AMnestingDepth--; var st = ""; if (result[0].lastChild!=null) st = result[0].lastChild.firstChild.nodeValue; if (st == "|") { // its an absolute value subterm node = createMmlNode("mo",document.createTextNode(symbol.output)); node = createMmlNode("mrow",node); node.appendChild(result[0]); return [node,result[1]]; } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing node = createMmlNode("mo",document.createTextNode("\u2223")); node = createMmlNode("mrow",node); return [node,str]; } default: //alert("default"); str = AMremoveCharsAndBlanks(str,symbol.input.length); return [createMmlNode(symbol.tag, //its a constant document.createTextNode(symbol.output)),str]; } } function AMparseIexpr(str) { var symbol, sym1, sym2, node, result, underover; str = AMremoveCharsAndBlanks(str,0); sym1 = AMgetSymbol(str); result = AMparseSexpr(str); node = result[0]; str = result[1]; symbol = AMgetSymbol(str); if (symbol.ttype == INFIX && symbol.input != "/") { str = AMremoveCharsAndBlanks(str,symbol.input.length); // if (symbol.input == "/") result = AMparseIexpr(str); else ... result = AMparseSexpr(str); if (result[0] == null) // show box in place of missing argument result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); else AMremoveBrackets(result[0]); str = result[1]; // if (symbol.input == "/") AMremoveBrackets(node); if (symbol.input == "_") { sym2 = AMgetSymbol(str); underover = (sym1.ttype == UNDEROVER); if (sym2.input == "^") { str = AMremoveCharsAndBlanks(str,sym2.input.length); var res2 = AMparseSexpr(str); AMremoveBrackets(res2[0]); str = res2[1]; node = createMmlNode((underover?"munderover":"msubsup"),node); node.appendChild(result[0]); node.appendChild(res2[0]); node = createMmlNode("mrow",node); // so sum does not stretch } else { node = createMmlNode((underover?"munder":"msub"),node); node.appendChild(result[0]); } } else { node = createMmlNode(symbol.tag,node); node.appendChild(result[0]); } } return [node,str]; } function AMparseExpr(str,rightbracket) { var symbol, node, result, i, nodeList = [], newFrag = document.createDocumentFragment(); do { str = AMremoveCharsAndBlanks(str,0); result = AMparseIexpr(str); node = result[0]; str = result[1]; symbol = AMgetSymbol(str); if (symbol.ttype == INFIX && symbol.input == "/") { str = AMremoveCharsAndBlanks(str,symbol.input.length); result = AMparseIexpr(str); if (result[0] == null) // show box in place of missing argument result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); else AMremoveBrackets(result[0]); str = result[1]; AMremoveBrackets(node); node = createMmlNode(symbol.tag,node); node.appendChild(result[0]); newFrag.appendChild(node); symbol = AMgetSymbol(str); } else if (node!=undefined) newFrag.appendChild(node); } while ((symbol.ttype != RIGHTBRACKET && (symbol.ttype != LEFTRIGHT || rightbracket) || AMnestingDepth == 0) && symbol!=null && symbol.output!=""); if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) { // if (AMnestingDepth > 0) AMnestingDepth--; var len = newFrag.childNodes.length; if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 && newFrag.childNodes[len-2].nodeName == "mo" && newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; if (right==")" || right=="]") { var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; if (left=="(" && right==")" && symbol.output != "}" || left=="[" && right=="]") { var pos = []; // positions of commas var matrix = true; var m = newFrag.childNodes.length; for (i=0; matrix && i<m; i=i+2) { pos[i] = []; node = newFrag.childNodes[i]; if (matrix) matrix = node.nodeName=="mrow" && (i==m-1 || node.nextSibling.nodeName=="mo" && node.nextSibling.firstChild.nodeValue==",")&& node.firstChild.firstChild.nodeValue==left && node.lastChild.firstChild.nodeValue==right; if (matrix) for (var j=0; j<node.childNodes.length; j++) if (node.childNodes[j].firstChild.nodeValue==",") pos[i][pos[i].length]=j; if (matrix && i>1) matrix = pos[i].length == pos[i-2].length; } if (matrix) { var row, frag, n, k, table = document.createDocumentFragment(); for (i=0; i<m; i=i+2) { row = document.createDocumentFragment(); frag = document.createDocumentFragment(); node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow> n = node.childNodes.length; k = 0; node.removeChild(node.firstChild); //remove ( for (j=1; j<n-1; j++) { if (typeof pos[i][k] != "undefined" && j==pos[i][k]){ node.removeChild(node.firstChild); //remove , row.appendChild(createMmlNode("mtd",frag)); k++; } else frag.appendChild(node.firstChild); } row.appendChild(createMmlNode("mtd",frag)); if (newFrag.childNodes.length>2) { newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow> newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo> } table.appendChild(createMmlNode("mtr",row)); } node = createMmlNode("mtable",table); if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left"); newFrag.replaceChild(node,newFrag.firstChild); } } } } str = AMremoveCharsAndBlanks(str,symbol.input.length); if (typeof symbol.invisible != "boolean" || !symbol.invisible) { node = createMmlNode("mo",document.createTextNode(symbol.output)); newFrag.appendChild(node); } } return [newFrag,str]; } function parseMath(str,latex) { var frag, node; AMnestingDepth = 0; frag = latex ? LMparseExpr(str.replace(/^\s+/g,""),false,false)[0] : AMparseExpr(str.replace(/^\s+/g,""),false)[0]; node = createMmlNode("mstyle",frag); node.setAttribute("mathcolor",mathcolor); node.setAttribute("fontfamily",mathfontfamily); node.setAttribute("mathsize",mathfontsize); if (displaystyle) node.setAttribute("displaystyle","true"); node = createMmlNode("math",node); if (showasciiformulaonhover) //fixed by djhsu so newline node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko return node; } function strarr2docFrag(arr, linebreaks, latex) { var newFrag=document.createDocumentFragment(); var expr = false; for (var i=0; i<arr.length; i++) { if (expr) newFrag.appendChild(parseMath(arr[i],latex)); else { var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]); newFrag.appendChild(createElementXHTML("span"). appendChild(document.createTextNode(arri[0]))); for (var j=1; j<arri.length; j++) { newFrag.appendChild(createElementXHTML("p")); newFrag.appendChild(createElementXHTML("span"). appendChild(document.createTextNode(arri[j]))); } } expr = !expr; } return newFrag; } function AMautomathrec(str) { //formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space. //tokens are single letters (except a, A, I) and ASCIIMathML tokens var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|"; var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|"; var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|"; var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn? var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|"; var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken; var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g"); str = str.replace(re," `$2`$7"); var arr = str.split(AMdelimiter1); var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g"); var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now for (i=0; i<arr.length; i++) //single nonenglish tokens if (i%2==0) { arr[i] = arr[i].replace(re1," `$2`$3"); arr[i] = arr[i].replace(re2," `$2`$3"); arr[i] = arr[i].replace(/([{}[\]])/,"`$1`"); } str = arr.join(AMdelimiter1); str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses str = str.replace(/\sin`/g,"` in"); str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`"); str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2"); str = str.replace(/`([0-9.]+:)`/g,"$1"); return str; } function processNodeR(n, linebreaks,latex) { var mtch, str, arr, frg, i; if (n.childNodes.length == 0) { if ((n.nodeType!=8 || linebreaks) && n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" && n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /*&& n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE"*/) { str = n.nodeValue; if (!(str == null)) { str = str.replace(/\r\n\r\n/g,"\n\n"); str = str.replace(/\x20+/g," "); str = str.replace(/\s*\r\n/g," "); if(latex) { // DELIMITERS: mtch = (str.indexOf("\$")==-1 ? false : true); str = str.replace(/([^\\])\$/g,"$1 \$"); str = str.replace(/^\$/," \$"); // in case \$ at start of string arr = str.split(" \$"); for (i=0; i<arr.length; i++) arr[i]=arr[i].replace(/\\\$/g,"\$"); } else { mtch = false; str = str.replace(new RegExp(AMescape1, "g"), function(){mtch = true; return "AMescape1"}); str = str.replace(/\\?end{?a?math}?/i, function(){automathrecognize = false; mtch = true; return ""}); str = str.replace(/amath\b|\\begin{a?math}/i, function(){automathrecognize = true; mtch = true; return ""}); arr = str.split(AMdelimiter1); if (automathrecognize) for (i=0; i<arr.length; i++) if (i%2==0) arr[i] = AMautomathrec(arr[i]); str = arr.join(AMdelimiter1); arr = str.split(AMdelimiter1); for (i=0; i<arr.length; i++) // this is a problem ************ arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1); } if (arr.length>1 || mtch) { if (!noMathML) { frg = strarr2docFrag(arr,n.nodeType==8,latex); var len = frg.childNodes.length; n.parentNode.replaceChild(frg,n); return len-1; } else return 0; } } } else return 0; } else if (n.nodeName!="math") { for (i=0; i<n.childNodes.length; i++) i += processNodeR(n.childNodes[i], linebreaks,latex); } return 0; } function AMprocessNode(n, linebreaks, spanclassAM) { var frag,st; if (spanclassAM!=null) { frag = document.getElementsByTagName("span") for (var i=0;i<frag.length;i++) if (frag[i].className == "AM") processNodeR(frag[i],linebreaks,false); } else { try { st = n.innerHTML; // look for AMdelimiter on page } catch(err) {} //alert(st) if (st==null || /amath\b|\\begin{a?math}/i.test(st) || st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 || st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) { processNodeR(n,linebreaks,false); } } /* if (isIE) { //needed to match size and font of formula to surrounding text frag = document.getElementsByTagName('math'); for (var i=0;i<frag.length;i++) frag[i].update() //What is this? }*/ } /* LaTeXMathML.js ============== Version 1.1, July 20, 2007 (c) modifications by Peter Jipsen (changes: renamed global variables from AM... to LM... so that LaTeXMathML and ASCIIMathML can be used simultaneously) Previous header notice: This file (Version 1.0), is due to Douglas Woodall, June 2006. It contains JavaScript functions to convert (most simple) LaTeX math notation to Presentation MathML. It was obtained by downloading the file ASCIIMathML.js from http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/ and modifying it so that it carries out ONLY those conversions that would be carried out in LaTeX. A description of the original file, with examples, can be found at www1.chapman.edu/~jipsen/mathml/asciimath.html ASCIIMathML: Math on the web for everyone Here is the header notice from the original file: ASCIIMathML.js ============== This file contains JavaScript functions to convert ASCII math notation to Presentation MathML. The conversion is done while the (X)HTML page loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/). Just add the next line to your (X)HTML page with this file in the same folder: <script type="text/javascript" src="ASCIIMathML.js"></script> This is a convenient and inexpensive solution for authoring MathML. Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt If you use it on a webpage, please send the URL to jipsen@chapman.edu This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (at http://www.gnu.org/license/lgpl.html) for more details. LaTeXMathML.js (ctd) ============== Content between $...$ and $$...$$ is converted by this part of the file */ // all further global variables start with "LM" // Commented out by DRW to prevent 1/2 turning into a 2-line fraction // LMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX}, // Commented out by DRW so that " prints literally in equations // LMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT}; var LMsymbols = [ //Greek letters {input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST}, {input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST}, {input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST}, {input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST}, {input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST}, {input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST}, {input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST}, {input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST}, {input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST}, {input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST}, {input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST}, {input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST}, {input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST}, {input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST}, {input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST}, {input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST}, {input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST}, {input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST}, {input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST}, {input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST}, {input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST}, {input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST}, {input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST}, {input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST}, {input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST}, {input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST}, {input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST}, {input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST}, {input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST}, {input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST}, {input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST}, {input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST}, {input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST}, {input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST}, {input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST}, {input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST}, {input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST}, {input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST}, {input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST}, {input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST}, //fractions {input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST}, {input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST}, {input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST}, {input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST}, {input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST}, {input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST}, {input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST}, {input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST}, {input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST}, {input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST}, {input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST}, {input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST}, {input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST}, {input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST}, {input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST}, //binary operation symbols {input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST}, {input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST}, {input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST}, {input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST}, {input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST}, {input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST}, {input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST}, {input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST}, {input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST}, {input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST}, //{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST}, {input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST}, {input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST}, {input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST}, {input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST}, {input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST}, {input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST}, {input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST}, {input:"\\land", tag:"mo", output:"\u2227", ttype:CONST}, {input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST}, {input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST}, {input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST}, {input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST}, {input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST}, {input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST}, {input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST}, {input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST}, {input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST}, {input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST}, {input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST}, {input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST}, {input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST}, {input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST}, {input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST}, {input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST}, {input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST}, {input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST}, {input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST}, //BIG Operators {input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER}, {input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER}, {input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER}, {input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER}, {input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER}, {input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER}, {input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER}, {input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER}, {input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER}, {input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER}, {input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER}, {input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER}, {input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER}, {input:"\\int", tag:"mo", output:"\u222B", ttype:CONST}, {input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST}, //binary relation symbols {input:":=", tag:"mo", output:":=", ttype:CONST}, {input:"\\lt", tag:"mo", output:"<", ttype:CONST}, {input:"\\gt", tag:"mo", output:">", ttype:CONST}, {input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST}, {input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST}, {input:"\\le", tag:"mo", output:"\u2264", ttype:CONST}, {input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST}, {input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST}, {input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST}, {input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST}, {input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST}, {input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST}, {input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST}, {input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST}, {input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST}, {input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST}, {input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST}, {input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST}, {input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST}, {input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST}, {input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST}, {input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST}, {input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST}, {input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST}, {input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST}, {input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST}, {input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST}, {input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST}, {input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST}, {input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST}, {input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST}, {input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST}, {input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST}, {input:"\\in", tag:"mo", output:"\u2208", ttype:CONST}, {input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST}, {input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST}, {input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST}, {input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST}, {input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST}, {input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST}, {input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST}, {input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST}, {input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST}, {input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST}, {input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST}, //matrices {input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true}, {input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true}, {input:"\\\\", output:"}&{", ttype:DEFINITION}, {input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION}, {input:"\\end{array}", output:"}}", ttype:DEFINITION}, //grouping and literal brackets -- ieval is for IE {input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG}, {input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG}, {input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG}, {input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG}, {input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET}, {input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET}, {input:"{", output:"{", ttype:LEFTBRACKET, invisible:true}, {input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true}, {input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY}, {input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY}, {input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY}, {input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY}, {input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY}, {input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY}, {input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY}, {input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY}, // rtag:"mi" causes space to be inserted before a following sin, cos, etc. // (see function LMparseExpr() ) {input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY}, {input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY}, // "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em {input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY}, {input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY}, {input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY}, {input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY}, {input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY}, {input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY}, {input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY}, {input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY}, {input:"\\setminus", tag:"mo", output:"\\", ttype:CONST}, //miscellaneous symbols {input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE}, {input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE}, {input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE}, {input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE}, {input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE}, {input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE}, {input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE}, {input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE}, //{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width {input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST}, {input:"'", tag:"mo", output:"\u02B9", ttype:CONST}, {input:"''", tag:"mo", output:"\u02BA", ttype:CONST}, {input:"'''", tag:"mo", output:"\u2034", ttype:CONST}, {input:"''''", tag:"mo", output:"\u2057", ttype:CONST}, {input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST}, {input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST}, {input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST}, {input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST}, {input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST}, {input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST}, {input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST}, {input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST}, {input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST}, {input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST}, {input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST}, {input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST}, {input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST}, {input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST}, {input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION}, {input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST}, {input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST}, {input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST}, {input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST}, {input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST}, //{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST}, {input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST}, //{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST}, {input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST}, {input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST}, {input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST}, {input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST}, {input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST}, {input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST}, {input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST}, {input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST}, //standard functions //Note UNDEROVER *must* have tag:"mo" to work properly {input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true}, {input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true}, {input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true}, {input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true}, {input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true}, {input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true}, {input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true}, {input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true}, {input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true}, {input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true}, {input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true}, {input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST? {input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true}, {input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST? {input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true}, {input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER}, {input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true}, {input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true}, {input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER}, {input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER}, {input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER}, {input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true}, {input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true}, {input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER}, {input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER}, {input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true}, {input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true}, {input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true}, {input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true}, {input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER}, {input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true}, {input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true}, //arrows {input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST}, {input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST}, {input:"\\to", tag:"mo", output:"\u2192", ttype:CONST}, {input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST}, {input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST}, {input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST}, {input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST}, {input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST}, {input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST}, {input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST}, {input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST}, {input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION}, {input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST}, {input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST}, {input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST}, {input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST}, {input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG}, {input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG}, {input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG}, {input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG}, {input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG}, {input:"\\implies", tag:"mo", output:"\u21D2", ttype:LONG}, {input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG}, {input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST}, // disaster if LONG //commands with argument {input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY}, {input:"\\root", tag:"mroot", output:"root", ttype:BINARY}, {input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY}, {input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY}, {input:"\\atop", tag:"mfrac", output:"", ttype:INFIX}, {input:"\\choose", tag:"mfrac", output:"", ttype:INFIX}, {input:"_", tag:"msub", output:"_", ttype:INFIX}, {input:"^", tag:"msup", output:"^", ttype:INFIX}, {input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT}, {input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT}, //diacritical marks {input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true}, //{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true}, //{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true}, //{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true}, //{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true}, {input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true}, {input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true}, {input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true}, {input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true}, {input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true}, //{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true}, {input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true}, {input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true}, {input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true}, {input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true}, {input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true}, {input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true}, {input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true}, //{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true}, {input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true}, {input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true}, {input:"\\overbrace", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true}, {input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true}, {input:"\\underbrace", tag:"munder", output:"\u23B5", ttype:UNARY, acc:true}, {input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true}, //{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true}, //typestyles and fonts {input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY}, {input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY}, {input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY}, {input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY}, {input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION}, {input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY}, {input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY}, {input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY}, {input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY}, {input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY}, {input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY}, {input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY}, {input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb}, {input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal}, {input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk} ]; var LMnames = []; //list of input symbols function LMremoveCharsAndBlanks(str,n) { //remove n characters and any following blanks var st; st = str.slice(n); for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1); return st.slice(i); } function LMgetSymbol(str) { //return maximal initial substring of str that appears in names //return null if there is none var k = 0; //new pos var j = 0; //old pos var mk; //match pos var st; var tagst; var match = ""; var more = true; for (var i=1; i<=str.length && more; i++) { st = str.slice(0,i); //initial substring of length i j = k; k = position(LMnames, st, j); if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){ match = LMnames[k]; mk = k; i = match.length; } more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k]; } LMpreviousSymbol=LMcurrentSymbol; if (match!=""){ LMcurrentSymbol=LMsymbols[mk].ttype; return LMsymbols[mk]; } LMcurrentSymbol=CONST; k = 1; st = str.slice(0,1); //take 1 character if ("0"<=st && st<="9") tagst = "mn"; else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi"); /* // Commented out by DRW (not fully understood, but probably to do with // use of "/" as an INFIX version of "\\frac", which we don't want): //} //if (st=="-" && LMpreviousSymbol==INFIX) { // LMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse // return {input:st, tag:tagst, output:st, ttype:UNARY, func:true}; //} */ return {input:st, tag:tagst, output:st, ttype:CONST}; } /*Parsing ASCII math expressions with the following grammar v ::= [A-Za-z] | greek letters | numbers | other constant symbols u ::= sqrt | text | bb | other unary symbols for font commands b ::= frac | root | stackrel binary symbols l ::= { | \left left brackets r ::= } | \right right brackets S ::= v | lEr | uS | bSS Simple expression I ::= S_S | S^S | S_S^S | S Intermediate expression E ::= IE | I/I Expression Each terminal symbol is translated into a corresponding mathml node.*/ var LMpreviousSymbol,LMcurrentSymbol; function LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag] var symbol, node, result, result2, i, st,// rightvert = false, newFrag = document.createDocumentFragment(); str = LMremoveCharsAndBlanks(str,0); symbol = LMgetSymbol(str); //either a token or a bracket or empty if (symbol == null || symbol.ttype == RIGHTBRACKET) return [null,str,null]; if (symbol.ttype == DEFINITION) { str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length); symbol = LMgetSymbol(str); if (symbol == null || symbol.ttype == RIGHTBRACKET) return [null,str,null]; } str = LMremoveCharsAndBlanks(str,symbol.input.length); switch (symbol.ttype) { case SPACE: node = createMmlNode(symbol.tag); node.setAttribute(symbol.atname,symbol.atval); return [node,str,symbol.tag]; case UNDEROVER: if (isIE) { if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc. symbol = LMgetSymbol(str); symbol.ttype = UNDEROVER; str = LMremoveCharsAndBlanks(str,symbol.input.length); } } return [createMmlNode(symbol.tag, document.createTextNode(symbol.output)),str,symbol.tag]; case CONST: var output = symbol.output; if (isIE) { if (symbol.input == "'") output = "\u2032"; else if (symbol.input == "''") output = "\u2033"; else if (symbol.input == "'''") output = "\u2033\u2032"; else if (symbol.input == "''''") output = "\u2033\u2033"; else if (symbol.input == "\\square") output = "\u25A1"; // same as \Box else if (symbol.input.substr(0,5) == "\\frac") { // botch for missing fractions var denom = symbol.input.substr(6,1); if (denom == "5" || denom == "6") { str = symbol.input.replace(/\\frac/,"\\frac ")+str; return [node,str,symbol.tag]; } } } node = createMmlNode(symbol.tag,document.createTextNode(output)); return [node,str,symbol.tag]; case LONG: // added by DRW node = createMmlNode(symbol.tag,document.createTextNode(symbol.output)); node.setAttribute("minsize","1.5"); node.setAttribute("maxsize","1.5"); node = createMmlNode("mover",node); node.appendChild(createMmlNode("mspace")); return [node,str,symbol.tag]; case STRETCHY: // added by DRW if (isIE && symbol.input == "\\backslash") symbol.output = "\\"; // doesn't expand, but then nor does "\u2216" node = createMmlNode(symbol.tag,document.createTextNode(symbol.output)); if (symbol.input == "|" || symbol.input == "\\vert" || symbol.input == "\\|" || symbol.input == "\\Vert") { node.setAttribute("lspace","0em"); node.setAttribute("rspace","0em"); } node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here if (symbol.rtag != null) return [node,str,symbol.rtag]; else return [node,str,symbol.tag]; case BIG: // added by DRW var atval = symbol.atval; if (isIE) atval = symbol.ieval; symbol = LMgetSymbol(str); if (symbol == null) return [null,str,null]; str = LMremoveCharsAndBlanks(str,symbol.input.length); node = createMmlNode(symbol.tag,document.createTextNode(symbol.output)); if (isIE) { // to get brackets to expand var space = createMmlNode("mspace"); space.setAttribute("height",atval+"ex"); node = createMmlNode("mrow",node); node.appendChild(space); } else { // ignored in IE node.setAttribute("minsize",atval); node.setAttribute("maxsize",atval); } return [node,str,symbol.tag]; case LEFTBRACKET: //read (expr+) if (symbol.input == "\\left") { // left what? symbol = LMgetSymbol(str); if (symbol != null) { if (symbol.input == ".") symbol.invisible = true; str = LMremoveCharsAndBlanks(str,symbol.input.length); } } result = LMparseExpr(str,true,false); if (symbol==null || (typeof symbol.invisible == "boolean" && symbol.invisible)) node = createMmlNode("mrow",result[0]); else { node = createMmlNode("mo",document.createTextNode(symbol.output)); node = createMmlNode("mrow",node); node.appendChild(result[0]); } return [node,result[1],result[2]]; case MATRIX: //read (expr+) if (symbol.input == "\\begin{array}") { var mask = ""; symbol = LMgetSymbol(str); str = LMremoveCharsAndBlanks(str,0); if (symbol == null) mask = "l"; else { str = LMremoveCharsAndBlanks(str,symbol.input.length); if (symbol.input != "{") mask = "l"; else do { symbol = LMgetSymbol(str); if (symbol != null) { str = LMremoveCharsAndBlanks(str,symbol.input.length); if (symbol.input != "}") mask = mask+symbol.input; } } while (symbol != null && symbol.input != "" && symbol.input != "}"); } result = LMparseExpr("{"+str,true,true); // if (result[0]==null) return [createMmlNode("mo", // document.createTextNode(symbol.input)),str]; node = createMmlNode("mtable",result[0]); mask = mask.replace(/l/g,"left "); mask = mask.replace(/r/g,"right "); mask = mask.replace(/c/g,"center "); node.setAttribute("columnalign",mask); node.setAttribute("displaystyle","false"); if (isIE) return [node,result[1],null]; // trying to get a *little* bit of space around the array // (IE already includes it) var lspace = createMmlNode("mspace"); lspace.setAttribute("width","0.167em"); var rspace = createMmlNode("mspace"); rspace.setAttribute("width","0.167em"); var node1 = createMmlNode("mrow",lspace); node1.appendChild(node); node1.appendChild(rspace); return [node1,result[1],null]; } else { // eqnarray result = LMparseExpr("{"+str,true,true); node = createMmlNode("mtable",result[0]); if (isIE) node.setAttribute("columnspacing","0.25em"); // best in practice? else node.setAttribute("columnspacing","0.167em"); // correct (but ignored?) node.setAttribute("columnalign","right center left"); node.setAttribute("displaystyle","true"); node = createMmlNode("mrow",node); return [node,result[1],null]; } case TEXT: if (str.charAt(0)=="{") i=str.indexOf("}"); else i = 0; if (i==-1) i = str.length; st = str.slice(1,i); if (st.charAt(0) == " ") { node = createMmlNode("mspace"); node.setAttribute("width","0.33em"); // was 1ex newFrag.appendChild(node); } newFrag.appendChild( createMmlNode(symbol.tag,document.createTextNode(st))); if (st.charAt(st.length-1) == " ") { node = createMmlNode("mspace"); node.setAttribute("width","0.33em"); // was 1ex newFrag.appendChild(node); } str = LMremoveCharsAndBlanks(str,i+1); return [createMmlNode("mrow",newFrag),str,null]; case UNARY: result = LMparseSexpr(str); if (result[0]==null) return [createMmlNode(symbol.tag, document.createTextNode(symbol.output)),str]; if (typeof symbol.func == "boolean" && symbol.func) { // functions hack st = str.charAt(0); // if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") { if (st=="^" || st=="_" || st==",") { return [createMmlNode(symbol.tag, document.createTextNode(symbol.output)),str,symbol.tag]; } else { node = createMmlNode("mrow", createMmlNode(symbol.tag,document.createTextNode(symbol.output))); if (isIE) { var space = createMmlNode("mspace"); space.setAttribute("width","0.167em"); node.appendChild(space); } node.appendChild(result[0]); return [node,result[1],symbol.tag]; } } if (symbol.input == "\\sqrt") { // sqrt if (isIE) { // set minsize, for \surd var space = createMmlNode("mspace"); space.setAttribute("height","1.2ex"); space.setAttribute("width","0em"); // probably no effect node = createMmlNode(symbol.tag,result[0]) // node.setAttribute("minsize","1"); // ignored // node = createMmlNode("mrow",node); // hopefully unnecessary node.appendChild(space); return [node,result[1],symbol.tag]; } else return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag]; } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent node = createMmlNode(symbol.tag,result[0]); var output = symbol.output; if (isIE) { if (symbol.input == "\\hat") output = "\u0302"; else if (symbol.input == "\\widehat") output = "\u005E"; else if (symbol.input == "\\bar") output = "\u00AF"; else if (symbol.input == "\\grave") output = "\u0300"; else if (symbol.input == "\\tilde") output = "\u0303"; } var node1 = createMmlNode("mo",document.createTextNode(output)); if (symbol.input == "\\vec" || symbol.input == "\\check") // don't allow to stretch node1.setAttribute("maxsize","1.2"); // why doesn't "1" work? \vec nearly disappears in firefox if (isIE && symbol.input == "\\bar") node1.setAttribute("maxsize","0.5"); if (symbol.input == "\\underbrace" || symbol.input == "\\underline") node1.setAttribute("accentunder","true"); else node1.setAttribute("accent","true"); node.appendChild(node1); if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace") node.ttype = UNDEROVER; return [node,result[1],symbol.tag]; } else { // font change or displaystyle command if (!isIE && typeof symbol.codes != "undefined") { for (i=0; i<result[0].childNodes.length; i++) if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") { st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue: result[0].childNodes[i].firstChild.nodeValue); var newst = []; for (var j=0; j<st.length; j++) if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst + String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]); else newst = newst + st.charAt(j); if (result[0].nodeName=="mi") result[0]=createMmlNode("mo"). appendChild(document.createTextNode(newst)); else result[0].replaceChild(createMmlNode("mo"). appendChild(document.createTextNode(newst)),result[0].childNodes[i]); } } node = createMmlNode(symbol.tag,result[0]); node.setAttribute(symbol.atname,symbol.atval); if (symbol.input == "\\scriptstyle" || symbol.input == "\\scriptscriptstyle") node.setAttribute("displaystyle","false"); return [node,result[1],symbol.tag]; } case BINARY: result = LMparseSexpr(str); if (result[0]==null) return [createMmlNode("mo", document.createTextNode(symbol.input)),str,null]; result2 = LMparseSexpr(result[1]); if (result2[0]==null) return [createMmlNode("mo", document.createTextNode(symbol.input)),str,null]; if (symbol.input=="\\root" || symbol.input=="\\stackrel") newFrag.appendChild(result2[0]); newFrag.appendChild(result[0]); if (symbol.input=="\\frac") newFrag.appendChild(result2[0]); return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag]; case INFIX: str = LMremoveCharsAndBlanks(str,symbol.input.length); return [createMmlNode("mo",document.createTextNode(symbol.output)), str,symbol.tag]; default: return [createMmlNode(symbol.tag, //its a constant document.createTextNode(symbol.output)),str,symbol.tag]; } } function LMparseIexpr(str) { var symbol, sym1, sym2, node, result, tag, underover; str = LMremoveCharsAndBlanks(str,0); sym1 = LMgetSymbol(str); result = LMparseSexpr(str); node = result[0]; str = result[1]; tag = result[2]; symbol = LMgetSymbol(str); if (symbol.ttype == INFIX) { str = LMremoveCharsAndBlanks(str,symbol.input.length); result = LMparseSexpr(str); if (result[0] == null) // show box in place of missing argument result[0] = createMmlNode("mo",document.createTextNode("\u25A1")); str = result[1]; tag = result[2]; if (symbol.input == "_" || symbol.input == "^") { sym2 = LMgetSymbol(str); tag = null; // no space between x^2 and a following sin, cos, etc. // This is for \underbrace and \overbrace underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER)); // underover = (sym1.ttype == UNDEROVER); if (symbol.input == "_" && sym2.input == "^") { str = LMremoveCharsAndBlanks(str,sym2.input.length); var res2 = LMparseSexpr(str); str = res2[1]; tag = res2[2]; // leave space between x_1^2 and a following sin etc. node = createMmlNode((underover?"munderover":"msubsup"),node); node.appendChild(result[0]); node.appendChild(res2[0]); } else if (symbol.input == "_") { node = createMmlNode((underover?"munder":"msub"),node); node.appendChild(result[0]); } else { node = createMmlNode((underover?"mover":"msup"),node); node.appendChild(result[0]); } node = createMmlNode("mrow",node); // so sum does not stretch } else { node = createMmlNode(symbol.tag,node); if (symbol.input == "\\atop" || symbol.input == "\\choose") node.setAttribute("linethickness","0ex"); node.appendChild(result[0]); if (symbol.input == "\\choose") node = createMmlNode("mfenced",node); } } return [node,str,tag]; } function LMparseExpr(str,rightbracket,matrix) { var symbol, node, result, i, tag, newFrag = document.createDocumentFragment(); do { str = LMremoveCharsAndBlanks(str,0); result = LMparseIexpr(str); node = result[0]; str = result[1]; tag = result[2]; symbol = LMgetSymbol(str); if (node!=undefined) { if ((tag == "mn" || tag == "mi") && symbol!=null && typeof symbol.func == "boolean" && symbol.func) { // Add space before \sin in 2\sin x or x\sin x var space = createMmlNode("mspace"); space.setAttribute("width","0.167em"); node = createMmlNode("mrow",node); node.appendChild(space); } newFrag.appendChild(node); } } while ((symbol.ttype != RIGHTBRACKET) && symbol!=null && symbol.output!=""); tag = null; if (symbol.ttype == RIGHTBRACKET) { if (symbol.input == "\\right") { // right what? str = LMremoveCharsAndBlanks(str,symbol.input.length); symbol = LMgetSymbol(str); if (symbol != null && symbol.input == ".") symbol.invisible = true; if (symbol != null) tag = symbol.rtag; } if (symbol!=null) str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return var len = newFrag.childNodes.length; if (matrix && len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 && newFrag.childNodes[len-2].nodeName == "mo" && newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix var pos = []; // positions of ampersands var m = newFrag.childNodes.length; for (i=0; matrix && i<m; i=i+2) { pos[i] = []; node = newFrag.childNodes[i]; for (var j=0; j<node.childNodes.length; j++) if (node.childNodes[j].firstChild.nodeValue=="&") pos[i][pos[i].length]=j; } var row, frag, n, k, table = document.createDocumentFragment(); for (i=0; i<m; i=i+2) { row = document.createDocumentFragment(); frag = document.createDocumentFragment(); node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow> n = node.childNodes.length; k = 0; for (j=0; j<n; j++) { if (typeof pos[i][k] != "undefined" && j==pos[i][k]){ node.removeChild(node.firstChild); //remove & row.appendChild(createMmlNode("mtd",frag)); k++; } else frag.appendChild(node.firstChild); } row.appendChild(createMmlNode("mtd",frag)); if (newFrag.childNodes.length>2) { newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow> newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo> } table.appendChild(createMmlNode("mtr",row)); } return [table,str]; } if (typeof symbol.invisible != "boolean" || !symbol.invisible) { node = createMmlNode("mo",document.createTextNode(symbol.output)); newFrag.appendChild(node); } } return [newFrag,str,tag]; } var tcnt = 0, dcnt = 0; //theorem and definition counters function simpleLaTeXformatting(st) { st = st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>"); st = st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"}); st = st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")}); st = st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return "<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" &#x25A1;"}); st = st.replace(/\\emph{(.*?)}/g,"<em>$1</em>"); st = st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>"); st = st.replace(/\\cite{(.*?)}/g,"[$1]"); st = st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>"); st = st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>"); st = st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>"); st = st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>"); st = st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>"); st = st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>"); st = st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>"); st = st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>"); st = st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>"); st = st.replace(/\\begin{description}/g,"<dl>"); st = st.replace(/\\end{description}/g,"</dl>"); st = st.replace(/\\newline\b/g,"<br/>"); st = st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">"); st = st.replace(/\\par\b/g,"<p>&nbsp;</p>"); st = st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\">&nbsp;</p>"); st = st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\">&nbsp;</p>"); st = st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\">&nbsp;</p>"); st = st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>"); return st } function ASCIIandgraphformatting(st) { st = st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3"); //st = st.replace(/<\/?font.*?>/gi,""); // do this only in amath...endamath st = st.replace(/(Proof:)/g,"<i>$1</i>"); st = st.replace(/QED/g,"&nbsp; &nbsp; &#x25A1;"); st = st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1"); st = st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1"); st = st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>"); st = st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\""); st = st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return "<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"}); st = st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>"); //alert(dsvglocation) return st } function LMprocessNode(n) { var frag,st; try { st = n.innerHTML; } catch(err) {} var am = /amath\b|graph/i.test(st); if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 || st.indexOf("\\begin")!=-1 || am || st.slice(-1)=="$" || st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){ if (!avoidinnerHTML && translateLaTeXformatting) st = simpleLaTeXformatting(st); if (st!=null && am && !avoidinnerHTML) { st = ASCIIandgraphformatting(st); } st = st.replace(/%7E/g,"~"); // else PmWiki has url issues //alert(st) if (!avoidinnerHTML) n.innerHTML = st; processNodeR(n,false,true); } /* if (isIE) { //needed to match size and font of formula to surrounding text frag = document.getElementsByTagName('math'); for (var i=0;i<frag.length;i++) frag[i].update() //is this really needed? }*/ } /* ASCIIsvg.js ============== JavaScript routines to dynamically generate Scalable Vector Graphics using a mathematical xy-coordinate system (y increases upwards) and very intuitive JavaScript commands (no programming experience required). ASCIIsvg.js is good for learning math and illustrating online math texts. Works with Internet Explorer+Adobe SVGviewer and SVG enabled Mozilla/Firefox. Ver 1.2.9 July 31, 2007 (c) Peter Jipsen http://www.chapman.edu/~jipsen Latest version at http://math.chapman.edu/~jipsen/math/pub/ASCIIsvg.js If you use it on a webpage, please send the URL to jipsen@chapman.edu This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (at http://www.gnu.org/license/lgpl.html) for more details.*/ // you can change these var checkIfSVGavailable = true; var notifyIfNoSVG = true; var alertIfNoSVG = false; var noSVG = false; // global defaults used if not specified by graph (you can change these) var defaultwidth = 300; defaultheight = 200; // in pixels var defaultxmin = -5.5; defaultxmax = 5.5; // in usercoords var defaultborder = 0; border = defaultborder; // in pixel var defaultstrokewidth = "1"; // default line width in pixel var defaultstroke = "blue"; // default line color var defaultstrokeopacity = 1; // transparent = 0, solid =1 var defaultstrokedasharray = null; // "10,10" gives 10px long dashes var defaultfill = "none"; // default fill color var defaultfillopacity = 1; // transparent = 0, solid =1 var defaultfontstyle = "normal"; // default text shape normal|italic|inherit var defaultfontfamily = "times"; // default font times|ariel|helvetica|... var defaultfontsize = "16"; // default size (scaled automatically) var defaultfontweight = "normal";// normal|bold|bolder|lighter|100|...|900 var defaultfontstroke = "none"; // default font outline color var defaultfontfill = "none"; // default font color var defaultmarker = "none"; // "dot" | "arrow" | "+" | "-" | "|" var defaultendpoints = ""; // "c-d" where c is <|o|* and d is >|o|* // global values used for all pictures (you can change these) var showcoordinates = true; var markerstrokewidth = "1"; var markerstroke = "black"; var markerfill = "yellow"; var markersize = 4; var arrowfill = stroke; var dotradius = 4; var ticklength = 4; var axesstroke = "black"; var gridstroke = "grey"; var backgroundstyle = "fill-opacity:1; fill:white"; var singlelettersitalic = true; // internal variables (probably no need to change these) var picturepos = null; // position of picture relative to top of HTML page var xunitlength; // in pixels, used to convert to user coordinates var yunitlength; // in pixels var origin = [0,0]; // in pixels (default is bottom left corner) var above = "above"; // shorthands (to avoid typing quotes) var below = "below"; var left = "left"; var right = "right"; var aboveleft = "aboveleft"; var aboveright = "aboveright"; var belowleft = "belowleft"; var belowright = "belowright"; var xmin, xmax, ymin, ymax, xscl, yscl, xgrid, ygrid, xtick, ytick, initialized; var strokewidth, strokedasharray, stroke, fill, strokeopacity, fillopacity; var fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill; var marker, endpoints, dynamic = {}; var picture, svgpicture, doc, width, height; var isIE = document.createElementNS==null; var cpi = "\u03C0", ctheta = "\u03B8"; // character for pi, theta var log = function(x) { return ln(x)/ln(10) }; var pi = Math.PI, e = Math.E, ln = Math.log, sqrt = Math.sqrt; var floor = Math.floor, ceil = Math.ceil, abs = Math.abs; var sin = Math.sin, cos = Math.cos, tan = Math.tan; var arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan; var sec = function(x) { return 1/Math.cos(x) }; var csc = function(x) { return 1/Math.sin(x) }; var cot = function(x) { return 1/Math.tan(x) }; var arcsec = function(x) { return arccos(1/x) }; var arccsc = function(x) { return arcsin(1/x) }; var arccot = function(x) { return arctan(1/x) }; var sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 }; var cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 }; var tanh = function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) }; var sech = function(x) { return 1/cosh(x) }; var csch = function(x) { return 1/sinh(x) }; var coth = function(x) { return 1/tanh(x) }; var arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) }; var arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) }; var arctanh = function(x) { return ln((1+x)/(1-x))/2 }; var sech = function(x) { return 1/cosh(x) }; var csch = function(x) { return 1/sinh(x) }; var coth = function(x) { return 1/tanh(x) }; var arcsech = function(x) { return arccosh(1/x) }; var arccsch = function(x) { return arcsinh(1/x) }; var arccoth = function(x) { return arctanh(1/x) }; var sign = function(x) { return (x==0?0:(x<0?-1:1)) }; function factorial(x,n) { // Factorial function if (n==null) n=1; if (Math.abs(x-Math.round(x*1000000)/1000000)<1e-15) x = Math.round(x*1000000)/1000000; if (x-Math.floor(x)!=0) return NaN; for (var i=x-n; i>0; i-=n) x*=i; return (x<0?NaN:(x==0?1:x)); } function C(x,k) { // Binomial coefficient function var res=1; for (var i=0; i<k; i++) res*=(x-i)/(k-i); return res; } function chop(x,n) { // Truncate decimal number to n places after decimal point if (n==null) n=0; return Math.floor(x*Math.pow(10,n))/Math.pow(10,n); } function ran(a,b,n) { // Generate random number in [a,b] with n digits after . if (n==null) n=0; return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n); } function myCreateElementSVG(t) { if (isIE) return doc.createElement(t); else return doc.createElementNS("http://www.w3.org/2000/svg",t); } function getElementsByClass(container, tagName, clsName){ var list = new Array(0); var collection = container.getElementsByTagName(tagName); for(var i = 0; i < collection.length; i++) if(collection[i].className.slice(0,clsName.length)==clsName) list[list.length] = collection[i]; return list; } function showobj(obj) { var st="", i; for (i in obj) st += (obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i)); return st; } function findPos(obj) { // top-left corner of obj on HTML page in pixel var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop //alert(showobj(obj)+[curleft,curtop]) } } return [curleft,curtop]; } function checkSVG(){ if (navigator.appName.slice(0,8)=="Netscape") if (window['SVGElement']) noSVG = null; else noSVG = true; else if (navigator.appName.slice(0,9)=="Microsoft") try { var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');"); noSVG = null; } catch (e) { noSVG = true; } else if (navigator.appName.slice(0,5)=="Opera") // works only for 9.50b1 noSVG = null; else noSVG = true; //noSVG = true; //uncomment to check if (noSVG && notifyIfNoSVG) { var msg = "To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later." if (alertIfNoSVG) alert(msg); else return msg; } } function setText(st,id) { // add text to an existing node with given id var node = document.getElementById(id); if (node!=null) if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st; else node.appendChild(document.createTextNode(st)); } function getX(evt) { // return mouse x-coord in user coordinate system var svgroot = evt.target.parentNode; pos = findPos(svgroot.parentNode); return (evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength")); } function getY(evt) { // return mouse y-coord in user coordinate system var svgroot = evt.target.parentNode; pos = findPos(svgroot.parentNode); //alert(showobj(svgroot)+svgroot.getAttribute("mytop")) return (svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength")); } function translateandeval(src) { //modify user input to JavaScript syntax var errstr; // replace plot(f(x),...) with plot("f(x)",...) src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\","); src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")"); // replace (expr,expr) by [expr,expr] where expr has no (,) in it src = src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]"); //alert(src) // insert * between digit and letter e.g. 2x --> 2*x src = src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2"); src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1"); try { with (Math) eval(src); // here the svgpicture object is created } catch(err) { if (err!="wait") { //alert(dsvglocation) if (typeof err=="object") errstr = err.name+" "+err.message+" "+err.number+" "+err.description; else errstr = err; alert(errstr+"\n"+src) } } } var lastSlot = 0; function drawPictures() { // main routine; called after webpage has loaded var src, id, dsvg, nd, node, ht, index, cols, arr, i, node2; var ASbody = document.getElementsByTagName("body")[0]; pictures = getElementsByClass(ASbody,"embed","ASCIIsvg"); var len = pictures.length; if(len==0) return; for (index = lastSlot; index < len+lastSlot; index++) { width = null; height = null; xmin = null; xmax = null; ymin = null; ymax = null; xscl = null; xgrid = null; yscl = null; ygrid = null; initialized = false; picture = pictures[index-lastSlot]; // current picture object src = picture.getAttribute("script"); // get the ASCIIsvg code if (src==null) src = ""; // insert "axes()" if not present ******** experimental if (!/axes\b|initPicture/.test(src)) { var i = 0; while (/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i))) i++; src = (i==0?"axes(); "+src: src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();")); } ht = picture.getAttribute("height"); if (isIE) { picture.setAttribute("wmode","transparent"); //alert("*"+picture.getAttribute("src")+dsvglocation); //adding d.svg dynamically greates problems in IE... // if (picture.getAttribute("src")=="") picture.setAttribute("src",dsvglocation+"d.svg"); } if (document.getElementById("picture"+(index+1)+"mml")==null) { picture.parentNode.style.position = "relative"; node = createElementXHTML("div"); node.style.position = "absolute"; node.style.top = "0px"; node.style.left = "0px"; node.setAttribute("id","picture"+(index+1)+"mml"); picture.parentNode.insertBefore(node,picture.nextSibling); } if (ht==null) ht =""; // if (ht!="") defaultborder = 25; if (ht=="" || src=="") if (document.getElementById("picture"+(index+1)+"input")==null) { node = createElementXHTML("textarea"); arr = src.split("\n"); cols = 0; for (i=0;i<arr.length;i++) cols = Math.max(cols,arr[i].length); node.setAttribute("rows",Math.min(10,arr.length)+1); node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5); // node.setAttribute("style","display:block"); if (isIE) src = src.replace(/([^\r])\n/g,"$1\r"); node.appendChild(document.createTextNode(src)); if (src.indexOf("showcode()")==-1) node.style.display = "none"; node.setAttribute("id","picture"+(index+1)+"input"); picture.parentNode.insertBefore(node,picture.nextSibling); picture.parentNode.insertBefore(createElementXHTML("br"),node); node2 = createElementXHTML("button"); node2.setAttribute("id","picture"+(index+1)+"button"); if (isIE) node2.onclick = function() {updatePicture(this)}; else node2.setAttribute("onclick","updatePicture(this)"); node2.appendChild(document.createTextNode("Update")); if (src.indexOf("showcode()")==-1) node2.style.display = "none"; picture.parentNode.insertBefore(node2,node); // picture.parentNode.insertBefore(document.createTextNode("ASCII"),node); picture.parentNode.insertBefore(createElementXHTML("br"),node); } else src = document.getElementById("picture"+(index+1)+"input").value; id = picture.getAttribute("id"); dsvg = picture.getAttribute("src"); if (id == null || id == "") { id = "picture"+(index+1); picture.setAttribute("id",id); } translateandeval(src); } lastSlot+=len; } function setdefaults() { //called before each graph is evaluated strokewidth = defaultstrokewidth; stroke = defaultstroke; strokeopacity = defaultstrokeopacity; strokedasharray = defaultstrokedasharray; fill = defaultfill; fillopacity = defaultfillopacity; fontstyle = defaultfontstyle; fontfamily = defaultfontfamily; fontsize = defaultfontsize; fontweight = defaultfontweight; fontstroke = defaultfontstroke; fontfill = defaultfontfill; marker = defaultmarker; endpoints = defaultendpoints; } function switchTo(id) { // used by dynamic code to select appropriate graph if (id==undefined) return; var name = id; if (typeof name!="string") name = id.target.parentNode.getAttribute("name"); picture = document.getElementById(name); width = picture.getAttribute("width")-0; height = picture.getAttribute("height")-0; setdefaults(); if ((picture.nodeName == "EMBED" || picture.nodeName == "embed") && isIE) { svgpicture = picture.getSVGDocument().getElementById("root"); doc = picture.getSVGDocument(); } else { svgpicture = picture; doc = document; } xunitlength = parseFloat(svgpicture.getAttribute("xunitlength")); yunitlength = parseFloat(svgpicture.getAttribute("yunitlength")); xmin = parseFloat(svgpicture.getAttribute("xmin")); xmax = parseFloat(svgpicture.getAttribute("xmax")); ymin = parseFloat(svgpicture.getAttribute("ymin")); ymax = parseFloat(svgpicture.getAttribute("ymax")); origin = [svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0]; } function updatePicture(obj) { var node, src, id, top, left; if (typeof obj=="object") id = obj.id.slice(0,-6); else id = (typeof obj=="string"?obj:"picture"+(obj+1)); src = document.getElementById(id+"input").value; xmin = null; xmax = null; ymin = null; ymax = null; xscl = null; xgrid = null; yscl = null; ygrid = null; initialized = false; picture = document.getElementById(id); translateandeval(src) } function changepicturesize(evt,factor) { var obj = evt.target; var name = obj.parentNode.getAttribute("name"); var pic = document.getElementById(name); var src = document.getElementById(name+"input").value; if (!/height/.test(src)) src = "height=0; "+src; if (!/width/.test(src)) src = "width=0; "+src; src = src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0))); src = src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0))); document.getElementById(name+"input").value = src; //alert(getKey(evt.keycode)) updatePicture(name); } function zoom(evt,factor) { switchTo(evt); var obj = evt.target; var name = obj.parentNode.getAttribute("name"); var pic = document.getElementById(name); var src = document.getElementById(name+"input").value; var xlen = (xmax-xmin)/2; var ylen = (ymax-ymin)/2; var xcen = getX(evt), ycen = getY(evt); if (!/ymax/.test(src)) src = "ymax=0; "+src; if (!/ymin/.test(src)) src = "ymin=0; "+src; if (!/xmax/.test(src)) src = "xmax=0; "+src; if (!/xmin/.test(src)) src = "xmin=0; "+src; src = src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen)); src = src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen)); src = src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen)); src = src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen)); document.getElementById(name+"input").value = src; updatePicture(name); } var sinceFirstClick = 0; // ondblclick simulation from var dblClkTimer; // http://www.enja.org/david/?cat=13 Thanks! function timer() { if(sinceFirstClick<60) { sinceFirstClick++; setTimeout("timer()",10); } else { clearTimeout(dblClkTimer); dblClkTimer = ""; } } function mClick(evt) { if(sinceFirstClick!=0) { if(sinceFirstClick <= 40) { if (evt.shiftKey) { if (evt.altKey) changepicturesize(evt,2); else zoom(evt,.5); } else if (evt.altKey) zoom(evt,2);//changepicturesize(evt,.5); else showHideCode(evt); // do this on dblclick clearTimeout(dblClkTimer); dblClkTimer = ""; } else { clearTimeout(dblClkTimer); sinceFirstClick = 0; dblClkTimer = setTimeout("timer()",10); } } else { sinceFirstClick = 0; dblClkTimer = setTimeout("timer()",10); } } function showHideCode(evt) { // called by onclick event // if (evt.getDetail()==2) {//getDetail unfortunately not in Firefox var obj=evt.target; var name = obj.parentNode.getAttribute("name"); var node = document.getElementById(name+"input"); node.style.display = (node.style.display == "none"?"":"none"); var node = document.getElementById(name+"button"); node.style.display = (node.style.display == "none"?"":"none"); // } } function showcode() {} // do nothing function setBorder(x) { border = x } //deprecate function initPicture(x_min,x_max,y_min,y_max) { // set up the graph // usually called by axes() or noaxes(), but can be used directly if (!initialized) { setdefaults(); initialized = true; if (x_min!=null) xmin = x_min; if (x_max!=null) xmax = x_max; if (y_min!=null) ymin = y_min; if (y_max!=null) ymax = y_max; if (xmin==null) xmin = defaultxmin; if (xmax==null) xmax = defaultxmax; if (typeof xmin != "number" || typeof xmax != "number" || xmin >= xmax) alert("Picture requires at least two numbers: xmin < xmax"); else if (y_max != null && (typeof y_min != "number" || typeof y_max != "number" || y_min >= y_max)) alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax"); else { if (width==null) { width = picture.getAttribute("width"); if (width==null || width=="") width=defaultwidth; } picture.setAttribute("width",width); if (height==null) { height = picture.getAttribute("height"); if (height==null || height=="") height=defaultheight; } picture.setAttribute("height",height); xunitlength = (width-2*border)/(xmax-xmin); yunitlength = xunitlength; //alert(xmin+" "+xmax+" "+ymin+" "+ymax) if (ymin==null) { origin = [-xmin*xunitlength+border,height/2]; ymin = -(height-2*border)/(2*yunitlength); ymax = -ymin; } else { if (ymax!=null) yunitlength = (height-2*border)/(ymax-ymin); else ymax = (height-2*border)/yunitlength + ymin; origin = [-xmin*xunitlength+border,-ymin*yunitlength+border]; } if (isIE) { if (picture.FULLSCREEN==undefined) { setTimeout('drawPictures()',50); throw "wait"; } svgpicture = picture.getSVGDocument().getElementById("root"); if (svgpicture==null) { setTimeout('drawPictures()',50); throw "wait"; } svgpicture = picture.getSVGDocument().getElementById("root"); while (svgpicture.childNodes.length>0) svgpicture.removeChild(svgpicture.lastChild); svgpicture.setAttribute("width",width); svgpicture.setAttribute("height",height); svgpicture.setAttribute("name",picture.getAttribute("id")); doc = picture.getSVGDocument(); } else { var qnode = document.createElementNS("http://www.w3.org/2000/svg","svg"); qnode.setAttribute("id",picture.getAttribute("id")); qnode.setAttribute("name",picture.getAttribute("id")); // qnode.setAttribute("style","display:inline"); qnode.setAttribute("width",picture.getAttribute("width")); qnode.setAttribute("height",picture.getAttribute("height")); picturepos = findPos(picture); // qnode.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"); if (picture.parentNode!=null) { picture.parentNode.replaceChild(qnode,picture); } else { svgpicture.parentNode.replaceChild(qnode,svgpicture); } svgpicture = qnode; doc = document; } var nd = document.getElementById(picture.getAttribute("id")+"mml"); if (nd!=null) // clear out MathML layer while (nd.childNodes.length>0) nd.removeChild(nd.lastChild); svgpicture.setAttribute("xunitlength",xunitlength); svgpicture.setAttribute("yunitlength",yunitlength); svgpicture.setAttribute("xmin",xmin); svgpicture.setAttribute("xmax",xmax); svgpicture.setAttribute("ymin",ymin); svgpicture.setAttribute("ymax",ymax); svgpicture.setAttribute("ox",origin[0]); svgpicture.setAttribute("oy",origin[1]); var node = myCreateElementSVG("rect"); node.setAttribute("x","0"); node.setAttribute("y","0"); node.setAttribute("width",width); node.setAttribute("height",height); node.setAttribute("style",backgroundstyle); svgpicture.appendChild(node); svgpicture.setAttribute("onmousemove","displayCoord(evt)"); svgpicture.setAttribute("onmouseout","removeCoord(evt)"); svgpicture.setAttribute("onclick","mClick(evt)"); node = myCreateElementSVG("text"); // used for displayCoord node.appendChild(doc.createTextNode(" ")); node.setAttribute("id","coords"); svgpicture.appendChild(node); node = myCreateElementSVG("text"); // used for text display node.appendChild(doc.createTextNode(" ")); node.setAttribute("id","coords"); svgpicture.appendChild(node); border = defaultborder; } } } //////////////////////////user graphics commands start///////////////////////// function line(p,q,id,endpts) { // segment connecting points p,q (coordinates in units) var node; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("path"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+ (height-p[1]*yunitlength-origin[1])+" "+ (q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1])); node.setAttribute("stroke-width", strokewidth); if (strokedasharray!=null) node.setAttribute("stroke-dasharray", strokedasharray); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); if (marker=="dot" || marker=="arrowdot") { ASdot(p,markersize,markerstroke,markerfill); if (marker=="arrowdot") arrowhead(p,q); ASdot(q,markersize,markerstroke,markerfill); } else if (marker=="arrow") arrowhead(p,q); if (endpts==null && endpoints!="") endpts = endpoints; if (endpts!=null) { if (endpts.indexOf("<-") != -1) arrowhead(q,p); if (endpts.indexOf("o-") != -1) dot(p, "open"); if (endpts.indexOf("*-") != -1) dot(p, "closed"); if (endpts.indexOf("->") != -1) arrowhead(p,q); if (endpts.indexOf("-o") != -1) dot(q, "open"); if (endpts.indexOf("-*") != -1) dot(q, "closed"); } } function path(plist,id,c,endpts) { if (c==null) c=""; var node, st, i; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("path"); node.setAttribute("id", id); svgpicture.appendChild(node); } if (typeof plist == "string") st = plist; else { st = "M"; st += (plist[0][0]*xunitlength+origin[0])+","+ (height-plist[0][1]*yunitlength-origin[1])+" "+c; for (i=1; i<plist.length; i++) st += (plist[i][0]*xunitlength+origin[0])+","+ (height-plist[i][1]*yunitlength-origin[1])+" "; } node.setAttribute("d", st); node.setAttribute("stroke-width", strokewidth); if (strokedasharray!=null) node.setAttribute("stroke-dasharray", strokedasharray); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); if (marker=="dot" || marker=="arrowdot") for (i=0; i<plist.length; i++) if (c!="C" && c!="T" || i!=1 && i!=2) ASdot(plist[i],markersize,markerstroke,markerfill); if (endpts==null && endpoints!="") endpts = endpoints; if (endpts!=null) { if (endpts.indexOf("<-") != -1) arrowhead(plist[1],plist[0]); if (endpts.indexOf("o-") != -1) dot(plist[0], "open"); if (endpts.indexOf("*-") != -1) dot(plist[0], "closed"); if (endpts.indexOf("->") != -1) arrowhead(plist[plist.length-2],plist[plist.length-1]); if (endpts.indexOf("-o") != -1) dot(plist[plist.length-1], "open"); if (endpts.indexOf("-*") != -1) dot(plist[plist.length-1], "closed"); } } function curve(plist,id,endpts) { path(plist,id,"T",endpts); } function vector(p,q,id) { line(p,q,id,"","->"); } function circle(center,radius,id) { // coordinates in units var node; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("circle"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("cx",center[0]*xunitlength+origin[0]); node.setAttribute("cy",height-center[1]*yunitlength-origin[1]); node.setAttribute("r",radius*xunitlength); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); } function loop(p,d,id) { // d is a direction vector e.g. [1,0] means loop starts in that direction if (d==null) d=[1,0]; path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C"); if (marker=="arrow" || marker=="arrowdot") arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1], p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p); } function arc(start,end,radius,id,largearc) { // coordinates in units var node, v; //alert([fill, stroke, origin, xunitlength, yunitlength, height]) if (id!=null) node = doc.getElementById(id); if (largearc==null) largearc=0; if (radius==null) { v=[end[0]-start[0],end[1]-start[1]]; radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]); } if (node==null) { node = myCreateElementSVG("path"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+ (height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+ radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+ (height-end[1]*yunitlength-origin[1])); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); if (marker=="arrow" || marker=="arrowdot") { u = [(end[1]-start[1])/4,(start[0]-end[0])/4]; v = [(end[0]-start[0])/2,(end[1]-start[1])/2]; //alert([u,v]) v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]]; } else v=[start[0],start[1]]; if (marker=="dot" || marker=="arrowdot") { ASdot(start,markersize,markerstroke,markerfill); if (marker=="arrowdot") arrowhead(v,end); ASdot(end,markersize,markerstroke,markerfill); } else if (marker=="arrow") arrowhead(v,end); } function sector(center,start,end,id) { // center,start,end should be isoceles var rx = start[0]-center[0], ry = start[1]-center[1]; arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc"); path([end,center,start],id+"path"); } function ellipse(center,rx,ry,id) { // coordinates in units var node; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("ellipse"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("cx",center[0]*xunitlength+origin[0]); node.setAttribute("cy",height-center[1]*yunitlength-origin[1]); node.setAttribute("rx",rx*xunitlength); node.setAttribute("ry",ry*yunitlength); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); } function triangle(p,q,r,id) { path([p,q,r,p],id) } function rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii var node; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("rect"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("x",p[0]*xunitlength+origin[0]); node.setAttribute("y",height-q[1]*yunitlength-origin[1]); node.setAttribute("width",(q[0]-p[0])*xunitlength); node.setAttribute("height",(q[1]-p[1])*yunitlength); if (rx!=null) node.setAttribute("rx",rx*xunitlength); if (ry!=null) node.setAttribute("ry",ry*yunitlength); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); node.setAttribute("fill", fill); node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); } function text(p,st,pos,id,fontsty) { var dnode, node, dx = 0, dy = fontsize/3, str = st.toString(); if (/(`|\$)/.test(str)) { // layer for ASCIIMathML and LaTeXMathML dnode = document.getElementById(svgpicture.getAttribute("name")+"mml"); if (dnode!=null) { if (id!=null) node = document.getElementById(id); if (node==null) { //alert(dnode.childNodes.length) node = createElementXHTML("div"); node.setAttribute("id", id); node.style.position = "absolute"; dnode.appendChild(node); } while (node.childNodes.length>0) node.removeChild(node.lastChild); node.appendChild(document.createTextNode(str)); if (/`/.test(str)) AMprocessNode(node); else LMprocessNode(node); dx = -node.offsetWidth/2; dy = -node.offsetHeight/2; if (pos!=null) { if (/above/.test(pos)) dy = -node.offsetHeight; if (/below/.test(pos)) dy = 0; if (/right/.test(pos)) dx = 0; if ( /left/.test(pos)) dx = -node.offsetWidth; } node.style.left = ""+(p[0]*xunitlength+origin[0]+dx)+"px"; node.style.top = ""+(height-p[1]*yunitlength-origin[1]+dy)+"px"; } return p; } var textanchor = "middle"; // regular text goes into SVG if (pos!=null) { if (/above/.test(pos)) dy = -fontsize/2; if (/below/.test(pos)) dy = fontsize-0; if (/right/.test(pos)) {textanchor = "start"; dx = fontsize/4;} if ( /left/.test(pos)) {textanchor = "end"; dx = -fontsize/4;} } if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("text"); node.setAttribute("id", id); svgpicture.appendChild(node); node.appendChild(doc.createTextNode(str)); } while (node.childNodes.length>1) node.removeChild(node.lastChild); node.lastChild.nodeValue = "\xA0"+str+"\xA0"; node.setAttribute("x",p[0]*xunitlength+origin[0]+dx); node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy); node.setAttribute("font-style",(fontsty!=null?fontsty: (str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle))); node.setAttribute("font-family",fontfamily); node.setAttribute("font-size",fontsize); node.setAttribute("font-weight",fontweight); node.setAttribute("text-anchor",textanchor); if (fontstroke!="none") node.setAttribute("stroke",fontstroke); if (fontfill!="none") node.setAttribute("fill",fontfill); return p; } function mtext(p,st,pos,fontsty,fontsz) { // method for updating text on an svg // "this" is the text object or the svgpicture object var textanchor = "middle"; var dx = 0; var dy = fontsize/3; if (pos!=null) { if (pos.slice(0,5)=="above") dy = -fontsize/2; if (pos.slice(0,5)=="below") dy = fontsize-0; if (pos.slice(0,5)=="right" || pos.slice(5,10)=="right") { textanchor = "start"; dx = fontsize/2; } if (pos.slice(0,4)=="left" || pos.slice(5,9)=="left") { textanchor = "end"; dx = -fontsize/2; } } var node = this; if (this.nodeName=="svg") { node = myCreateElementSVG("text"); this.appendChild(node); node.appendChild(doc.createTextNode(st)); } node.lastChild.nodeValue = st; node.setAttribute("x",p[0]+dx); node.setAttribute("y",p[1]+dy); node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle)); node.setAttribute("font-family",fontfamily); node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize)); node.setAttribute("font-weight",fontweight); node.setAttribute("text-anchor",textanchor); if (fontstroke!="none") node.setAttribute("stroke",fontstroke); if (fontfill!="none") node.setAttribute("fill",fontfill); } function image(imgurl,p,w,h,id) { // not working yet var node; if (id!=null) node = doc.getElementById(id); if (node==null) { node = myCreateElementSVG("image"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("x",p[0]*xunitlength+origin[0]); node.setAttribute("y",height-p[1]*yunitlength-origin[1]); node.setAttribute("width",w); node.setAttribute("height",h); node.setAttribute("xlink:href", imgurl); } function ASdot(center,radius,s,f) { // coordinates in units, radius in pixel if (s==null) s = stroke; if (f==null) f = fill; var node = myCreateElementSVG("circle"); node.setAttribute("cx",center[0]*xunitlength+origin[0]); node.setAttribute("cy",height-center[1]*yunitlength-origin[1]); node.setAttribute("r",radius); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", s); node.setAttribute("fill", f); svgpicture.appendChild(node); } function dot(center, typ, label, pos, id) { var node; var cx = center[0]*xunitlength+origin[0]; var cy = height-center[1]*yunitlength-origin[1]; if (id!=null) node = doc.getElementById(id); if (typ=="+" || typ=="-" || typ=="|") { if (node==null) { node = myCreateElementSVG("path"); node.setAttribute("id", id); svgpicture.appendChild(node); } if (typ=="+") { node.setAttribute("d", " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+ " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength)); node.setAttribute("stroke-width", .5); node.setAttribute("stroke", axesstroke); } else { if (typ=="-") node.setAttribute("d", " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy); else node.setAttribute("d", " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength)); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); } } else { if (node==null) { node = myCreateElementSVG("circle"); node.setAttribute("id", id); svgpicture.appendChild(node); } node.setAttribute("cx",cx); node.setAttribute("cy",cy); node.setAttribute("r",dotradius); node.setAttribute("stroke-width", strokewidth); node.setAttribute("stroke", stroke); node.setAttribute("fill", (typ=="open"?"white": (typ=="closed"?stroke:markerfill))); } if (label!=null) text(center,label,(pos==null?"below":pos),(id==null?id:id+"label")) } point = dot; //alternative name function arrowhead(p,q) { // draw arrowhead at q (in units) add size param var up; var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]]; var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]]; var u = [w[0]-v[0],w[1]-v[1]]; var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]); if (d > 0.00000001) { u = [u[0]/d, u[1]/d]; up = [-u[1],u[0]]; var node = myCreateElementSVG("path"); node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+ (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+ (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z"); node.setAttribute("stroke-width", markerstrokewidth); node.setAttribute("stroke", stroke); /*was markerstroke*/ node.setAttribute("fill", stroke); /*was arrowfill*/ node.setAttribute("stroke-opacity", strokeopacity); node.setAttribute("fill-opacity", fillopacity); svgpicture.appendChild(node); } } function chopZ(st) { var k = st.indexOf("."); if (k==-1) return st; for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--); if (i==k) i--; return st.slice(0,i+1); } function grid(dx,dy) { // for backward compatibility axes(dx,dy,null,dx,dy) } function noaxes() { if (!initialized) initPicture(); } function axes(dx,dy,labels,gdx,gdy) { //xscl=x is equivalent to xtick=x; xgrid=x; labels=true; var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st; if (!initialized) initPicture(); if (typeof dx=="string") { labels = dx; dx = null; } if (typeof dy=="string") { gdx = dy; dy = null; } if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx} if (yscl!=null) {dy = yscl; gdy = yscl} if (xtick!=null) {dx = xtick} if (ytick!=null) {dy = ytick} dx = (dx==null?xunitlength:dx*xunitlength); dy = (dy==null?dx:dy*yunitlength); fontsize = Math.min(dx/2,dy/2,16); //alert(fontsize) ticklength = fontsize/4; if (xgrid!=null) gdx = xgrid; if (ygrid!=null) gdy = ygrid; if (gdx!=null) { gdx = (typeof gdx=="string"?dx:gdx*xunitlength); gdy = (gdy==null?dy:gdy*yunitlength); pnode = myCreateElementSVG("path"); st=""; for (x = origin[0]; x<width; x = x+gdx) st += " M"+x+",0"+" "+x+","+height; for (x = origin[0]-gdx; x>0; x = x-gdx) st += " M"+x+",0"+" "+x+","+height; for (y = height-origin[1]; y<height; y = y+gdy) st += " M0,"+y+" "+width+","+y; for (y = height-origin[1]-gdy; y>0; y = y-gdy) st += " M0,"+y+" "+width+","+y; pnode.setAttribute("d",st); pnode.setAttribute("stroke-width", .5); pnode.setAttribute("stroke", gridstroke); pnode.setAttribute("fill", fill); svgpicture.appendChild(pnode); } pnode = myCreateElementSVG("path"); st="M0,"+(height-origin[1])+" "+width+","+ (height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height; for (x = origin[0]+dx; x<width; x = x+dx) st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+ (height-origin[1]-ticklength); for (x = origin[0]-dx; x>0; x = x-dx) st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+ (height-origin[1]-ticklength); for (y = height-origin[1]+dy; y<height; y = y+dy) st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y; for (y = height-origin[1]-dy; y>0; y = y-dy) st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y; if (labels!=null) with (Math) { ldx = dx/xunitlength; ldy = dy/yunitlength; lx = (xmin>0 || xmax<0?xmin:0); ly = (ymin>0 || ymax<0?ymin:0); lxp = (ly==0?"below":"above"); lyp = (lx==0?"left":"right"); var ddx = floor(1.1-log(ldx)/log(10))+1; var ddy = floor(1.1-log(ldy)/log(10))+1; for (x = ldx; x<=xmax; x = x+ldx) text([x,ly],chopZ(x.toFixed(ddx)),lxp); for (x = -ldx; xmin<=x; x = x-ldx) text([x,ly],chopZ(x.toFixed(ddx)),lxp); for (y = ldy; y<=ymax; y = y+ldy) text([lx,y],chopZ(y.toFixed(ddy)),lyp); for (y = -ldy; ymin<=y; y = y-ldy) text([lx,y],chopZ(y.toFixed(ddy)),lyp); } fontsize = defaultfontsize; pnode.setAttribute("d",st); pnode.setAttribute("stroke-width", .5); pnode.setAttribute("stroke", axesstroke); pnode.setAttribute("fill", fill); pnode.setAttribute("stroke-opacity", strokeopacity); pnode.setAttribute("fill-opacity", fillopacity); svgpicture.appendChild(pnode); } function mathjs(st) { //translate a math formula to js function notation // a^b --> pow(a,b) // na --> n*a // (...)d --> (...)*d // n! --> factorial(n) // sin^-1 --> arcsin etc. //while ^ in string, find term on left and right //slice and concat new formula string st = st.replace(/\s/g,""); if (st.indexOf("^-1")!=-1) { st = st.replace(/sin\^-1/g,"arcsin"); st = st.replace(/cos\^-1/g,"arccos"); st = st.replace(/tan\^-1/g,"arctan"); st = st.replace(/sec\^-1/g,"arcsec"); st = st.replace(/csc\^-1/g,"arccsc"); st = st.replace(/cot\^-1/g,"arccot"); st = st.replace(/sinh\^-1/g,"arcsinh"); st = st.replace(/cosh\^-1/g,"arccosh"); st = st.replace(/tanh\^-1/g,"arctanh"); st = st.replace(/sech\^-1/g,"arcsech"); st = st.replace(/csch\^-1/g,"arccsch"); st = st.replace(/coth\^-1/g,"arccoth"); } st = st.replace(/^e$/g,"(Math.E)"); st = st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1"); st = st.replace(/([^a-zA-Z])e/g,"$1(Math.E)"); // st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(Math.E)$2"); st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2"); st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1"); var i,j,k, ch, nested; while ((i=st.indexOf("^"))!=-1) { //find left argument if (i==0) return "Error: missing argument"; j = i-1; ch = st.charAt(j); if (ch>="0" && ch<="9") {// look for (decimal) number j--; while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--; if (ch==".") { j--; while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--; } } else if (ch==")") {// look for matching opening bracket and function name nested = 1; j--; while (j>=0 && nested>0) { ch = st.charAt(j); if (ch=="(") nested--; else if (ch==")") nested++; j--; } while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z") j--; } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable j--; while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z") j--; } else { return "Error: incorrect syntax in "+st+" at position "+j; } //find right argument if (i==st.length-1) return "Error: missing argument"; k = i+1; ch = st.charAt(k); if (ch>="0" && ch<="9" || ch=="-") {// look for signed (decimal) number k++; while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++; if (ch==".") { k++; while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++; } } else if (ch=="(") {// look for matching closing bracket and function name nested = 1; k++; while (k<st.length && nested>0) { ch = st.charAt(k); if (ch=="(") nested++; else if (ch==")") nested--; k++; } } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable k++; while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" || ch>="A" && ch<="Z") k++; } else { return "Error: incorrect syntax in "+st+" at position "+k; } st = st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+ st.slice(k); } while ((i=st.indexOf("!"))!=-1) { //find left argument if (i==0) return "Error: missing argument"; j = i-1; ch = st.charAt(j); if (ch>="0" && ch<="9") {// look for (decimal) number j--; while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--; if (ch==".") { j--; while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--; } } else if (ch==")") {// look for matching opening bracket and function name nested = 1; j--; while (j>=0 && nested>0) { ch = st.charAt(j); if (ch=="(") nested--; else if (ch==")") nested++; j--; } while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z") j--; } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable j--; while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z") j--; } else { return "Error: incorrect syntax in "+st+" at position "+j; } st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1); } return st; } function plot(fun,x_min,x_max,points,id,endpts) { var pth = []; var f = function(x) { return x }, g = fun; var name = null; if (typeof fun=="string") eval("g = function(x){ with(Math) return "+mathjs(fun)+" }"); else if (typeof fun=="object") { eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }"); eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }"); } if (typeof x_min=="string") { name = x_min; x_min = xmin } else name = id; var min = (x_min==null?xmin:x_min); var max = (x_max==null?xmax:x_max); var inc = max-min-0.000001*(max-min); inc = (points==null?inc/200:inc/points); var gt; //alert(typeof g(min)) for (var t = min; t <= max; t += inc) { gt = g(t); if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt]; } path(pth,name,null,endpts); return pth; } // make polar plot // make Riemann sums function slopefield(fun,dx,dy) { var g = fun; if (typeof fun=="string") eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }"); var gxy,x,y,u,v,dz; if (dx==null) dx=1; if (dy==null) dy=1; dz = Math.sqrt(dx*dx+dy*dy)/6; var x_min = Math.ceil(xmin/dx); var y_min = Math.ceil(ymin/dy); for (x = x_min; x <= xmax; x += dx) for (y = y_min; y <= ymax; y += dy) { gxy = g(x,y); if (!isNaN(gxy)) { if (Math.abs(gxy)=="Infinity") {u = 0; v = dz;} else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;} line([x-u,y-v],[x+u,y+v]); } } } ///////////////////////user graphics commands end here///////////////////////// function show_props(obj) { var result = ""; for (var i=0; i< obj.childNodes.length; i++) result += obj.childNodes.item(i) + "\n"; return result; } function displayCoord(evt) { if (showcoordinates) { var svgroot = evt.target.parentNode; var nl = svgroot.childNodes; for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++); var cnode = nl.item(i); cnode.mtext = mtext; cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")", "left", "", "11"); /* var dnode = nl.item(i+1); dnode.mtext = mtext; dnode.mtext([0,svgroot.getAttribute("height")-6],"Try (shift/alt)-dblclick", "right", "", "8"); */ } } function removeCoord(evt) { var svgroot = evt.target.parentNode; var nl = svgroot.childNodes; for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++); var cnode = nl.item(i); cnode.mtext = mtext; cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"", "aboveleft", ""); /* var dnode = nl.item(i+1); dnode.mtext = mtext; dnode.mtext([0,svgroot.getAttribute("height")-0],"", "aboveright", ""); */} function initASCIIMathCalculators(li) { var i; for (i=0; i<li.length; i++) { li[i].innerHTML = calcstr; AMprocessNode(li[i]); } li = document.getElementsByTagName("textarea"); var st; for (i=0; i<li.length; i++) { st = li[i].getAttribute("onkeyup"); if (st!=null) eval(String(st).replace(/function anonymous\(\)/,"")); } } function calculate(inputId,outputId) { var str = document.getElementById(inputId).value; var err = ""; var ind = str.lastIndexOf("\n"); if (ind==str.length-1) str = str.slice(0,ind); str = str.slice(str.lastIndexOf("\n")+1); try { var res = eval(mathjs(str)); } catch(e) { err = "syntax incomplete"; } if (!isNaN(res) && res!="Infinity") str = "`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err; else if (str!="") str = "`"+str+"` = undefined"; //debug:+mathjs(str); var outnode = document.getElementById(outputId); var n = outnode.childNodes.length; for (var i=0; i<n; i++) outnode.removeChild(outnode.firstChild); outnode.appendChild(document.createTextNode(str)); AMprocessNode(outnode); } function append(st){ document.getElementById('in').value+=st; calculate('in','out'); document.getElementById('in').scrollTop = 1000; document.getElementById('in').focus(); } function clearTextArea(){ document.getElementById('in').value=""; calculate('in','out'); document.getElementById('in').focus(); } var calcstr = "<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: &nbsp; &nbsp; <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\">&nbsp;`C`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button></td>\n<td><button onclick=\"append('sin(')\">&nbsp;`sin`</button></td>\n<td><button onclick=\"append('cos(')\">&nbsp;`cos`</button></td>\n<td><button onclick=\"append('tan(')\">&nbsp;`tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\">&nbsp; `!` &nbsp;</button></td>\n\n<td><button onclick=\"append('(')\"><font size=2>&nbsp;&nbsp;`(`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append(')')\"><font size=2>&nbsp;&nbsp;`)`&nbsp;&nbsp;</font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\">&nbsp;`-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\">&nbsp; `7` &nbsp;</button></td>\n<td><button onclick=\"append('8')\">&nbsp; `8` &nbsp;</button></td>\n\n<td><button onclick=\"append('9')\">&nbsp; `9` &nbsp;</button></td>\n<td><button onclick=\"append('*')\">&nbsp;`times`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\">&nbsp;`ln`&nbsp;</button></td>\n<td><button onclick=\"append('4')\">&nbsp; `4` &nbsp;</button></td>\n<td><button onclick=\"append('5')\">&nbsp; `5` &nbsp;</button></td>\n<td><button onclick=\"append('6')\">&nbsp; `6` &nbsp;</button></td>\n\n<td><button onclick=\"append('-')\">&nbsp;`-{::}`&nbsp;</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\">&nbsp; `e` &nbsp;</button></td>\n<td><button onclick=\"append('1')\">&nbsp;&nbsp;`1` &nbsp;</button></td>\n<td><button onclick=\"append('2')\">&nbsp; `2` &nbsp;</button></td>\n<td><button onclick=\"append('3')\">&nbsp; `3` &nbsp;</button></td>\n<td><button onclick=\"append('+')\">&nbsp;`+{::}`&nbsp;</button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\">&nbsp;`pi` &nbsp;</button--></td>\n<td><button onclick=\"append('0')\">&nbsp; `0` &nbsp;</button></td>\n<td><button onclick=\"append('.')\">&nbsp; `.` &nbsp;</button></td>\n<td><button onclick=\"append('\\n')\">&nbsp;`\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>"; // GO1.1 Generic onload by Brothercake // http://www.brothercake.com/ //onload function (replaces the onload="translate()" in the <body> tag) function generic() { if(!init()) return; if (translateOnLoad) { var nd = document.getElementById("processasciimathinmoodle"); if (nd!=null) dsvglocation = nd.className; if (nd!=null || !checkforprocessasciimathinmoodle) { translate(); if (!noSVG && translateASCIIsvg) drawPictures(); } var li = getElementsByClass(document,"div","ASCIIMathCalculator"); if (!noMathML && li.length>0) initASCIIMathCalculators(li); } }; //setup onload function if(typeof window.addEventListener != 'undefined') { //.. gecko, safari, konqueror and standard window.addEventListener('load', generic, false); } else if(typeof document.addEventListener != 'undefined') { //.. opera 7 document.addEventListener('load', generic, false); } else if(typeof window.attachEvent != 'undefined') { //.. win/ie window.attachEvent('onload', generic); } //** remove this condition to degrade older browsers else { //.. mac/ie5 and anything else that gets this far //if there's an existing onload function if(typeof window.onload == 'function') { //store it var existing = onload; //add new onload handler window.onload = function() { //call existing onload function existing(); //call generic onload function generic(); }; } else { //setup onload function window.onload = generic; } }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/ASCIIMathML.js
JavaScript
art
148,559
<!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" xml:lang="en" lang="en"> <head> <title>AsciiMathML Example</title> <script type="text/javascript"> var mathcolor = "black"; </script> <script type="text/javascript" src="ASCIIMathML.js"></script> <style type="text/css"> body { font-family: sans-serif } pre {border: dotted grey thin; background-color:LightYellow; } </style> </head> <body > <h1>AsciiMathML Example</h1> <p>This shows how to set up your page to display MathML using AsciiMathML</p> <p>Add this to the head section of your document:</p> <pre> &lt;!-- This block is optional configuration --&gt; &lt;script type="text/javascript"&gt; var mathcolor = "black"; // You may change the color of the formulae (default: red) var showasciiformulaonhover = false; // helps students learn ASCIIMath, set to false if you like (default:true) var mathfontfamily = "Arial"; //and the font (default: serif, which is good I think) &lt;/script&gt; &lt;!-- THIS LOADS THE ACTUAL SCRIPT, PLEASE ADJUST THE URL --&lt; &lt;script type="text/javascript" src="/xinha/plugins/Equation/ASCIIMathML.js"&gt;&lt;/script&gt; </pre> <p><span class="AM">`int_a^bf(x)dx`</span></p> <p><span class="AM">`[[a,b],[c,d]]`</span><br /></p> <p> ASCIIMathML by <a href="http://www.chapman.edu/~jipsen" onclick="window.open(this.href,'_blank');return false;">Peter Jipsen</a>, <a href="http://www.chapman.edu" onclick="window.open(this.href,'_blank');return false;">Chapman University</a><br /> For more information on AsciiMathML visit this page: <a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" onclick="window.open(this.href,'_blank','');return false;">http://www1.chapman.edu/~jipsen/mathml/asciimath.html</a> </p> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/example.html
HTML
art
1,890
<!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" xml:lang="en" lang="en"> <head> <title>AsciiMath Formula Input</title> <script type="text/javascript" src="../../../popups/popup.js"></script> <script type="text/javascript" src="../ASCIIMathML.js"></script> <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" /> <style type="text/css"> /* <![CDATA[ */ #outputNode,#inputText,#mathml { padding:5px; background-color:white; width:98%; height:200px; font-size:1.3em; border: 1px solid darkgrey; overflow:auto; } #clickInput { width:100%; border-collapse:collapse; background-color: white; text-align:center; } #clickInput td { border: thin solid gray; cursor:pointer; font-size:1.1em; } h3 { font-size:1.6em; } /* ]]> */ </style> <script type="text/javascript"> // <![CDATA[ // START - Added for compatibility with ASCIIMathML 2.0 var AMtranslated = false; // Next 2 functions copied from ASCIIMathML 1.4.7 function AMcreateElementXHTML(t) { if (isIE) return document.createElement(t); else return document.createElementNS("http://www.w3.org/1999/xhtml", t); } function AMinitSymbols() { var texsymbols = [], i; for (i=0; i<AMsymbols.length; i++) if (AMsymbols[i].tex) texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype}; AMsymbols = AMsymbols.concat(texsymbols); AMsymbols.sort(compareNames); for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input; } // END - Added for compatibility with ASCIIMathML 2.0 window.resizeTo(500, 300); var showasciiformulaonhover = false; if (typeof Xinha == "undefined") Xinha = window.opener.Xinha; function i18n(str) { return (Xinha._lc(str, 'Equation')); } function set (string) { var inputField = document.getElementById("inputText"); inputField.value += string; preview(); inputField.focus(); return false; } function preview() { if (document.getElementById("inputText") != '') { var str = document.getElementById("inputText").value; var outnode = document.getElementById("outputNode"); var newnode = AMcreateElementXHTML("div"); newnode.setAttribute("id","outputNode"); outnode.parentNode.replaceChild(newnode,outnode); outnode = document.getElementById("outputNode"); var n = outnode.childNodes.length; for (var i = 0; i < n; i++) outnode.removeChild(outnode.firstChild); outnode.appendChild(document.createTextNode("`"+str+"`")); AMprocessNode(outnode,true); } } function Init() { __dlg_translate('Equation'); __dlg_init(); var param = window.dialogArguments; var cfg = param["editor"].config; mathcolor = cfg.Equation.mathcolor; mathfontfamily = cfg.Equation.mathfontfamily; translate(); var inputField = document.getElementById("inputText"); if (param["editedNode"] && param["editedNode"].tagName.toLowerCase() == 'span') { var formula = param["editedNode"].getAttribute("title").replace(/^`*(.*?)`*$/m,"$1"); if (!formula) formula = param["editedNode"].innerHTML.replace(/^`*(.*?)`*$/m,"$1"); inputField.value = formula; preview(); } else inputField.value = ''; inputField.focus(); } function onOK() { var param = { "editedNode":window.dialogArguments.editedNode, "formula" : document.getElementById("inputText").value }; __dlg_close(param); return false; } function onCancel() { __dlg_close(null); return false; } function translate() { if (!AMtranslated) { // run this only once AMtranslated = true; AMinitSymbols(); AMprocessNode(document.getElementById("clickInput"),true); preview(); } } window.onload = Init; function AMnode2string(inNode,indent) { // thanks to James Frazer for contributing an initial version of this function var i, str = ""; if(inNode.nodeType == 1) { var name = inNode.nodeName.toLowerCase(); // (IE fix) str = "\r" + indent + "<" + name; for(i=0; i < inNode.attributes.length; i++) if (inNode.attributes[i].nodeValue!="italic" && inNode.attributes[i].nodeValue!="" && //stop junk attributes inNode.attributes[i].nodeValue!="inherit" && // (mostly IE) inNode.attributes[i].nodeValue!=undefined && inNode.attributes[i].nodeName[0] != '-' ) str += " "+inNode.attributes[i].nodeName+"="+ "\""+inNode.attributes[i].nodeValue+"\""; if (name == "math") str += " xmlns=\"http://www.w3.org/1998/Math/MathML\""; str += ">"; for(i=0; i<inNode.childNodes.length; i++) str += AMnode2string(inNode.childNodes[i], indent+" "); if (name != "mo" && name != "mi" && name != "mn") str += "\r"+indent; str += "</" + name + ">"; } else if(inNode.nodeType == 3) { var st = inNode.nodeValue; for (i=0; i<st.length; i++) if (st.charCodeAt(i)<32 || st.charCodeAt(i)>126) str += "&#"+st.charCodeAt(i)+";"; else if (st.charAt(i)=="<" && indent != " ") str += "&lt;"; else if (st.charAt(i)==">" && indent != " ") str += "&gt;"; else if (st.charAt(i)=="&" && indent != " ") str += "&amp;"; else str += st.charAt(i); } return str; } function showMathML() { var math = document.getElementById("outputNode").getElementsByTagName("math")[0]; if (math) math.parentNode.innerHTML = '<pre>'+Xinha.htmlEncode(AMnode2string(math,''))+'</pre>'; } // ]]> </script> </head> <body class="dialog"> <div class="title">AsciiMath Formula Input</div> <!-- Table modified from CharacterMap for ASCIIMathML by Peter Jipsen HTMLSource based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/) modified by Holger Hees Original Author - Bernhard Pfeifer novocaine@gmx.net --> <table id="clickInput"> <tr> <td colspan="3" class="character" title="(x+1)/(x-1)" onclick="set('(x+1)/(x-1)')">`(x+1)/(x-1)`</td> <td colspan="2" class="character" title="x^(m+n)" onclick="set('x^(m+n)')">`x^(m+n)`</td> <td colspan="2" class="character" title="x_(mn)" onclick="set('x_(mn)')">`x_(mn)`</td> <td colspan="2" class="character" title="sqrt(x)" onclick="set('sqrt(x)')">`sqrt(x)`</td> <td colspan="3" class="character" title="root(n)(x)" onclick="set('root(n)(x)')">`root(n)(x)`</td> <td colspan="2" class="character" title="&quot;text&quot;" onclick="set('&quot;text&quot;')">`&quot;text&quot;`</td> <td colspan="2" class="character" style="cursor:default"></td> </tr><tr> <td colspan="2" class="character" title="dy/dx" onclick="set('dy/dx')">`dy/dx`</td> <td colspan="3" class="character" title="lim_(x-&gt;oo)" onclick="set('lim_(x-&gt;oo)')">`lim_(x-&gt;oo)`</td> <td colspan="3" class="character" title="sum_(n=1)^oo" onclick="set('sum_(n=1)^oo')">`sum_(n=1)^oo`</td> <td colspan="3" class="character" title="int_a^bf(x)dx" onclick="set('int_a^bf(x)dx')">`int_a^bf(x)dx`</td> <td colspan="3" class="character" title="[[a,b],[c,d]]" onclick="set('[[a,b],[c,d]]')">`[[a,b],[c,d]]`</td> <td colspan="2" class="character" title="((n),(k))" onclick="set('((n),(k))')">`((n),(k))`</td> </tr><tr> <td class="character" title="*" onclick="set('*')">`*`</td> <td class="character" title="**" onclick="set('**')">`**`</td> <td class="character" title="//" onclick="set('//')">`//`</td> <td class="character" title="\\" onclick="set('\\\\')">`\\`</td> <td class="character" title="xx" onclick="set('xx')">`xx`</td> <td class="character" title="-:" onclick="set('-:')">`-:`</td> <td class="character" title="@" onclick="set('@')">`@`</td> <td class="character" title="o+" onclick="set('o+')">`o+`</td> <td class="character" title="ox" onclick="set('ox')">`ox`</td> <td class="character" title="o." onclick="set('o.')">`o.`</td> <td class="character" title="sum" onclick="set('sum')">`sum`</td> <td class="character" title="prod" onclick="set('prod')">`prod`</td> <td class="character" title="^^" onclick="set('^^')">`^^`</td> <td class="character" title="^^^" onclick="set('^^^')"><span style="font-size:larger">`&and;`</span></td> <td class="character" title="vv" onclick="set('vv')">`vv`</td> <td class="character" title="vvv" onclick="set('vvv')"><span style="font-size:larger">`&or;`</span></td> </tr><tr> <td class="character" title="!=" onclick="set('!=')">`!=`</td> <td class="character" title="&lt;=" onclick="set('&lt;=')">`&lt;=`</td> <td class="character" title="&gt;=" onclick="set('&gt;=')">`&gt;=`</td> <td class="character" title="-&lt;" onclick="set('-&lt;')">`-&lt;`</td> <td class="character" title="&gt;-" onclick="set('&gt;-')">`&gt;-`</td> <td class="character" title="in" onclick="set('in')">`in`</td> <td class="character" title="!in" onclick="set('!in')">`!in`</td> <td class="character" title="sub" onclick="set('sub')">`sub`</td> <td class="character" title="sup" onclick="set('sup')">`sup`</td> <td class="character" title="sube" onclick="set('sube')">`sube`</td> <td class="character" title="supe" onclick="set('supe')">`supe`</td> <td class="character" title="O/" onclick="set('O/')">`O/`</td> <td class="character" title="nn" onclick="set('nn')">`nn`</td> <td class="character" title="nnn" onclick="set('nnn')"><span style="font-size:larger">`&cap;`</span></td> <td class="character" title="uu" onclick="set('uu')">`uu`</td> <td class="character" title="uuu" onclick="set('uuu')"><span style="font-size:larger">`&cup;`</span></td> </tr><tr> <td class="character" title="and" onclick="set('and')">`and`</td> <td class="character" title="or" onclick="set('or')">`or`</td> <td class="character" title="not" onclick="set('not')">`not`</td> <td class="character" title="=&gt;" onclick="set('==&gt;')">`=&gt;`</td> <td class="character" title="if" onclick="set('if')">`if`</td> <td class="character" title="&lt;=&gt;" onclick="set('&lt;=&gt;')">`&lt;=&gt;`</td> <td class="character" title="AA" onclick="set('AA')">`AA`</td> <td class="character" title="EE" onclick="set('EE')">`EE`</td> <td class="character" title="_|_" onclick="set('_|_')">`_|_`</td> <td class="character" title="TT" onclick="set('TT')">`TT`</td> <td class="character" title="|--" onclick="set('|--')">`|--`</td> <td class="character" title="|==" onclick="set('|==')">`|==`</td> <td class="character" title="-=" onclick="set('-=')">`-=`</td> <td class="character" title="~=" onclick="set('~=')">`~=`</td> <td class="character" title="~~" onclick="set('~~')">`~~`</td> <td class="character" title="prop" onclick="set('prop')">`prop`</td> </tr><tr> <td class="character" title="int" onclick="set('int')">`int`</td> <td class="character" title="oint" onclick="set('oint')">`oint`</td> <td class="character" title="del" onclick="set('del')">`del`</td> <td class="character" title="grad" onclick="set('grad')">`grad`</td> <td class="character" title="+-" onclick="set('+-')">`+-`</td> <td class="character" title="oo" onclick="set('oo')">`oo`</td> <td class="character" title="aleph" onclick="set('aleph')">`aleph`</td> <td class="character" title="quad" onclick="set('quad')">`quad`</td> <td class="character" title="diamond" onclick="set('diamond')">`diamond`</td> <td class="character" title="square" onclick="set('square')">`square`</td> <td class="character" title="|__" onclick="set('|__')">`|__`</td> <td class="character" title="__|" onclick="set('__|')">`__|`</td> <td class="character" title="|~" onclick="set('|~')">`|~`</td> <td class="character" title="~|" onclick="set('~|')">`~|`</td> <td class="character" title="&lt;x&gt;" onclick="set('&lt;x&gt;')">`&lt;x&gt;`</td> <td class="character" title="/_" onclick="set('/_')">`/_`</td> </tr><tr> <td class="character" title="uarr" onclick="set('uarr')">`uarr`</td> <td class="character" title="darr" onclick="set('darr')">`darr`</td> <td class="character" title="larr" onclick="set('larr')">`larr`</td> <td class="character" title="-&gt;" onclick="set('-&gt;')">`-&gt;`</td> <td class="character" title="|-&gt;" onclick="set('|-&gt;')">`|-&gt;`</td> <td class="character" title="harr" onclick="set('harr')">`harr`</td> <td class="character" title="lArr" onclick="set('lArr')">`lArr`</td> <td class="character" title="rArr" onclick="set('rArr')">`rArr`</td> <td class="character" title="hArr" onclick="set('hArr')">`hArr`</td> <td class="character" title="hata" onclick="set('hat')">`hata`</td> <td class="character" title="ula" onclick="set('ul')">`ula`</td> <td class="character" title="dota" onclick="set('dot')">`dota`</td> <td class="character" title="ddota" onclick="set('ddot')">`ddota`</td> <td class="character" title="veca" onclick="set('vec')">`veca`</td> <td class="character" title="bara" onclick="set('bar')">`bara`</td> <td class="character" title=":." onclick="set(':.')">`:.`</td> </tr><tr> <td class="character" title="NN" onclick="set('NN')">`NN`</td> <td class="character" title="ZZ" onclick="set('ZZ')">`ZZ`</td> <td class="character" title="QQ" onclick="set('QQ')">`QQ`</td> <td class="character" title="RR" onclick="set('RR')">`RR`</td> <td class="character" title="CC" onclick="set('CC')">`CC`</td> <td class="character" title="bba" onclick="set('bb')">`bba`</td> <td class="character" title="bbba" onclick="set('bbb')">`bbba`</td> <td class="character" title="cca" onclick="set('cc')">`cca`</td> <td class="character" title="fra" onclick="set('fr')">`fra`</td> <td class="character" title="sfa" onclick="set('sf')">`sfa`</td> <td class="character" title="tta" onclick="set('tt')">`tta`</td> <td colspan="4" class="character" title="stackrel(-&gt;)(+)" onclick="set('stackrel(-&gt;)(+)')">`stackrel(-&gt;)(+)`</td> <td class="character" title="upsilon" onclick="set('upsilon')">`upsilon`</td> </tr><tr> <td class="character" title="alpha" onclick="set('alpha')">`alpha`</td> <td class="character" title="beta" onclick="set('beta')">`beta`</td> <td class="character" title="gamma" onclick="set('gamma')">`gamma`</td> <td class="character" title="Gamma" onclick="set('Gamma')">`Gamma`</td> <td class="character" title="delta" onclick="set('delta')">`delta`</td> <td class="character" title="Delta" onclick="set('Delta')">`Delta`</td> <td class="character" title="epsi" onclick="set('epsi')">`epsi`</td> <td class="character" title="zeta" onclick="set('zeta')">`zeta`</td> <td class="character" title="eta" onclick="set('eta')">`eta`</td> <td class="character" title="theta" onclick="set('theta')">`theta`</td> <td class="character" title="Theta" onclick="set('Theta')">`Theta`</td> <td class="character" title="iota" onclick="set('iota')">`iota`</td> <td class="character" title="kappa" onclick="set('kappa')">`kappa`</td> <td class="character" title="lambda" onclick="set('lambda')">`lambda`</td> <td class="character" title="Lambda" onclick="set('Lambda')">`Lambda`</td> <td class="character" title="mu" onclick="set('mu')">`mu`</td> </tr><tr> <td class="character" title="nu" onclick="set('nu')">`nu`</td> <td class="character" title="pi" onclick="set('pi')">`pi`</td> <td class="character" title="Pi" onclick="set('Pi')">`Pi`</td> <td class="character" title="rho" onclick="set('rho')">`rho`</td> <td class="character" title="sigma" onclick="set('sigma')">`sigma`</td> <td class="character" title="Sigma" onclick="set('Sigma')">`Sigma`</td> <td class="character" title="tau" onclick="set('tau')">`tau`</td> <td class="character" title="xi" onclick="set('xi')">`xi`</td> <td class="character" title="Xi" onclick="set('Xi')">`Xi`</td> <td class="character" title="phi" onclick="set('phi')">`phi`</td> <td class="character" title="Phi" onclick="set('Phi')">`Phi`</td> <td class="character" title="chi" onclick="set('chi')">`chi`</td> <td class="character" title="psi" onclick="set('psi')">`psi`</td> <td class="character" title="Psi" onclick="set('Psi')">`Psi`</td> <td class="character" title="omega" onclick="set('omega')">`omega`</td> <td class="character" title="Omega" onclick="set('Omega')">`Omega`</td> </tr> </table> <form action="javascript:void(0);"> <table style="width: 100%;border:none"> <tr> <td style="width:50%">Input</td><td style="width:50%"><input type="button" onclick="showMathML()" style="float:right;font-size:10px" value="Show MathML" /><span>Preview</span></td> </tr> <tr> <td> <textarea id="inputText" onkeyup="preview()"></textarea> </td> <td> <div id="outputNode"></div> <textarea id="mathml" style="display:none"></textarea> </td> </tr> <tr><td colspan="2"> <span>Based on ASCIIMathML by </span><a href="http://www.chapman.edu/~jipsen" onclick="window.open(this.href,'_blank','');return false;">Peter Jipsen</a>, <a href="http://www.chapman.edu" onclick="window.open(this.href,'_blank','');return false;">Chapman University</a><br /> <span>For more information on AsciiMathML visit this page: </span><a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" onclick="window.open(this.href,'_blank','');return false;">http://www1.chapman.edu/~jipsen/mathml/asciimath.html</a></td></tr> </table> <div id="buttons"> <script type="text/javascript"> // <![CDATA[ if (Xinha.is_ie) document.write('<span style="color:red;float:left">'+i18n('Attention Internet Explorer users: Please note that there is no WYSIWYG representation of the formula in the editor!<br />You might wish to use <a href="http://www.mozilla.com" onclick="window.open(this.href,\'_blank\');return false;">Mozilla Firefox</a> instead.')+'</span>'); // ]]> </script> <button type="submit" name="ok" onclick="return onOK();">OK</button> <button type="button" name="cancel" onclick="return onCancel();">Cancel</button> </div> </form> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Equation/popups/dialog.html
HTML
art
17,676
<?php /* Script: FileManager.php MooTools FileManager - Backend for the FileManager Script License: MIT-style license. Copyright: Copyright (c) 2009 [Christoph Pojer](http://cpojer.net). Dependencies: - Upload.php - Image.php - getId3 Library Options: - directory: (string) The base directory to be used for the FileManger - baseURL: (string) Absolute URL to the FileManager files - assetBasePath: (string) The path to all images and swf files - id3Path: (string, optional) The path to the getid3.php file - mimeTypesPath: (string, optional) The path to the MimTypes.ini file. - dateFormat: (string, defaults to *j M Y - H:i*) The format in which dates should be displayed - upload: (boolean, defaults to *false*) Whether to allow uploads or not - destroy: (boolean, defaults to *false*) Whether to allow deletion of files or not - maxUploadSize: (integeter, defaults to *3145728* bytes) The maximum file size for upload in bytes - safe: (string, defaults to *true*) If true, disallows - filter: (string) If specified, the mimetypes to be allowed (for display and upload). Example: image/ allows all Image Mimetypes */ require_once(FileManagerUtility::getPath() . '/Upload.php'); require_once(FileManagerUtility::getPath() . '/Image.php'); class FileManager { protected $path = null; protected $length = null; protected $basedir = null; protected $basename = null; protected $options; protected $post; protected $get; public function __construct($options){ $path = FileManagerUtility::getPath(); $this->options = array_merge(array( 'directory' => '../Demos/Files', 'baseURL' => '', 'assetBasePath' => '../Assets', 'id3Path' => $path . '/Assets/getid3/getid3.php', 'mimeTypesPath' => $path . '/MimeTypes.ini', 'dateFormat' => 'j M Y - H:i', 'maxUploadSize' => 1024 * 1024 * 3, 'upload' => false, 'destroy' => false, 'safe' => true, 'filter' => null, // Xinha: Allow to specify the "Resize Large Images" tolerance level. 'suggestedMaxImageDimension' => array('width' => 800, 'height' => 600), ), $options); $this->basedir = realpath($this->options['directory']); $this->basename = pathinfo($this->basedir, PATHINFO_BASENAME) . '/'; $this->path = realpath($this->options['directory'] . '/../'); $this->length = strlen($this->path); header('Expires: Fri, 01 Jan 1990 00:00:00 GMT'); header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); $this->get = $_GET; $this->post = $_POST; } public function fireEvent($event){ $event = $event ? 'on' . ucfirst($event) : null; if (!$event || !method_exists($this, $event)) $event = 'onView'; $this->{$event}(); } protected function onView(){ $dir = $this->getDir(!empty($this->post['directory']) ? $this->post['directory'] : null); $files = ($files = glob($dir . '/*')) ? $files : array(); if ($dir != $this->basedir) array_unshift($files, $dir . '/..'); natcasesort($files); foreach ($files as $file){ $mime = $this->getMimeType($file); if ($this->options['filter'] && $mime != 'text/directory' && !FileManagerUtility::startsWith($mime, $this->options['filter'])) continue; $out[is_dir($file) ? 0 : 1][] = array( 'name' => pathinfo($file, PATHINFO_BASENAME), 'date' => date($this->options['dateFormat'], filemtime($file)), 'mime' => $this->getMimeType($file), 'icon' => $this->getIcon($this->normalize($file)), 'size' => filesize($file) ); } echo json_encode(array( 'path' => $this->getPath($dir), 'dir' => array( 'name' => pathinfo($dir, PATHINFO_BASENAME), 'date' => date($this->options['dateFormat'], filemtime($dir)), 'mime' => 'text/directory', 'icon' => 'dir' ), 'files' => array_merge(!empty($out[0]) ? $out[0] : array(), !empty($out[1]) ? $out[1] : array()) )); } protected function onDetail(){ if (empty($this->post['directory']) || empty($this->post['file'])) return; $file = realpath($this->path . '/' . $this->post['directory'] . '/' . $this->post['file']); if (!$this->checkFile($file)) return; require_once($this->options['id3Path']); // Xinha: The URL is weird in the standard distribution of filemanager, it seems to expect // that the files directory (where you are selecting/uploading) is always within the filemanager // directory itself somewhere. // // Also the 'baseURL' seems to be wanted as the parent of the 'basedir' ("directory" option) // Xinha is supplying both the same (eg url = /foo/test and dir = /home/bar/public_html/foo/test ) // so we will rip off the first part of directory, below. $url = $this->options['baseURL'] . '/' . preg_replace('/^[^\/]*\//', '', $this->post['directory'] . '/' . $this->post['file']); $mime = $this->getMimeType($file); $content = null; // Xinha: We want to get some more information about what has been selected in a way // we can use it. Effectively what gets put in here will be passed into the // 'onDetails' event handler of your FileManager object (if any). $extra_return_detail = array ( 'url' => $url, 'mime' => $mime ); if (FileManagerUtility::startsWith($mime, 'image/')){ $size = getimagesize($file); $content = '<img src="' . $url . '" class="preview" alt="" /> <h2>${more}</h2> <dl> <dt>${width}</dt><dd>' . $size[0] . 'px</dd> <dt>${height}</dt><dd>' . $size[1] . 'px</dd> </dl>'; // Xinha: Return some information about the image which can be access // from the onDetails event handler in FileManager $extra_return_detail['width'] = $size[0]; $extra_return_detail['height'] = $size[1]; }elseif (FileManagerUtility::startsWith($mime, 'text/') || $mime == 'application/x-javascript'){ $filecontent = file_get_contents($file, null, null, 0, 300); if (!FileManagerUtility::isBinary($filecontent)) $content = '<div class="textpreview">' . nl2br(str_replace(array('$', "\t"), array('&#36;', '&nbsp;&nbsp;'), htmlentities($filecontent))) . '</div>'; }elseif ($mime == 'application/zip'){ $out = array(array(), array()); $getid3 = new getID3(); $getid3->Analyze($file); foreach ($getid3->info['zip']['files'] as $name => $size){ $icon = is_array($size) ? 'dir' : $this->getIcon($name); $out[($icon == 'dir') ? 0 : 1][$name] = '<li><a><img src="' . $this->options['assetBasePath'] . '/Icons/' . $icon . '.png" alt="" /> ' . $name . '</a></li>'; } natcasesort($out[0]); natcasesort($out[1]); $content = '<ul>' . implode(array_merge($out[0], $out[1])) . '</ul>'; }elseif (FileManagerUtility::startsWith($mime, 'audio/')){ $getid3 = new getID3(); $getid3->Analyze($file); $content = '<div class="object"> <object type="application/x-shockwave-flash" data="' . $this->options['assetBasePath'] . '/dewplayer.swf?mp3=' . rawurlencode($url) . '&volume=30" width="200" height="20"> <param name="movie" value="' . $this->options['assetBasePath'] . '/dewplayer.swf?mp3=' . rawurlencode($url) . '&volume=30" /> </object> </div> <h2>${more}</h2> <dl> <dt>${title}</dt><dd>' . $getid3->info['comments']['title'][0] . '</dd> <dt>${artist}</dt><dd>' . $getid3->info['comments']['artist'][0] . '</dd> <dt>${album}</dt><dd>' . $getid3->info['comments']['album'][0] . '</dd> <dt>${length}</dt><dd>' . $getid3->info['playtime_string'] . '</dd> <dt>${bitrate}</dt><dd>' . round($getid3->info['bitrate']/1000) . 'kbps</dd> </dl>'; } echo json_encode(array_merge(array( 'content' => $content ? $content : '<div class="margin"> ${nopreview}<br/><button value="' . $url . '">${download}</button> </div>' ), $extra_return_detail)); } protected function onDestroy(){ if (!$this->options['destroy'] || empty($this->post['directory']) || empty($this->post['file'])) return; $file = realpath($this->path . '/' . $this->post['directory'] . '/' . $this->post['file']); if (!$this->checkFile($file)) return; $this->unlink($file); echo json_encode(array( 'content' => 'destroyed' )); } protected function onCreate(){ if ($this->options['upload']) { if (empty($this->post['directory']) || empty($this->post['file'])) return; $file = $this->getName($this->post['file'], $this->getDir($this->post['directory'])); if (!$file) return; mkdir($file); } $this->onView(); } protected function onUpload(){ try{ if (!$this->options['upload']) throw new FileManagerException('disabled'); if (empty($this->get['directory']) || (function_exists('UploadIsAuthenticated') && !UploadIsAuthenticated($this->get))) throw new FileManagerException('authenticated'); $dir = $this->getDir($this->get['directory']); $name = pathinfo((Upload::exists('Filedata')) ? $this->getName($_FILES['Filedata']['name'], $dir) : null, PATHINFO_FILENAME); $file = Upload::move('Filedata', $dir . '/', array( 'name' => $name, 'extension' => $this->options['safe'] && $name && in_array(strtolower(pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION)), array('exe', 'dll', 'php', 'php3', 'php4', 'php5', 'phps')) ? 'txt' : null, 'size' => $this->options['maxUploadSize'], 'mimes' => $this->getAllowedMimeTypes() )); if (FileManagerUtility::startsWith(Upload::mime($file), 'image/') && !empty($this->get['resize'])){ $img = new Image($file); $size = $img->getSize(); if ($size['width'] > $this->options['suggestedMaxImageDimension']['width']) $img->resize( $this->options['suggestedMaxImageDimension']['width'])->save(); elseif ($size['height'] > $this->options['suggestedMaxImageDimension']['height']) $img->resize(null, $this->options['suggestedMaxImageDimension']['height'])->save(); } echo json_encode(array( 'status' => 1, 'name' => pathinfo($file, PATHINFO_BASENAME) )); }catch(UploadException $e){ echo json_encode(array( 'status' => 0, 'error' => class_exists('ValidatorException') ? strip_tags($e->getMessage()) : '${upload.' . $e->getMessage() . '}' // This is for Styx :) )); }catch(FileManagerException $e){ echo json_encode(array( 'status' => 0, 'error' => '${upload.' . $e->getMessage() . '}' )); } } /* This method is used by both move and rename */ protected function onMove(){ if (empty($this->post['directory']) || empty($this->post['file'])) return; $rename = empty($this->post['newDirectory']) && !empty($this->post['name']); $dir = $this->getDir($this->post['directory']); $file = realpath($dir . '/' . $this->post['file']); $is_dir = is_dir($file); if (!$this->checkFile($file) || (!$rename && $is_dir)) return; if ($rename || $is_dir){ if (empty($this->post['name'])) return; $newname = $this->getName($this->post['name'], $dir); $fn = 'rename'; }else{ $newname = $this->getName(pathinfo($file, PATHINFO_FILENAME), $this->getDir($this->post['newDirectory'])); $fn = !empty($this->post['copy']) ? 'copy' : 'rename'; } if (!$newname) return; $ext = pathinfo($file, PATHINFO_EXTENSION); if ($ext) $newname .= '.' . $ext; $fn($file, $newname); echo json_encode(array( 'name' => pathinfo($this->normalize($newname), PATHINFO_BASENAME), )); } protected function unlink($file){ $file = realpath($file); if ($this->basedir==$file || strlen($this->basedir)>=strlen($file)) return; if (is_dir($file)){ $files = glob($file . '/*'); if (is_array($files)) foreach ($files as $f) $this->unlink($f); rmdir($file); }else{ try{ if ($this->checkFile($file)) unlink($file); }catch(Exception $e){} } } protected function getName($file, $dir){ $files = array(); foreach ((array)glob($dir . '/*') as $f) $files[] = pathinfo($f, PATHINFO_FILENAME); $pathinfo = pathinfo($file); $file = $dir . '/' . FileManagerUtility::pagetitle($pathinfo['filename'], $files).(!empty($pathinfo['extension']) ? '.' . $pathinfo['extension'] : null); return !$file || !FileManagerUtility::startsWith($file, $this->basedir) || file_exists($file) ? null : $file; } protected function getIcon($file){ if (FileManagerUtility::endsWith($file, '/..')) return 'dir_up'; else if (is_dir($file)) return 'dir'; $ext = pathinfo($file, PATHINFO_EXTENSION); return ($ext && file_exists(realpath($this->options['assetBasePath'] . '/Icons/' . $ext . '.png'))) ? $ext : 'default'; } protected function getMimeType($file){ return is_dir($file) ? 'text/directory' : Upload::mime($file); } protected function getDir($dir){ $dir = realpath($this->path . '/' . (FileManagerUtility::startsWith($dir, $this->basename) ? $dir : $this->basename)); return $this->checkFile($dir) ? $dir : $this->basedir; } protected function getPath($file){ $file = $this->normalize(substr($file, $this->length)); return substr($file, FileManagerUtility::startsWith($file, '/') ? 1 : 0); } protected function checkFile($file){ $mimes = $this->getAllowedMimeTypes(); $hasFilter = $this->options['filter'] && count($mimes); if ($hasFilter) array_push($mimes, 'text/directory'); return !(!$file || !FileManagerUtility::startsWith($file, $this->basedir) || !file_exists($file) || ($hasFilter && !in_array($this->getMimeType($file), $mimes))); } protected function normalize($file){ return preg_replace('/\\\|\/{2,}/', '/', $file); } protected function getAllowedMimeTypes(){ $filter = $this->options['filter']; if (!$filter) return null; if (!FileManagerUtility::endsWith($filter, '/')) return array($filter); static $mimes; if (!$mimes) $mimes = parse_ini_file($this->options['mimeTypesPath']); foreach ($mimes as $mime) if (FileManagerUtility::startsWith($mime, $filter)) $mimeTypes[] = strtolower($mime); return $mimeTypes; } } class FileManagerException extends Exception {} /* Stripped-down version of some Styx PHP Framework-Functionality bundled with this FileBrowser. Styx is located at: http://styx.og5.net */ class FileManagerUtility { public static function endsWith($string, $look){ return strrpos($string, $look)===strlen($string)-strlen($look); } public static function startsWith($string, $look){ return strpos($string, $look)===0; } public static function pagetitle($data, $options = array()){ static $regex; if (!$regex){ $regex = array( explode(' ', 'Æ æ Œ œ ß Ü ü Ö ö Ä ä À Á Â Ã Ä Å &#260; &#258; Ç &#262; &#268; &#270; &#272; Ð È É Ê Ë &#280; &#282; &#286; Ì Í Î Ï &#304; &#321; &#317; &#313; Ñ &#323; &#327; Ò Ó Ô Õ Ö Ø &#336; &#340; &#344; Š &#346; &#350; &#356; &#354; Ù Ú Û Ü &#366; &#368; Ý Ž &#377; &#379; à á â ã ä å &#261; &#259; ç &#263; &#269; &#271; &#273; è é ê ë &#281; &#283; &#287; ì í î ï &#305; &#322; &#318; &#314; ñ &#324; &#328; ð ò ó ô õ ö ø &#337; &#341; &#345; &#347; š &#351; &#357; &#355; ù ú û ü &#367; &#369; ý ÿ ž &#378; &#380;'), explode(' ', 'Ae ae Oe oe ss Ue ue Oe oe Ae ae A A A A A A A A C C C D D D E E E E E E G I I I I I L L L N N N O O O O O O O R R S S S T T U U U U U U Y Z Z Z a a a a a a a a c c c d d e e e e e e g i i i i i l l l n n n o o o o o o o o r r s s s t t u u u u u u y y z z z'), ); $regex[0][] = '"'; $regex[0][] = "'"; } $data = trim(substr(preg_replace('/(?:[^A-z0-9]|_|\^)+/i', '_', str_replace($regex[0], $regex[1], $data)), 0, 64), '_'); return !empty($options) ? self::checkTitle($data, $options) : $data; } protected static function checkTitle($data, $options = array(), $i = 0){ if (!is_array($options)) return $data; foreach ($options as $content) if ($content && strtolower($content) == strtolower($data.($i ? '_' . $i : ''))) return self::checkTitle($data, $options, ++$i); return $data.($i ? '_' . $i : ''); } public static function isBinary($str){ $array = array(0, 255); for($i = 0; $i < strlen($str); $i++) if (in_array(ord($str[$i]), $array)) return true; return false; } public static function getPath(){ static $path; return $path ? $path : $path = pathinfo(__FILE__, PATHINFO_DIRNAME); } }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Backend/FileManager.php
PHP
art
16,621
<?php /** * Styx::Upload - Handles file uploads * * @package Styx * @subpackage Utility * * @license MIT-style License * @author Christoph Pojer <christoph.pojer@gmail.com> */ class Upload { /** * Moves the uploaded file to the specified location. It throws a UploadException * if anything goes wrong except for if the upload does not exist. This can be checked with {@link Upload::exists()} * * @param string $file * @param string $to * @param array $options * @return bool|string Path to moved file or false if the specified upload does not exist */ public static function move($file, $to, $options = null){ if(!self::exists($file)) return false; $options = array_merge(array( 'name' => null, 'extension' => null, 'size' => null, 'chmod' => 0777, 'overwrite' => false, 'mimes' => array(), ), $options); $file = $_FILES[$file]; if($options['size'] && $file['size']>$options['size']) throw new UploadException('size'); $pathinfo = pathinfo($file['name']); if($options['extension']) $pathinfo['extension'] = $options['extension']; if(!$pathinfo['extension']) throw new UploadException('extension'); if(count($options['mimes'])){ $mime = self::mime($file['tmp_name'], array( 'default' => $file['type'], 'extension' => $pathinfo['extension'], )); if(!$mime || !in_array($mime, $options['mimes'])) throw new UploadException('extension'); } $file['ext'] = strtolower($pathinfo['extension']); $file['base'] = basename($pathinfo['basename'], '.'.$pathinfo['extension']); $real = realpath($to); if(!$real) throw new UploadException('path'); if(is_dir($real)) $to = $real.'/'.($options['name'] ? $options['name'] : $file['base']).'.'.$file['ext']; if(!$options['overwrite'] && file_exists($to)) throw new UploadException('exists'); if(!move_uploaded_file($file['tmp_name'], $to)) throw new UploadException(strtolower($_FILES[$file]['error']<=2 ? 'size' : ($_FILES[$file]['error']==3 ? 'partial' : 'nofile'))); chmod($to, $options['chmod']); return realpath($to); } /** * Returns whether the Upload exists or not * * @param string $file * @return bool */ public function exists($file){ return !(empty($_FILES[$file]['name']) || empty($_FILES[$file]['size'])); } /** * Returns (if possible) the mimetype of the given file * * @param string $file * @param array $options */ public function mime($file, $options = array()){ $file = realpath($file); $options = array_merge(array( 'default' => null, 'extension' => strtolower(pathinfo($file, PATHINFO_EXTENSION)), ), $options); $mime = null; $ini = error_reporting(0); if (function_exists('finfo_open') && $f = finfo_open(FILEINFO_MIME, getenv('MAGIC'))){ $mime = finfo_file($f, $file); finfo_close($f); } error_reporting($ini); if(!$mime && in_array($options['extension'], array('gif', 'jpg', 'jpeg', 'png'))){ $image = getimagesize($file); if(!empty($image['mime'])) $mime = $image['mime']; } if(!$mime && $options['default']) $mime = $options['default']; if((!$mime || $mime=='application/octet-stream') && $options['extension']){ static $mimes; if(!$mimes) $mimes = parse_ini_file(pathinfo(__FILE__, PATHINFO_DIRNAME).'/MimeTypes.ini'); if(!empty($mimes[$options['extension']])) return $mimes[$options['extension']]; } return $mime; } } class UploadException extends Exception {}
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Backend/Upload.php
PHP
art
3,610
<?php /** * Styx::Image - Provides an Interface to the GD-Library for image manipulation * * @package Styx * @subpackage Utility * * @license MIT-style License * @author Christoph Pojer <christoph.pojer@gmail.com> * * @link http://www.bin-co.com/php/scripts/classes/gd_image/ Based on work by "Binny V A" */ class Image { /** * The path to the image file * * @var string */ private $file; /** * The image resource * * @var resource */ private $image; /** * Metadata regarding the image * * @var array */ private $meta; /** * @param string $file The path to the image file */ public function __construct($file){ $file = realpath($file); if(!file_exists($file)) return; $this->file = $file; $img = getimagesize($file); $this->meta = array( 'width' => $img[0], 'height' => $img[1], 'mime' => $img['mime'], 'ext' => end(explode('/', $img['mime'])), ); if($this->meta['ext']=='jpg') $this->meta['ext'] = 'jpeg'; if(!in_array($this->meta['ext'], array('gif', 'png', 'jpeg'))) return; if(in_array($this->meta['ext'], array('gif', 'png'))){ $this->image = $this->create(); $fn = 'imagecreatefrom'.$this->meta['ext']; $original = $fn($file); imagecopyresampled($this->image, $original, 0, 0, 0, 0, $this->meta['width'], $this->meta['height'], $this->meta['width'], $this->meta['height']); }else{ $this->image = imagecreatefromjpeg($file); } } public function __destruct(){ if(!empty($this->image)) imagedestroy($this->image); } /** * Returns the size of the image * * @return array */ public function getSize(){ return array( 'width' => $this->meta['width'], 'height' => $this->meta['height'], ); } /** * Creates a new, empty image with the desired size * * @param int $x * @param int $y * @param string $ext * @return resource */ private function create($x = null, $y = null, $ext = null){ if(!$x) $x = $this->meta['width']; if(!$y) $y = $this->meta['height']; $image = imagecreatetruecolor($x, $y); if(!$ext) $ext = $this->meta['ext']; if($ext=='png'){ imagealphablending($image, false); imagefilledrectangle($image, 0, 0, $x, $y, imagecolorallocatealpha($image, 0, 0, 0, 127)); } return $image; } /** * Replaces the image resource with the given parameter * * @param resource $new */ private function set($new){ imagedestroy($this->image); $this->image = $new; $this->meta['width'] = imagesx($this->image); $this->meta['height'] = imagesy($this->image); } /** * Returns the path to the image file * * @return string */ public function getPathname(){ return $this->file; } /** * Rotates the image by the given angle * * @param int $angle * @param array $bgcolor An indexed array with red/green/blue/alpha values * @return Image */ public function rotate($angle, $bgcolor = null){ if(empty($this->image) || !$angle || $angle>=360) return $this; $this->set(imagerotate($this->image, $angle, is_array($bgcolor) ? imagecolorallocatealpha($this->image, $bgcolor[0], $bgcolor[1], $bgcolor[2], !empty($bgcolor[3]) ? $bgcolor[3] : null) : $bgcolor)); return $this; } /** * Resizes the image to the given size, automatically calculates * the new ratio if parameter {@link $ratio} is set to true * * @param int $x * @param int $y * @param bool $ratio * @return Image */ public function resize($x = null, $y = null, $ratio = true){ if(empty($this->image) || (!$x && !$y)) return $this; if(!$y) $y = $ratio ? $this->meta['height']*$x/$this->meta['width'] : $this->meta['height']; if(!$x) $x = $ratio ? $this->meta['width']*$y/$this->meta['height'] : $this->meta['width']; $new = $this->create($x, $y); imagecopyresampled($new, $this->image, 0, 0, 0, 0, $x, $y, $this->meta['width'], $this->meta['height']); $this->set($new); return $this; } /** * Crops the image. The values are given like margin/padding values in css * * <b>Example</b> * <ul> * <li>crop(10) - Crops by 10px on all sides</li> * <li>crop(10, 5) - Crops by 10px on top and bottom and by 5px on left and right sides</li> * <li>crop(10, 5, 5) - Crops by 10px on top and by 5px on left, right and bottom sides</li> * <li>crop(10, 5, 3, 2) - Crops by 10px on top, 5px by right, 3px by bottom and 2px by left sides</li> * </ul> * * @param int $top * @param int $right * @param int $bottom * @param int $left * @return Image */ public function crop($top, $right = null, $bottom = null, $left = null){ if(empty($this->image)) return $this; if(!is_numeric($right) && !is_numeric($bottom) && !is_numeric($left)) $right = $bottom = $left = $top; if(!is_numeric($bottom) && !is_numeric($left)){ $bottom = $top; $left = $right; } if(!is_numeric($left)) $left = $right; $x = $this->meta['width']-$left-$right; $y = $this->meta['height']-$top-$bottom; if($x<0 || $y<0) return $this; $new = $this->create($x, $y); imagecopy($new, $this->image, 0, 0, $left, $top, $x, $y); $this->set($new); return $this; } /** * Flips the image horizontally or vertically. To Flip both just use ->rotate(180) * * @see Image::rotate() * @param string $type Either horizontal or vertical * @return Image */ public function flip($type){ if(empty($this->image) || !in_array($type, array('horizontal', 'vertical'))) return $this; $new = $this->create(); if($type=='horizontal') for($x=0;$x<$this->meta['width'];$x++) imagecopy($new, $this->image, $this->meta['width']-$x-1, 0, $x, 0, 1, $this->meta['height']); elseif($type=='vertical') for($y=0;$y<$this->meta['height'];$y++) imagecopy($new, $this->image, 0, $this->meta['height']-$y-1, 0, $y, $this->meta['width'], 1); $this->set($new); return $this; } /** * Stores the image in the desired directory or outputs it * * @param string $ext * @param string $file */ private function process($ext = null, $file = null){ if(!$ext) $ext = $this->meta['ext']; if($ext=='png') imagesavealpha($this->image, true); $fn = 'image'.$ext; $fn($this->image, $file); // If there is a new filename change the internal name too if($file) $this->file = $file; } /** * Saves the image to the given path * * @param string $file Leave empty to replace the original file * @return Image */ public function save($file = null){ if(empty($this->image)) return $this; if(!$file) $file = $this->file; $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); if(!$ext){ $file .= '.'.$this->meta['ext']; $ext = $this->meta['ext']; } if($ext=='jpg') $ext = 'jpeg'; if(!in_array($ext, array('png', 'jpeg', 'gif'))) return $this; $this->process($ext, $file); return $this; } /** * Outputs the manipulated image * * @return Image */ public function show(){ if(empty($this->image)) return $this; header('Content-type: '.$this->meta['mime']); $this->process(); return $this; } }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Backend/Image.php
PHP
art
7,365
/* Script: Language.ru.js MooTools FileManager - Language Strings in Russian Translation: [Ilya V. Goryachev](http://cok-studio.ru/) */ FileManager.Language.ru = { more: 'Подробнее', width: 'Ширина:', height: 'Высота:', ok: 'Ok', open: 'Выбрать файл', upload: 'Загрузка', create: 'Создать папку', createdir: 'Пожалуйста укажите имя папки:', cancel: 'Отмена', information: 'Информация', type: 'Тип:', size: 'Размер:', dir: 'Путь:', modified: 'Последнее изменение:', preview: 'Предпросмотр', close: 'Закрыть', destroy: 'Удалить', destroyfile: 'Уверены, что хотите удалить этот файл?', rename: 'Переименовать', renamefile: 'Пожалуйста укажите имя файла:', download: 'Скачать', nopreview: '<i>Предпросмотр недоступен</i>', title: 'Название:', artist: 'Исполнитель:', album: 'Альбом:', length: 'Продолжительность:', bitrate: 'Битрэйт:', deselect: 'Снять выделение', nodestroy: 'Удаление файлов отключено на сервере.', 'upload.disabled': 'Загрузка файлов отключена на сервере.', 'upload.authenticated': 'Вам не разрешено загружать файлы.', 'upload.path': 'Указанная директория для загрузки файлов не существует. Пожалуйста обратитесь к администратору сайта.', 'upload.exists': 'Указанная директория для загрузки файлов уже существует. Пожалуйста обратитесь к администратору сайта', 'upload.mime': 'Такой тип файла не поддерживается.', 'upload.extension': 'Загруженный файл не опознан или такое расширение не разрешено.', 'upload.size': 'Размер загружаемого файла слишком велик. Пожалуйста загрузите файл поменьше.', 'upload.partial': 'Файл был загружен частично, пожалуйста загрузите этот файл еще раз.', 'upload.nofile': 'Не указаны файлы для загрузки.', 'upload.default': 'При загрузке файлов что-то пошло не так.', /* FU */ uploader: { unknown: 'Неизвестная ошибка', sizeLimitMin: 'Невозможно прикрепить файл "<em>${name}</em>" (${size}), минимальный размер фала <strong>${size_min}</strong>!', sizeLimitMax: 'Невозможно прикрепить файл "<em>${name}</em>" (${size}), максимальный размер файла <strong>${size_max}</strong>!' }, flash: { hidden: 'Чтобы включить embedded загрузчик, разблокируйте подключаемые элементы в вашем браузере (см. Блокировку рекламы).', disabled: 'Чтобы включить embedded загрузчик, снимите блокировку флеш и обновите страницу (см. Блокировка флеш).', flash: 'Чтобы загружать файлы, Вам необходимо установить <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Менять размер больших изображений при загрузке' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.ru.js
JavaScript
art
3,863
/* Script: Language.da.js MooTools FileManager - Language Strings in Danish Translation: Jan Ebsen */ FileManager.Language.da = { more: 'Detaljer', width: 'Bredde:', height: 'Højde:', ok: 'Ok', open: 'Vælg fil', upload: 'Upload', create: 'Opret mappe', createdir: 'Angiv venligst mappe navn:', cancel: 'Anuller', information: 'Information', type: 'Type:', size: 'Størrelse:', dir: 'Sti:', modified: 'Sidst ændret:', preview: 'Miniature', close: 'Luk', destroy: 'Slet', destroyfile: 'Er du sikker på du vil slette denne fil?', rename: 'Omdøb', renamefile: 'Skriv nyt filnavn:', download: 'Download', nopreview: '<i>Ingen miniature tilgængelig</i>', title: 'Titel:', artist: 'Kunstner:', album: 'Album:', length: 'Længde:', bitrate: 'Bitrate:', deselect: 'Fravælg', nodestroy: 'Det er ikke muligt at slette filer på serveren.', 'upload.disabled': 'Det er ikke muligt at uploade filer på serveren.', 'upload.authenticated': 'Du har ikke rettigheder til at uploade filer.', 'upload.path': 'Upload mappen findes ikke. Kontakt venligst sidens administrator.', 'upload.exists': 'Upload mappen findes allerede. Kontakt venligst sidens administrator.', 'upload.mime': 'Fil-typen er ikke tilladt.', 'upload.extension': 'Filen er af en ukendt, eller ulovlig type.', 'upload.size': 'Filen er for stor, upload venligst en mindre fil.', 'upload.partial': 'Filen blev kun delvist uploaded, prøv venligst igen.', 'upload.nofile': 'Der er ikke angivet nogen fil til upload.', 'upload.default': 'Noget gik galt med fil-uploaderen.', /* FU */ uploader: { unknown: 'Ukendt fejl', duplicate: 'Du kan ikke tilføje "<em>${name}</em>" (${size}), den er allerede tilføjet!', sizeLimitMin: 'Du kan ikke tilføje "<em>${name}</em>" (${size}), mindst tilladte filstørrelse er <strong>${size_min}</strong>!', sizeLimitMax: 'Du kan ikke tilføje "<em>${name}</em>" (${size}), højst tilladte filstørrelse er <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'For at uploade filer skal du installere <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Scaler store billeder ved upload' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.da.js
JavaScript
art
2,338
/* Script: Language.it.js MooTools FileManager - Language Strings in English Translation: Moreno Monga */ FileManager.Language.it = { more: 'Dettagli', width: 'Larghezza:', height: 'Altezza:', ok: 'Ok', open: 'Seleziona file', upload: 'Upload', create: 'Crea cartella', createdir: 'Specifica il nome della cartella:', cancel: 'Annulla', information: 'Informazioni', type: 'Tipo:', size: 'Dimensione:', dir: 'Percorso:', modified: 'Ultima modifica:', preview: 'Anteprima', close: 'Chiudi', destroy: 'Cancella', destroyfile: 'Sei sicuro di voler cancellare questo file?', rename: 'Rinomina', renamefile: 'Scrivi un nuovo nome per il file:', download: 'Download', nopreview: '<i>Non sono disponibili anteprime</i>', title: 'Titolo:', artist: 'Artista:', album: 'Album:', length: 'Lunghezza:', bitrate: 'Bitrate:', deselect: 'Deseleziona', nodestroy: 'La cancellazioni dei file è disabilitata.', 'upload.disabled': 'L Upload dei file è disabilitato.', 'upload.authenticated': 'Non sei autorizzato a fare l upload dei file.', 'upload.path': 'La cartella degli upload non esiste. Contattare il webmaster.', 'upload.exists': 'La cartella specificata per gli upload esiste già. Contattare il webmaster.', 'upload.mime': 'Il tipo del file specificato non è consentito.', 'upload.extension': 'Il tipo di file che si vuole caricare non è consentito o è sconosciuto.', 'upload.size': 'La dimensione del file è troppo grande per essere processato. Ricarica un file con dimensioni ridotte.', 'upload.partial': 'Il file è stato parzialmente caricato. Per favore, prova a ricaricarlo.', 'upload.nofile': 'Non è stato specificato alcun file da caricare.', 'upload.default': 'Mi spiace, l operazione non è andata a buon fine.', /* FU */ uploader: { unknown: 'Errore sconosciuto', sizeLimitMin: 'Non puoi caricare "<em>${name}</em>" (${size}), la dimensione minima del file è <strong>${size_min}</strong>!', sizeLimitMax: 'Non puoi caricare "<em>${name}</em>" (${size}), la dimensione massima del file è <strong>${size_max}</strong>!' }, flash: { hidden: 'To enable the embedded uploader, unblock it in your browser and refresh (see Adblock).', disabled: 'To enable the embedded uploader, enable the blocked Flash movie and refresh (see Flashblock).', flash: 'In order to upload files you need to install <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Ridimensiona immagini grandi', serialize: 'Salva galleria', gallery: { text: 'Titolo immagine', save: 'Salva', remove: 'Rimuovi dalla galleria', drag: 'Sposta gli oggetti qui per creare una galleria...' } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.it.js
JavaScript
art
2,810
/* Script: Language.se.js MooTools FileManager - Language Strings in Swedish Translation: [Marcus *xintron* Carlsson](http://xintron.se) */ FileManager.Language.se = { more: 'Detaljer', width: 'Bredd:', height: 'Höjd:', ok: 'Ok', open: 'Välj fil', upload: 'Ladda upp', create: 'Skapa mapp', createdir: 'Vänligen ange ett mapp-namn:', cancel: 'Avbryt', information: 'Information', type: 'Typ:', size: 'Storlek:', dir: 'Sökväg:', modified: 'Senast ändad:', preview: 'Förhandsgranska', close: 'Stäng', destroy: 'Ta bort', destroyfile: 'Är du säker på att du vill ta bort filen?', rename: 'Döp om', renamefile: 'Vänligen ange ett nytt filnamn:', download: 'Ladda ner', nopreview: '<i>Ingen förhandsgranskning tillgänglig</i>', title: 'Titel:', artist: 'Artist:', album: 'Album:', length: 'Längd:', bitrate: 'Bitrate:', deselect: 'Avmarkera', nodestroy: 'Funktionen ta bort filer är avstängd på denna server.', 'upload.disabled': 'Uppladdning är avstängt på denna server.', 'upload.authenticated': 'Du har inte behörighet att ladda upp filer.', 'upload.path': 'Den angivna uppladdnings-mappen existerar inte. Vänligen kontakta serveradministratören.', 'upload.exists': 'Den angivna uppladdnings-mappen existerar redan. Vänligen kontakta serveradministratören.', 'upload.mime': 'Denna filtyp accepteras inte på denna server.', 'upload.extension': 'Den uppladdade filen har en okänd eller förbjuden filändelse.', 'upload.size': 'Filen är för stor för denna server. Vänligen ladda upp en mindre fil.', 'upload.partial': 'Ett fel uppstod och hela filen kunde inte laddas upp. Vänligen försök igen.', 'upload.nofile': 'Du måste välja en fil att ladda upp.', 'upload.default': 'Ett fel inträffade under uppladdningen.', /* FU */ uploader: { unknown: 'Okänt fel', duplicate: 'Du kan inte ladda upp "<em>${name}</em>" (${size}), filen existerar redan!', sizeLimitMin: 'Du kan inte ladda upp "<em>${name}</em>" (${size}), minsta storlek som accepteras är <strong>${size_min}</strong>!', sizeLimitMax: 'Du kan inte ladda upp "<em>${name}</em>" (${size}), filens storlek får inte överstiga <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'För att kunna ladda upp filer behöver du ha <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a> installerat.' }, resizeImages: 'Ändra storleken på bilden under uppladdningen' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.se.js
JavaScript
art
2,598
/* Script: Language.de.js MooTools FileManager - Language Strings in German Translation: [Christoph Pojer](http://cpojer.net) */ FileManager.Language.de = { more: 'Details', width: 'Breite:', height: 'Höhe:', ok: 'Ok', open: 'Datei wählen', upload: 'Datei hochladen', create: 'Ordner erstellen', createdir: 'Bitte gib einen Ordnernamen ein:', cancel: 'Abbrechen', information: 'Information', type: 'Typ:', size: 'Größe:', dir: 'Verzeichnis:', modified: 'Zuletzt bearbeitet:', preview: 'Vorschau', close: 'Schließen', destroy: 'Löschen', destroyfile: 'Bist du sicher, dass du diese Datei löschen möchtest?', rename: 'Umbenennen', renamefile: 'Gib einen neuen Dateinamen ein:', download: 'Download', nopreview: '<i>Keine Vorschau verfügbar</i>', title: 'Titel:', artist: 'Artist:', album: 'Album:', length: 'Länge:', bitrate: 'Bitrate:', deselect: 'Entfernen', nodestroy: 'Dateien löschen wurde auf diesem Server deaktiviert.', 'upload.disabled': 'Der Datei-Upload wurde auf diesem Server deaktiviert.', 'upload.authenticated': 'Upload fehlgeschlagen: Du bist nicht authentifiziert.', 'upload.path': 'Der angegebene Upload-Ordner existiert nicht. Bitte kontaktiere den Administrator dieser Website.', 'upload.exists': 'Der angegebene Upload-Speicherort existiert bereits. Bitte kontaktiere den Administrator dieser Website.', 'upload.mime': 'Der angegebene Dateityp ist nicht erlaubt.', 'upload.extension': 'Die Datei hat eine unbekannte oder unerlaubte Datei-Erweiterung.', 'upload.size': 'Die Datei, die du hochgeladen hast, ist zu groß um sie auf diesem Server zu verarbeiten. Bitte lade eine kleinere Datei hoch.', 'upload.partial': 'Die Datei wurde nur teilweise hochgeladen. Bitte lade sie erneut hoch.', 'upload.nofile': 'Es wurde keine Datei hochgeladen.', 'upload.default': 'Der Datei-Upload ist fehlgeschlagen.', /* FU */ uploader: { unknown: 'Unbekannter Fehler', sizeLimitMin: 'Die Datei "<em>${name}</em>" (${size}), ist zu klein. Minimaldateigröße: <strong>${size_min}</strong>!', sizeLimitMax: 'Die Datei "<em>${name}</em>" (${size}), ist zu groß. Dateigrößen-Limit: <strong>${size_max}</strong>!' }, flash: { hidden: 'Um den Uploader benutzen zu können, muss er im Browser freigegeben werden und die Seite muss neu geladen werden (Adblock).', disabled: 'Um den Uploader benutzen zu können, muss die geblockte Flash Datei freigegeben werden und die Seite muss neu geladen werden (Flashblock).', flash: 'Um Dateien hochzuladen muss <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a> installiert werden.' }, resizeImages: 'Große Bilder bei Upload verkleinern', serialize: 'Galerie speichern', gallery: { text: 'Bildtext', save: 'Speichern', remove: 'Entfernen', drag: 'Verschiebe Bilder in diesen Bereich um eine Galerie zu erstellen...' } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.de.js
JavaScript
art
2,927
/* Script: Language.cs.js MooTools FileManager - Language Strings in Czech Translation: [Matěj Grabovský](http://mgrabovsky.is-game.com) */ FileManager.Language.cs = { more: 'Podrobnosti', width: 'Šířka:', height: 'Výška:', ok: 'Ok', open: 'Vybrat soubor', upload: 'Nahrát', create: 'Vytvořit složku', createdir: 'Prosím zadejte název složky:', cancel: 'Storno', information: 'Informace', type: 'Typ:', size: 'Velikost:', dir: 'Cesta:', modified: 'Naposledy změněno:', preview: 'Náhled', close: 'Zavřít', destroy: 'Smazat', destroyfile: 'Určitě chcete smazat tento soubor?', rename: 'Přejmenovat', renamefile: 'Prosím zadejte název nového souboru:', download: 'Stáhnout', nopreview: '<i>Náhled není dostupný</i>', title: 'Název:', artist: 'Umělec:', album: 'Album:', length: 'Délka:', bitrate: 'Přenosová rychlost:', deselect: 'Odstranit z výběru', nodestroy: 'Mazání souborů je na tomto serveru zakázáno.', 'upload.disabled': 'Nahrávání souborů je na tomto serveru zakázáno.', 'upload.authenticated': 'Nemáte právo nahrávat soubory.', 'upload.path': 'Specifikovaná složka pro nahrávání neexistuje. Prosím kontaktujte správce těchto stránek.', 'upload.exists': 'Specifikovaný soubor již existuje. Prosím kontaktujte správce těchto stránek.', 'upload.mime': 'Specifikovaný typ souboru není povolen.', 'upload.extension': 'Nahrávaný soubor má neznámou nebo zakázanou příponu.', 'upload.size': 'Velikost nahrávaného souboru je přílíš velká. Prosím nahrajte menší soubor.', 'upload.partial': 'Nahrávaný soubor byl nahrán jen zčásti. Prosím nahrajte ho znovu.', 'upload.nofile': 'Nebyl vybrán žádný soubor pro nahrání.', 'upload.default': 'Něco se nepovedlo při nahrávání souboru.', /* FU */ uploader: { unknown: 'Neznámá chyba', duplicate: 'Nelze přidat soubor „<em>${name}</em>“ (${size}), byl již přidán!', sizeLimitMin: 'Nelze přidat soubor „<em>${name}</em>“ (${size}), minimální povolená velikost souboru je <strong>${size_min}</strong>!', sizeLimitMax: 'Nelze přidat soubor „<em>${name}</em>“ (${size}), maximální povolená velikost souboru je <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'Pokud chcete nahrávat soubory, musíte mít nainstalovaný <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>' }, resizeImages: 'Změnšit velké obrázky při nahrávání' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.cs.js
JavaScript
art
2,645
/* Script: Language.es.js MooTools FileManager - Language Strings in Spanish Translation: [Sergio Rubio](http://rubiojr.netcorex.org) */ FileManager.Language.es = { more: 'Detalles', width: 'Anchura:', height: 'Altura:', ok: 'Ok', open: 'Seleccionar Fichero', upload: 'Subir ficheros', create: 'Crear carpeta', createdir: 'Especifica el nombre de la carpeta:', cancel: 'Cancelar', information: 'Información', type: 'Tipo:', size: 'Tamaño:', dir: 'Ruta:', modified: 'Última modificación:', preview: 'Previsualización', close: 'Cerrar', destroy: 'Borrar', destroyfile: '¿Seguro que deseas borrar el fichero?', rename: 'Renombrar', renamefile: 'Especifica un nuevo nombre para el fichero:', download: 'Descargar', nopreview: '<i>No hay previsualizacion disponible</i>', title: 'Título:', artist: 'Artista:', album: 'Album:', length: 'Duración:', bitrate: 'Bitrate:', deselect: 'Desmarcar', nodestroy: 'El borrado de ficheros ha sido deshabilitado.', 'upload.disabled': 'La carga de archivos ha sido deshabilitada.', 'upload.authenticated': 'Necesitas autorización para subir ficheros.', 'upload.path': 'La carpeta destino especificada no existe. Contacta con el administrador del sitio web.', 'upload.exists': 'El la ruta destino ya existe. Por favor, contacta con el administrador del sitio web.', 'upload.mime': 'No se permite subir el tipo de fichero especificado.', 'upload.extension': 'El fichero subido tienen una extensión no permitida o desconocida.', 'upload.size': 'El tamaño del fichero que intentas subir es demasiado grande para ser procesado por el servidor. Por favor, sube un fichero mas pequeño.', 'upload.partial': 'El fichero se ha subido parcialmente, por favor, sube el fichero de nuevo.', 'upload.nofile': 'No se especificó el fichero a subir.', 'upload.default': 'Algo falló durante la carga del fichero.', /* FU */ uploader: { unknown: 'Error desconocido', duplicate: 'No se puede subir "<em>${name}</em>" (${size}), ya ha sido añadido!', sizeLimitMin: 'No se puede subir "<em>${name}</em>" (${size}), el tamaño mínimo de fichero es <strong>${size_min}</strong>!', sizeLimitMax: 'No se puede subir "<em>${name}</em>" (${size}), el tamaño máximo de fichero es <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'Para poder subir ficheros necesitas instalar <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Redimensionar las imágenes grandes al subirlas' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.es.js
JavaScript
art
2,665
/* Script: Language.en.js MooTools FileManager - Language Strings in English Translation: [Christoph Pojer](http://cpojer.net) */ FileManager.Language.en = { more: 'Details', width: 'Width:', height: 'Height:', ok: 'Ok', open: 'Select file', upload: 'Upload', create: 'Create folder', createdir: 'Please specify a folder name:', cancel: 'Cancel', information: 'Information', type: 'Type:', size: 'Size:', dir: 'Path:', modified: 'Created:', preview: 'Preview', close: 'Close', destroy: 'Delete', destroyfile: 'Are you sure to delete this file?', rename: 'Rename', renamefile: 'Please enter a new file name:', download: 'Download', nopreview: '<i>No preview available</i>', title: 'Title:', artist: 'Artist:', album: 'Album:', length: 'Length:', bitrate: 'Bitrate:', deselect: 'Deselect', nodestroy: 'Deleting files has been disabled on this Server.', 'upload.disabled': 'Uploading has been disabled on this Server.', 'upload.authenticated': 'You are not authenticated to upload files.', 'upload.path': 'The specified Upload-Folder does not exist. Please contact the administrator of this Website.', 'upload.exists': 'The specified Upload-Location does already exist. Please contact the administrator of this Website.', 'upload.mime': 'The specified file-type is not allowed.', 'upload.extension': 'The uploaded file has an unknown or forbidden file extension.', 'upload.size': 'The size of the file you uploaded is too big to be processed on this server. Please upload a smaller file.', 'upload.partial': 'The file you uploaded was only partially uploaded, please upload the file again.', 'upload.nofile': 'There was no file specified to be uploaded.', 'upload.default': 'Something went wrong with the File-Upload.', /* FU */ uploader: { unknown: 'Unknown Error', sizeLimitMin: 'You can not attach "<em>${name}</em>" (${size}), the file size minimum is <strong>${size_min}</strong>!', sizeLimitMax: 'You can not attach "<em>${name}</em>" (${size}), the file size limit is <strong>${size_max}</strong>!' }, flash: { hidden: 'To enable the embedded uploader, unblock it in your browser and refresh (see Adblock).', disabled: 'To enable the embedded uploader, enable the blocked Flash movie and refresh (see Flashblock).', flash: 'In order to upload files you need to install <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Resize big images on upload', serialize: 'Save gallery', gallery: { text: 'Image caption', save: 'Save', remove: 'Remove from gallery', drag: 'Drag items here to create a gallery...' } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.en.js
JavaScript
art
2,686
/* Script: Language.fi.js MooTools FileManager - Language Strings in Finnish Translation: [Jabis Sevón](http://pumppumedia.com) */ FileManager.Language.fi = { more: 'Lisätiedot', width: 'Leveys:', height: 'Korkeus:', ok: 'Ok', open: 'Valitse tiedosto', upload: 'Lähetä', create: 'Luo kansio', createdir: 'Kansion nimi:', cancel: 'Peruuta', information: 'Tiedot', type: 'Tyyppi:', size: 'Koko:', dir: 'Polku:', modified: 'Viimeksi muokattu:', preview: 'Esikatselu', close: 'Sulje', destroy: 'Poista', destroyfile: 'Haluatko varmasti poistaa tiedoston?', rename: 'Nimeä uudelleen', renamefile: 'Syötä tiedoston uusi nimi:', download: 'Lataa', nopreview: '<i>Esikatselua ei voida näyttää</i>', title: 'Kappaleen nimi:', artist: 'Artisti:', album: 'Albumi:', length: 'Pituus:', bitrate: 'Bitrate:', deselect: 'Poista valinta', nodestroy: 'Tiedostojen poisto otettu käytöstä.', 'upload.disabled': 'Tiedostojen lähetys otettu käytöstä.', 'upload.authenticated': 'Sinulla ei ole oikeuksia tiedostojen lähettämiseen.', 'upload.path': 'Määritettyä kansiota ei löydy. Ole hyvä ja ota yhteyttä sivuston ylläpitäjään.', 'upload.exists': 'Tiedosto on jo olemassa - siirto peruttu. Ole hyvä ja ota yhteyttä sivuston ylläpitäjään.', 'upload.mime': 'Tiedostotyyppi ei ole sallittujen listalla - siirto peruttu.', 'upload.extension': 'Tiedostopääte tuntematon, tai ei sallittujen listalla - siirto peruttu.', 'upload.size': 'Tiedostokoko liian suuri palvelimelle. Ole hyvä ja siirrä pienempiä tiedostoja.', 'upload.partial': 'Tiedonsiirto onnistui vain osittain - siirto epäonnistui. Ole hyvä ja siirrä tiedosto uudestaan', 'upload.nofile': 'Tiedostoa ei määritetty.', 'upload.default': 'Tiedonsiirto epäonnistui tunnistamattomasta syystä.', /* FU */ uploader: { unknown: 'Tunnistamaton virhe', duplicate: 'Et voi lisätä seuraavaa tiedostoa: "<em>${name}</em>" (${size}), koska se on jo siirtolistalla!', sizeLimitMin: 'Et voi lisätä seuraavaa tiedostoa: "<em>${name}</em>" (${size}). Tiedostojen minimikoko on <strong>${size_min}</strong>!', sizeLimitMax: 'Et voi lisätä seuraavaa tiedostoa: "<em>${name}</em>" (${size}). Tiedostojen maksimikoko on <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'Käyttääksesi FileManageria, tarvitset Adobe Flash Playerin. <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Lataa tästä</a>.' }, resizeImages: 'Pienennä liian suuret kuvat automaattisesti siirron yhteydessä' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.fi.js
JavaScript
art
2,689
/* Script: Language.pl.js MooTools FileManager - Language Strings in Polish Translation: [Marek Kalucki](http://www.webdeco.pl) */ FileManager.Language.pl = { more: 'Szczegóły', width: 'Szerokość:', height: 'Wysokość:', ok: 'Ok', open: 'Wybierz plik', upload: 'Wyślij', create: 'Stwórz folder', createdir: 'Podaj nazwe folderu:', cancel: 'Anuluj', information: 'Informacje', type: 'Typ:', size: 'Rozmiar:', dir: 'Ścieżka:', modified: 'Ost. modyfikacja:', preview: 'Podgląd', close: 'Zamknij', destroy: 'Usuń', destroyfile: 'Na pewno chcesz usunąć ten plik?', rename: 'Zmień nazwe', renamefile: 'Podaj nową nazwę pliku:', download: 'Ściągnij', nopreview: '<i>Podgląd niedostępny</i>', title: 'Tytuł:', artist: 'Wykonawca:', album: 'Płyta:', length: 'Długość:', bitrate: 'Bitrate:', deselect: 'Odznacz', nodestroy: 'Usuwanie plików z serwera zostało wyłączone.', 'upload.disabled': 'Wysyłanie plików na serwer zostało wyłączone.', 'upload.authenticated': 'Nie jesteś upoważniony do wysyłania plików na serwer.', 'upload.path': 'Folder do wysyłania plików nie istnieje. Skontaktuj się z administratorem.', 'upload.exists': 'Folder do wysyłania plików istnieje. Skontaktuj się z administratorem.', 'upload.mime': 'Typ wybranego pliku jest niedozwolony.', 'upload.extension': 'Wysyłany plik ma nieznane lub niedozwolone rozszerzenie.', 'upload.size': 'Rozmiar wysyłanego pliku jest zbyt duży. Wyślij mniejszy plik (jeśli wysyłasz obrazy-zmniejsz obraz na swoim komputerze i ponów wysyłanie).', 'upload.partial': 'Plik nie został wysłany w całości. Ponów próbę wysyłki pliku.', 'upload.nofile': 'Nie wybrano pliku do wysyłki.', 'upload.default': 'Wystąpił błąd w trakcie wysyłki.', /* FU */ uploader: { unknown: 'Wystąpił nieznany błąd.', sizeLimitMin: 'Nie można wybrać "<em>${name}</em>" (${size}), minimalny rozmiar pliku to <strong>${size_min}</strong>!', sizeLimitMax: 'Nie można wybrać "<em>${name}</em>" (${size}), maksymalny rozmiar pliku to <strong>${size_max}</strong>!' }, flash: { hidden: 'Aby włączyć wysyłanie plików, odblokuj go w swojej przeglądarce i odśwież stronę (prawdopodobnie wysyłanie plików jest blokowane przez wtyczkę Adblock).', disabled: 'Aby włączyć wysyłanie plików, odblokuj obiekt flash i odśwież stronę (prawdopodobnie wysyłanie plików blokowane jest przez wtyczkę Flashblock).', flash: 'Aby wysyłać pliki na serwer, należy zainstalować w przeglądarce wtyczkę <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Zmniejsz duże obrazy w trakcie wysyłania' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.pl.js
JavaScript
art
2,822
/* Script: Language.fr.js MooTools FileManager - Language Strings in French Translation: [Samuel Sanchez](http://www.kromack.com) */ FileManager.Language.fr = { more: 'Détails', width: 'Largeur :', height: 'Hauteur :', ok: 'Ok', open: 'Sélectionner un fichier', upload: 'Téléverser', create: 'Créer un dossier', createdir: 'Merci de spécifier un nom de dossier :', cancel: 'Annuler', information: 'Informations', type: 'Type :', size: 'Taille :', dir: 'Chemin :', modified: 'Modifié le :', preview: 'Aperçu', close: 'Fermer', destroy: 'Supprimer', destroyfile: 'Voulez-vous vraiment supprimer ce fichier ?', rename: 'Renommer', renamefile: 'Merci de spécifier un nouveau nom de fichier :', download: 'Télécharger', nopreview: '<i>Aucun aperçu disponible</i>', title: 'Titre :', artist: 'Artiste :', album: 'Album :', length: 'Durée :', bitrate: 'Débit :', deselect: 'Désélectionner', nodestroy: 'La suppression de fichier a été désactivée sur ce serveur.', 'upload.disabled': 'Le téléversement de fichier a été désactivé sur ce serveur.', 'upload.authenticated': 'Vous n\'êtes pas authentifié et ne pouvez pas téléverser de fichier.', 'upload.path': 'Le répertoire de téléversement spécifié n\'existe pas. Merci de contacter l\'administrateur de ce site Internet.', 'upload.exists': 'Le chemin de téléversement spécifié existe déjà. Merci de contacter l\'administrateur de ce site Internet.', 'upload.mime': 'Le type de fichier spécifié n\'est pas autorisé.', 'upload.extension': 'Le fichier téléversé a une extension inconnue ou interdite.', 'upload.size': 'La taille de votre fichier est trop grande pour être téléversée sur ce serveur. Merci de sélectionner un fichier moins lourd.', 'upload.partial': 'Le fichier a été partiellement téléversé, merci de recommencer l\'opération.', 'upload.nofile': 'Aucun fichier n\'a été spécifié.', 'upload.default': 'Une erreur s\'est produite.', /* FU */ uploader: { unknown: 'Erreur inconnue', duplicate: 'Vous ne pouvez pas ajouter "<em>${name}</em>" (${size}), car l\'élément est déjà ajoutée !', sizeLimitMin: 'Vous ne pouvez pas ajouter "<em>${name}</em>" (${size}), la taille minimale des fichiers est de <strong>${size_min}</strong>!', sizeLimitMax: 'Vous ne pouvez pas ajouter "<em>${name}</em>" (${size}), la taille maximale des fichiers est de <strong>${size_max}</strong>!' }, flash: { hidden: null, disabled: null, flash: 'Dans le but de téléverser des fichiers, vous devez installer <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash</a>.' }, resizeImages: 'Redimensionner les images pendant le téléversement' };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.fr.js
JavaScript
art
2,849
/* --- description: FileManager Uploader longdescription: Implements Upload functionality into the FileManager based on [FancyUpload](http://digitarald.de) authors: - Christoph Pojer requires: core/1.2.4: '*' provides: - filemanager.uploader license: MIT-style license options: - upload: (boolean, defaults to *true*) - uploadAuthData: (object) Data to be send with the GET-Request of an Upload as Flash ignores authenticated clients - resizeImages: (boolean, defaults to *true*) Whether to show the option to resize big images or not ... */ FileManager.implement({ options: { resizeImages: true, upload: true, uploadAuthData: {} }, hooks: { show: { upload: function(){ this.startUpload(); } }, cleanup: { upload: function(){ if (!this.options.upload || !this.upload) return; if (this.upload.uploader) this.upload.uploader.set('opacity', 0).dispose(); } } }, onDialogOpen: function(){ if (this.swf && this.swf.box) this.swf.box.setStyle('visibility', 'hidden'); }, onDialogClose: function(){ if (this.swf && this.swf.box) this.swf.box.setStyle('visibility', 'visible'); }, startUpload: function(){ if (!this.options.upload || this.swf) return; var self = this; this.upload = { button: this.addMenuButton('upload').inject(this.menu, 'bottom').addEvents({ click: function(){ return false; }, mouseenter: function(){ this.addClass('hover'); }, mouseleave: function(){ this.removeClass('hover'); this.blur(); }, mousedown: function(){ this.focus(); } }), list: new Element('ul', {'class': 'filemanager-uploader-list'}), uploader: new Element('div', {opacity: 0, 'class': 'filemanager-uploader-area'}).adopt( new Element('h2', {text: this.language.upload}), new Element('div', {'class': 'filemanager-uploader'}) ) }; this.upload.uploader.getElement('div').adopt(this.upload.list); this.closeIcon.appearOn(this.upload.button, 0.8); if (this.options.resizeImages){ var resizer = new Element('div', {'class': 'checkbox'}), check = (function(){ this.toggleClass('checkboxChecked'); }).bind(resizer); check(); this.upload.label = new Element('label').adopt( resizer, new Element('span', {text: this.language.resizeImages}) ).addEvent('click', check).inject(this.menu); } var File = new Class({ Extends: Swiff.Uploader.File, initialize: function(base, data){ this.parent(base, data); this.setOptions({ url: self.options.url + (self.options.url.indexOf('?') == -1 ? '?' : '&') + Hash.toQueryString($merge({}, self.options.uploadAuthData, { event: 'upload', directory: self.normalize(self.Directory), resize: self.options.resizeImages && resizer.hasClass('checkboxChecked') ? 1 : 0 })) }); }, render: function(){ if (this.invalid){ var message = self.language.uploader.unknown, sub = { name: this.name, size: Swiff.Uploader.formatUnit(this.size, 'b') }; if (self.language.uploader[this.validationError]) message = self.language.uploader[this.validationError]; if (this.validationError == 'sizeLimitMin') sub.size_min = Swiff.Uploader.formatUnit(this.base.options.fileSizeMin, 'b'); else if (this.validationError == 'sizeLimitMax') sub.size_max = Swiff.Uploader.formatUnit(this.base.options.fileSizeMax, 'b'); new Dialog(new Element('div', {html: message.substitute(sub, /\\?\$\{([^{}]+)\}/g)}) , {language: {confirm: self.language.ok}, buttons: ['confirm']}); return this; } this.addEvents({ open: this.onOpen, remove: this.onRemove, requeue: this.onRequeue, progress: this.onProgress, stop: this.onStop, complete: this.onComplete }); this.ui = {}; this.ui.icon = new Asset.image(self.options.assetBasePath+'Icons/' + this.extension + '.png', { onerror: function(){ new Asset.image(self.options.assetBasePath + 'Icons/default.png').replaces(this); } }); this.ui.element = new Element('li', {'class': 'file', id: 'file-' + this.id}); this.ui.title = new Element('span', {'class': 'file-title', text: this.name}); this.ui.size = new Element('span', {'class': 'file-size', text: Swiff.Uploader.formatUnit(this.size, 'b')}); var file = this; this.ui.cancel = new Asset.image(self.options.assetBasePath+'cancel.png', {'class': 'file-cancel', title: self.language.cancel}).addEvent('click', function(){ file.remove(); self.tips.hide(); self.tips.detach(this); }); self.tips.attach(this.ui.cancel); var progress = new Element('img', {'class': 'file-progress', src: self.options.assetBasePath+'bar.gif'}); this.ui.element.adopt( this.ui.cancel, progress, this.ui.icon, this.ui.title, this.ui.size ).inject(self.upload.list).highlight(); this.ui.progress = new Fx.ProgressBar(progress).set(0); this.base.reposition(); return this.parent(); }, onOpen: function(){ this.ui.element.addClass('file-running'); }, onRemove: function(){ this.ui = this.ui.element.destroy(); }, onProgress: function(){ this.ui.progress.start(this.progress.percentLoaded); }, onStop: function(){ this.remove(); }, onComplete: function(){ this.ui.progress = this.ui.progress.cancel().element.destroy(); this.ui.cancel = this.ui.cancel.destroy(); var response = JSON.decode(this.response.text); if (!response.status) new Dialog(('' + response.error).substitute(self.language, /\\?\$\{([^{}]+)\}/g) , {language: {confirm: self.language.ok}, buttons: ['confirm']}); this.ui.element.set('tween', {duration: 2000}).highlight(response.status ? '#e6efc2' : '#f0c2c2'); (function(){ this.ui.element.setStyle('overflow', 'hidden').morph({ opacity: 0, height: 0 }).get('morph').chain(function(){ this.element.destroy(); if (!self.upload.list.getElements('li').length) self.upload.uploader.fade(0).get('tween').chain(function(){ self.fillInfo(); }); }); }).delay(5000, this); } }); this.swf = new Swiff.Uploader({ id: 'SwiffFileManagerUpload', path: this.options.assetBasePath + 'Swiff.Uploader.swf', queued: false, target: this.upload.button, allowDuplicates: true, instantStart: true, fileClass: File, fileSizeMax: 25 * 1024 * 1024, zIndex: this.SwiffZIndex || 9999, onSelectSuccess: function(){ self.fillInfo(); self.info.getElement('h2.filemanager-headline').setStyle('display', 'none'); self.info.adopt(self.upload.uploader); self.upload.uploader.fade(1); }, onComplete: function(){ self.load(self.Directory, true); }, onFail: function(error){ $$(self.upload.button, self.upload.label).dispose(); new Dialog(new Element('div', {html: self.language.flash[error] || self.language.flash.flash}), {language: {confirm: self.language.ok}, buttons: ['confirm']}); } }); } });
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/Uploader.js
JavaScript
art
7,108
/* --- description: FileManager.TinyMCE longdescription: MooTools FileManager for integration with [TinyMCE](http://tinymce.moxiecode.com/) authors: - Christoph Pojer requires: core/1.2.4: '*' provides: - filemanager.tinymce license: MIT-style license Usage: - Pass this to the "file_browser_callback"-option of TinyMCE: FileManager.TinyMCE(function(){ return {FileManagerOptions}; }); - See the Demo for an example. ... */ FileManager.TinyMCE = function(options){ return function(field, url, type, win){ var manager = new FileManager($extend({ onComplete: function(path){ if (!win.document) return; win.document.getElementById(field).value = path; if (win.ImageDialog) win.ImageDialog.showPreviewImage(path, 1); this.container.destroy(); } }, options(type))); manager.dragZIndex = 400002; manager.SwiffZIndex = 400003; manager.el.setStyle('zIndex', 400001); manager.overlay.el.setStyle('zIndex', 400000); document.id(manager.tips).setStyle('zIndex', 400010); manager.show(); return manager; }; }; FileManager.implement('SwiffZIndex', 400003); var Dialog = new Class({ Extends: Dialog, initialize: function(text, options){ this.parent(text, options); this.el.setStyle('zIndex', 400010); this.overlay.el.setStyle('zIndex', 400009); } });
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.TinyMCE.js
JavaScript
art
1,313
/* --- description: Fx.Progressbar authors: - Harald Kirschner requires: core/1.2.4: '*' provides: - filemanager.swiff.progressbar license: MIT-style license ... */ Fx.ProgressBar = new Class({ Extends: Fx, options: { text: null, url: null, transition: Fx.Transitions.Circ.easeOut, fit: true, link: 'cancel' }, initialize: function(element, options) { this.element = $(element); this.parent(options); var url = this.options.url; if (url) { this.element.setStyles({ 'background-image': 'url(' + url + ')', 'background-repeat': 'no-repeat' }); } if (this.options.fit) { url = url || this.element.getStyle('background-image').replace(/^url\(["']?|["']?\)$/g, ''); if (url) { var fill = new Image(); fill.onload = function() { this.fill = fill.width; fill = fill.onload = null; this.set(this.now || 0); }.bind(this); fill.src = url; if (!this.fill && fill.width) fill.onload(); } } else { this.set(0); } }, start: function(to, total) { return this.parent(this.now, (arguments.length == 1) ? to.limit(0, 100) : to / total * 100); }, set: function(to) { this.now = to; var css = (this.fill) ? (((this.fill / -2) + (to / 100) * (this.element.width || 1) || 0).round() + 'px') : ((100 - to) + '%'); this.element.setStyle('backgroundPosition', css + ' 0px').title = Math.round(to) + '%'; var text = $(this.options.text); if (text) text.set('text', Math.round(to) + '%'); return this; } });
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/Uploader/Fx.ProgressBar.js
JavaScript
art
1,520
/* --- description: Swiff.Uploader authors: - Harald Kirschner requires: core/1.2.4: '*' provides: - filemanager.swiff.uploader license: MIT-style license ... */ Swiff.Uploader = new Class({ Extends: Swiff, Implements: Events, options: { path: 'Swiff.Uploader.swf', target: null, zIndex: 9999, height: 30, width: 100, callBacks: null, params: { wMode: 'opaque', menu: 'false', allowScriptAccess: 'always' }, typeFilter: null, multiple: true, queued: true, verbose: false, url: null, method: null, data: null, mergeData: true, fieldName: null, fileSizeMin: 1, fileSizeMax: null, // Official limit is 100 MB for FileReference, but I tested up to 2Gb! allowDuplicates: false, timeLimit: (Browser.Platform.linux) ? 0 : 30, buttonImage: null, policyFile: null, fileListMax: 0, fileListSizeMax: 0, instantStart: false, appendCookieData: false, fileClass: null /* onLoad: $empty, onFail: $empty, onStart: $empty, onQueue: $empty, onComplete: $empty, onBrowse: $empty, onDisabledBrowse: $empty, onCancel: $empty, onSelect: $empty, onSelectSuccess: $empty, onSelectFail: $empty, onButtonEnter: $empty, onButtonLeave: $empty, onButtonDown: $empty, onButtonDisable: $empty, onFileStart: $empty, onFileStop: $empty, onFileRequeue: $empty, onFileOpen: $empty, onFileProgress: $empty, onFileComplete: $empty, onFileRemove: $empty, onBeforeStart: $empty, onBeforeStop: $empty, onBeforeRemove: $empty */ }, initialize: function(options) { // protected events to control the class, added // before setting options (which adds own events) this.addEvent('load', this.initializeSwiff, true) .addEvent('select', this.processFiles, true) .addEvent('complete', this.update, true) .addEvent('fileRemove', function(file) { this.fileList.erase(file); }.bind(this), true); this.setOptions(options); // callbacks are no longer in the options, every callback // is fired as event, this is just compat if (this.options.callBacks) { Hash.each(this.options.callBacks, function(fn, name) { this.addEvent(name, fn); }, this); } this.options.callBacks = { fireCallback: this.fireCallback.bind(this) }; var path = this.options.path; if (!path.contains('?')) path += '?noCache=' + $time(); // cache in IE // container options for Swiff class this.options.container = this.box = new Element('span', {'class': 'swiff-uploader-box'}).inject($(this.options.container) || document.body); // target this.target = $(this.options.target); if (this.target) { var scroll = window.getScroll(); this.box.setStyles({ position: 'absolute', visibility: 'visible', zIndex: this.options.zIndex, overflow: 'hidden', height: 1, width: 1, top: scroll.y, left: scroll.x }); // we force wMode to transparent for the overlay effect this.parent(path, { params: { wMode: 'transparent' }, height: '100%', width: '100%' }); this.target.addEvent('mouseenter', this.reposition.bind(this, [])); // button interactions, relayed to to the target this.addEvents({ buttonEnter: this.targetRelay.bind(this, ['mouseenter']), buttonLeave: this.targetRelay.bind(this, ['mouseleave']), buttonDown: this.targetRelay.bind(this, ['mousedown']), buttonDisable: this.targetRelay.bind(this, ['disable']) }); this.reposition(); window.addEvent('resize', this.reposition.bind(this, [])); } else { this.parent(path); } this.inject(this.box); this.fileList = []; this.size = this.uploading = this.bytesLoaded = this.percentLoaded = 0; if (Browser.Plugins.Flash.version < 9) { this.fireEvent('fail', ['flash']); } else { this.verifyLoad.delay(1000, this); } }, verifyLoad: function() { if (this.loaded) return; if (!this.object.parentNode) { this.fireEvent('fail', ['disabled']); } else if (this.object.style.display == 'none') { this.fireEvent('fail', ['hidden']); } else if (!this.object.offsetWidth) { this.fireEvent('fail', ['empty']); } }, fireCallback: function(name, args) { // file* callbacks are relayed to the specific file if (name.substr(0, 4) == 'file') { // updated queue data is the second argument if (args.length > 1) this.update(args[1]); var data = args[0]; var file = this.findFile(data.id); this.fireEvent(name, file || data, 5); if (file) { var fire = name.replace(/^file([A-Z])/, function($0, $1) { return $1.toLowerCase(); }); file.update(data).fireEvent(fire, [data], 10); } } else { this.fireEvent(name, args, 5); } }, update: function(data) { // the data is saved right to the instance $extend(this, data); this.fireEvent('queue', [this], 10); return this; }, findFile: function(id) { for (var i = 0; i < this.fileList.length; i++) { if (this.fileList[i].id == id) return this.fileList[i]; } return null; }, initializeSwiff: function() { // extracted options for the swf this.remote('initialize', { width: this.options.width, height: this.options.height, typeFilter: this.options.typeFilter, multiple: this.options.multiple, queued: this.options.queued, url: this.options.url, method: this.options.method, data: this.options.data, mergeData: this.options.mergeData, fieldName: this.options.fieldName, verbose: this.options.verbose, fileSizeMin: this.options.fileSizeMin, fileSizeMax: this.options.fileSizeMax, allowDuplicates: this.options.allowDuplicates, timeLimit: this.options.timeLimit, buttonImage: this.options.buttonImage, policyFile: this.options.policyFile }); this.loaded = true; this.appendCookieData(); }, targetRelay: function(name) { if (this.target) this.target.fireEvent(name); }, reposition: function(coords) { // update coordinates, manual or automatically coords = coords || (this.target && this.target.offsetHeight) ? this.target.getCoordinates(this.box.getOffsetParent()) : {top: window.getScrollTop(), left: 0, width: 40, height: 40}; this.box.setStyles(coords); this.fireEvent('reposition', [coords, this.box, this.target]); }, setOptions: function(options) { if (options) { if (options.url) options.url = Swiff.Uploader.qualifyPath(options.url); if (options.buttonImage) options.buttonImage = Swiff.Uploader.qualifyPath(options.buttonImage); this.parent(options); if (this.loaded) this.remote('setOptions', options); } return this; }, setEnabled: function(status) { this.remote('setEnabled', status); }, start: function() { this.fireEvent('beforeStart'); this.remote('start'); }, stop: function() { this.fireEvent('beforeStop'); this.remote('stop'); }, remove: function() { this.fireEvent('beforeRemove'); this.remote('remove'); }, fileStart: function(file) { this.remote('fileStart', file.id); }, fileStop: function(file) { this.remote('fileStop', file.id); }, fileRemove: function(file) { this.remote('fileRemove', file.id); }, fileRequeue: function(file) { this.remote('fileRequeue', file.id); }, appendCookieData: function() { var append = this.options.appendCookieData; if (!append) return; var hash = {}; document.cookie.split(/;\s*/).each(function(cookie) { cookie = cookie.split('='); if (cookie.length == 2) { hash[decodeURIComponent(cookie[0])] = decodeURIComponent(cookie[1]); } }); var data = this.options.data || {}; if ($type(append) == 'string') data[append] = hash; else $extend(data, hash); this.setOptions({data: data}); }, processFiles: function(successraw, failraw, queue) { var cls = this.options.fileClass || Swiff.Uploader.File; var fail = [], success = []; if (successraw) { successraw.each(function(data) { var ret = new cls(this, data); if (!ret.validate()) { ret.remove.delay(10, ret); fail.push(ret); } else { this.size += data.size; this.fileList.push(ret); success.push(ret); ret.render(); } }, this); this.fireEvent('selectSuccess', [success], 10); } if (failraw || fail.length) { fail.extend((failraw) ? failraw.map(function(data) { return new cls(this, data); }, this) : []).each(function(file) { file.invalidate().render(); }); this.fireEvent('selectFail', [fail], 10); } this.update(queue); if (this.options.instantStart && success.length) this.start(); } }); $extend(Swiff.Uploader, { STATUS_QUEUED: 0, STATUS_RUNNING: 1, STATUS_ERROR: 2, STATUS_COMPLETE: 3, STATUS_STOPPED: 4, log: function() { if (window.console && console.info) console.info.apply(console, arguments); }, unitLabels: { b: [{min: 1, unit: 'B'}, {min: 1024, unit: 'kB'}, {min: 1048576, unit: 'MB'}, {min: 1073741824, unit: 'GB'}], s: [{min: 1, unit: 's'}, {min: 60, unit: 'm'}, {min: 3600, unit: 'h'}, {min: 86400, unit: 'd'}] }, formatUnit: function(base, type, join) { var labels = Swiff.Uploader.unitLabels[(type == 'bps') ? 'b' : type]; var append = (type == 'bps') ? '/s' : ''; var i, l = labels.length, value; if (base < 1) return '0 ' + labels[0].unit + append; if (type == 's') { var units = []; for (i = l - 1; i >= 0; i--) { value = Math.floor(base / labels[i].min); if (value) { units.push(value + ' ' + labels[i].unit); base -= value * labels[i].min; if (!base) break; } } return (join === false) ? units : units.join(join || ', '); } for (i = l - 1; i >= 0; i--) { value = labels[i].min; if (base >= value) break; } return (base / value).toFixed(1) + ' ' + labels[i].unit + append; } }); Swiff.Uploader.qualifyPath = (function() { var anchor; return function(path) { (anchor || (anchor = new Element('a'))).href = path; return anchor.href; }; })(); Swiff.Uploader.File = new Class({ Implements: Events, initialize: function(base, data) { this.base = base; this.update(data); }, update: function(data) { return $extend(this, data); }, validate: function() { var options = this.base.options; if (options.fileListMax && this.base.fileList.length >= options.fileListMax) { this.validationError = 'fileListMax'; return false; } if (options.fileListSizeMax && (this.base.size + this.size) > options.fileListSizeMax) { this.validationError = 'fileListSizeMax'; return false; } return true; }, invalidate: function() { this.invalid = true; this.base.fireEvent('fileInvalid', this, 10); return this.fireEvent('invalid', this, 10); }, render: function() { return this; }, setOptions: function(options) { if (options) { if (options.url) options.url = Swiff.Uploader.qualifyPath(options.url); this.base.remote('fileSetOptions', this.id, options); this.options = $merge(this.options, options); } return this; }, start: function() { this.base.fileStart(this); return this; }, stop: function() { this.base.fileStop(this); return this; }, remove: function() { this.base.fileRemove(this); return this; }, requeue: function() { this.base.fileRequeue(this); } });
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/Uploader/Swiff.Uploader.js
JavaScript
art
11,179
/* --- description: FileManager.Gallery longdescription: Adds functionality to create a gallery out of a list of images authors: - Christoph Pojer requires: core/1.2.4: '*' provides: - filemanager.gallery license: MIT-style license ... */ (function(){ FileManager.Gallery = new Class({ Extends: FileManager, initialize: function(options){ this.offsets = {y: -72}; this.parent(options); var show = function(){ this.galleryContainer.setStyles({ opacity: 0, display: 'block' }); var size = this.el.getSize(), pos = this.el.getPosition(); this.galleryContainer.setStyles({ top: pos.y + size.y - 1, left: pos.x + (size.x - this.galleryContainer.getWidth()) / 2, opacity: 1 }); this.hideClone(); this.wrapper.setStyle('display', 'none'); if (this.howto){ var self = this; (function(){ if (self.howto && self.howto.fade) self.howto.fade(0).get('tween').chain(function(){ this.element.destroy(); self.howto = null; }); }).delay(2000); } }; this.addEvents({ scroll: show, show: (function(){ show.apply(this); this.populate(); }), hide: function(){ this.gallery.empty(); this.captions = {}; this.files = []; this.hideClone(); this.wrapper.setStyle('display', 'none'); }, modify: function(file){ var name = this.normalize(file.dir + '/' + file.name); var el = (this.gallery.getElements('li').filter(function(el){ var f = el.retrieve('file'); return name == this.normalize(f.dir + '/' + f.name); }, this) || null)[0]; if (el) this.erasePicture(name, el); } }); this.addMenuButton('serialize'); this.galleryContainer = new Element('div', {'class': 'filemanager-gallery'}).inject(this.container); this.gallery = new Element('ul').inject(this.galleryContainer); var timer, removeClone = this.removeClone.bind(this); this.input = new Element('input', {name: 'imgCaption'}).addEvent('keyup', function(e){ if (e.key == 'enter') removeClone(e); }); this.wrapper = new Element('div', { 'class': 'filemanager-wrapper', tween: {duration: 200}, opacity: 0, events: { mouseenter: function(){ $clear(timer); }, mouseleave: function(e){ timer = (function(){ removeClone(e); }).delay(500); } } }).adopt( new Element('span', {text: this.language.gallery.text}), this.input, new Element('div', {'class': 'img'}), new Element('button', {text: this.language.gallery.save}).addEvent('click', removeClone) ).inject(document.body); this.droppables.push(this.gallery); this.captions = {}; this.files = []; this.animation = {}; this.howto = new Element('div', {'class': 'howto', text: this.language.gallery.drag}).inject(this.galleryContainer); this.switchButton(); }, onDragComplete: function(el, droppable){ if (!droppable || droppable != this.gallery) return false; var file; if ($type(el) == 'string'){ var part = el.split('/'); file = { name: part.pop(), dir: part.join('/') }; }else{ el.setStyles({left: '', top: ''}); file = el.retrieve('file'); } var self = this, name = this.normalize(file.dir + '/' + file.name); if (this.files.contains(name)) return true; this.files.push(name); var img = new Asset.image(this.options.assetBasePath + 'destroy.png').set({ 'class': 'filemanager-remove', title: this.language.gallery.remove, events: {click: this.removePicture} }).store('gallery', this); var li = new Element('li').store('file', file).adopt( img, new Asset.image(this.options.baseURL + name, { onload: function(){ var el = this; li.setStyle('background', 'none').addEvent('click', function(e){ if (e) e.stop(); var pos = el.getCoordinates(); pos.left += el.getStyle('paddingLeft').toInt(); pos.top += el.getStyle('paddingTop').toInt(); self.hideClone(); self.animation = { from: { width: 75, height: 56, left: pos.left, top: pos.top }, to: { width: 200, height: 150, left: pos.left - 75, top: pos.top + pos.height - 150 } }; self.hideClone(); self.input.removeEvents('blur').addEvent('blur', function(){ self.captions[name] = this.get('value') || ''; }); li.set('opacity', 0); self.clone = el.clone(); self.clone.store('file', file).store('parent', li).addClass('filemanager-clone').setStyles(self.animation.from).set({ morph: {link: 'chain'}, styles: { position: 'absolute', zIndex: 1100 }, events: { click: function(e){ self.fireEvent('preview', [self.options.baseURL + name, self.captions[name], li]); } } }).inject(document.body).morph(self.animation.to).get('morph').chain(function(){ self.input.set('value', self.captions[name] || ''); self.wrapper.setStyles({ opacity: 0, display: 'block', left: self.animation.to.left - 12, top: self.animation.to.top - 53 }).fade(1).get('tween').chain(function(){ self.input.focus(); }); }); }); } }) ).inject(this.gallery); this.tips.attach(img.appearOn(li)); this.switchButton(); return true; }, removeClone: function(e){ if (!this.clone || (e.relatedTarget && ([this.clone, this.wrapper].contains(e.relatedTarget) || this.wrapper.hasChild(e.relatedTarget)))) return; if (this.clone.get('morph').timer) return; var file = this.clone.retrieve('file'); if (!file) return; this.captions[this.normalize(file.dir + '/' + file.name)] = this.input.get('value') || ''; this.clone.morph(this.animation.from).get('morph').clearChain().chain((function(){ this.clone.retrieve('parent').set('opacity', 1); this.clone.destroy(); }).bind(this)); this.wrapper.fade(0).get('tween').chain(function(){ this.element.setStyle('display', 'none'); }); }, hideClone: function(){ if (!this.clone) return; this.clone.get('morph').cancel(); var parent = this.clone.retrieve('parent'); if (parent) parent.set('opacity', 1); this.clone.destroy(); this.wrapper.setStyles({ opacity: 0, display: 'none' }); }, removePicture: function(e){ if(e) e.stop(); var self = this.retrieve('gallery'), parent = this.getParent('li'), file = parent.retrieve('file'), name = self.normalize(file.dir + '/' + file.name); self.erasePicture(name, parent); }, erasePicture: function(name, element){ this.captions[name] = ''; this.files.erase(name); this.tips.hide(); var self = this; element.set('tween', {duration: 250}).removeEvents('click').fade(0).get('tween').chain(function(){ this.element.destroy(); self.switchButton(); }); }, switchButton: function(){ var chk = !!this.gallery.getChildren().length; this.menu.getElement('button.filemanager-serialize').set('disabled', !chk)[(chk ? 'remove' : 'add') + 'Class']('disabled'); }, populate: function(data){ Hash.each(data || {}, function(v, i){ this.captions[i] = v; this.onDragComplete(i, this.gallery); }, this); }, serialize: function(e){ if(e) e.stop(); var serialized = {}; this.files.each(function(v){ serialized[v] = this.captions[v] || ''; }, this); this.hide(); this.fireEvent('complete', [serialized]); } }); })();
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/Gallery.js
JavaScript
art
7,481
/* --- description: FileManager authors: - Christoph Pojer requires: core/1.2.4: '*' more/1.2.4.2: [Drag, Drag.Move, Tips, Assets, Element.Delegation] provides: - filemanager license: MIT-style license version: 1.0 todo: - Add Scroller.js (optional) for Drag&Drop in the Filelist inspiration: - Loosely based on a Script by [Yannick Croissant](http://dev.k1der.net/dev/brooser-un-browser-de-fichier-pour-mootools/) options: - url: (string) The base url to the Backend FileManager, without QueryString - baseURL: (string) Absolute URL to the FileManager files - assetBasePath: (string) The path to all images and swf files - selectable: (boolean, defaults to *false*) If true, provides a button to select a file - language: (string, defaults to *en*) The language used for the FileManager - hideOnClick: (boolean, defaults to *false*) When true, hides the FileManager when the area outside of it is clicked - directory: (string) Can be used to load a subfolder instead of the base folder events: - onComplete(path, file): fired when a file gets selected via the "Select file" button - onModify(file): fired when a file gets renamed/deleted or modified in another way - onShow: fired when the FileManager opens - onHide: event fired when FileManager closes - onPreview: event fired when the user clicks an image in the preview - onDetails: event fired when the details are updated after user picking a file - onHidePreview: event fired when the "preview" is hidden (usually, user uploading file, or changing directory) ... */ var FileManager = new Class({ Implements: [Options, Events], Request: null, Directory: null, Current: null, options: { /*onComplete: $empty, onModify: $empty, onShow: $empty, onHide: $empty, onPreview: $empty, onDetails: $empty, // Xinha: Fired when an item is picked form the files list, supplied object (eg {width: 123, height:456} ) onHidePreview: $empty, // Xinha: Fired when the preview is hidden (eg when uploading) */ directory: '', url: null, baseURL: '', assetBasePath: null, selectable: false, hideOnClick: false, language: 'en' }, hooks: { show: {}, cleanup: {} }, initialize: function(options){ this.setOptions(options); this.options.assetBasePath = this.options.assetBasePath.replace(/(\/|\\)*$/, '/'); this.dragZIndex = 1300; this.droppables = []; this.Directory = this.options.directory; this.language = $unlink(FileManager.Language.en); if (this.options.language != 'en') this.language = $merge(this.language, FileManager.Language[this.options.language]); this.container = new Element('div', {'class': 'filemanager-container filemanager-engine-' + Browser.Engine.name + (Browser.Engine.trident ? Browser.Engine.version : '')}); this.el = new Element('div', {'class': 'filemanager'}).inject(this.container); this.menu = new Element('div', {'class': 'filemanager-menu'}).inject(this.el); this.loader = new Element('div', {'class': 'loader', opacity: 0, tween: {duration: 200}}).inject(this.menu); var self = this; this.relayClick = function(e){ if(e) e.stop(); var file = this.retrieve('file'); if (this.retrieve('block') && !Browser.Engine.trident){ this.eliminate('block'); return; } if (file.mime == 'text/directory'){ this.addClass('selected'); self.load(self.Directory + '/' + file.name); return; } if (self.Current) self.Current.removeClass('selected'); self.Current = this.addClass('selected'); // NB: Also sets self.Current // Xinha: We need to have Current assigned before fillInfo because fillInfo adds to it self.fillInfo(file); self.switchButton(); }; this.browser = new Element('ul', {'class': 'filemanager-browser'}).addEvents({ click: (function(){ // return self.deselect(); }), 'click:relay(li span.fi)': this.relayClick }).inject(this.el); if (this.options.upload) this.addMenuButton('create'); // Xinha: Create directory permission = upload if (this.options.selectable) this.addMenuButton('open'); this.info = new Element('div', {'class': 'filemanager-infos', opacity: 0}).inject(this.el); var head = new Element('div', {'class': 'filemanager-head'}).adopt([ new Element('img', {'class': 'filemanager-icon'}), new Element('h1') ]); // Xinha: We need to groupt he headers and lists togethor because we will // use some CSS to reorganise a bit. So we create "infoarea" which // will contain the h2 and list for the "Information", that is // modification date, size, directory etc... var infoarea = new Element('div', {'class': 'filemanager-info-area'}); this.info.adopt([head, infoarea.adopt(new Element('h2', {text: this.language.information}))]); new Element('dl').adopt([ new Element('dt', {text: this.language.modified}), new Element('dd', {'class': 'filemanager-modified'}), new Element('dt', {text: this.language.type}), new Element('dd', {'class': 'filemanager-type'}), new Element('dt', {text: this.language.size}), new Element('dd', {'class': 'filemanager-size'}), new Element('dt', {text: this.language.dir}), new Element('dd', {'class': 'filemanager-dir'}) ]).inject(infoarea); this.preview = new Element('div', {'class': 'filemanager-preview'}).addEvent('click:relay(img.preview)', function(){ self.fireEvent('preview', [this.get('src')]); }); // Xinha: We need to group the headers and lists togethor because we will // use some CSS to reorganise a bit. So we create "filemanager-preview-area" which // will contain the h2 for the preview and also the preview content returned from // Backend/FileManager.php this.info.adopt((new Element('div', {'class': 'filemanager-preview-area'})).adopt([ new Element('h2', {'class': 'filemanager-headline', text: this.language.preview}), this.preview ])); this.closeIcon = new Element('div', { 'class': 'filemanager-close', title: this.language.close, events: {click: this.hide.bind(this)} }).adopt(new Asset.image(this.options.assetBasePath + 'destroy.png')).inject(this.el); this.tips = new Tips({ className: 'tip-filebrowser', offsets: {x: 15, y: 0}, text: null, showDelay: 50, hideDelay: 50, onShow: function(){ this.tip.set('tween', {duration: 250}).setStyle('display', 'block').fade(1); }, onHide: function(){ this.tip.fade(0).get('tween').chain(function(){ this.element.setStyle('display', 'none'); }); } }); this.tips.attach(this.closeIcon.appearOn(this.closeIcon, [1, 0.8]).appearOn(this.el, 0.8)); this.imageadd = new Asset.image(this.options.assetBasePath + 'add.png', { 'class': 'browser-add' }).set('opacity', 0).inject(this.container); this.container.inject(document.body); this.overlay = new Overlay(this.options.hideOnClick ? { events: {click: this.hide.bind(this)} } : null); this.bound = { keydown: (function(e){ if (e.control || e.meta) this.imageadd.fade(1); }).bind(this), keyup: (function(){ this.imageadd.fade(0); }).bind(this), keyesc: (function(e){ if (e.key=='esc') this.hide(); }).bind(this), scroll: (function(){ this.el.center(this.offsets); this.fireEvent('scroll'); }).bind(this) }; }, show: function(e){ if (e) e.stop(); this.load(this.Directory); this.overlay.show(); this.info.set('opacity', 0); (function(){ this.container.setStyles({ opacity: 0, display: 'block' }); this.el.center(this.offsets); this.fireEvent('show'); this.container.set('opacity', 1); this.fireHooks('show'); window.addEvents({ scroll: this.bound.scroll, resize: this.bound.scroll, keyup: this.bound.keyesc }); }).delay(500, this); }, hide: function(e){ if (e) e.stop(); this.overlay.hide(); this.tips.hide(); this.browser.empty(); this.container.setStyle('display', 'none'); this.fireHooks('cleanup').fireEvent('hide'); window.removeEvent('scroll', this.bound.scroll).removeEvent('resize', this.bound.scroll).removeEvent('keyup', this.bound.keyesc); }, open: function(e){ e.stop(); if (!this.Current) return false; this.fireEvent('complete', [ // Xinha: The URL path returned by normal MootoolsFileManager is odd, it includes the last component // of the base directory, that is, if your base is /foo/bar/images then we get something like // images/narf.jpg. // To work around this we take the URL which was worked out by Backend/FileManager.php // and return that as the url. this.normalize(this.Current.file_data ? this.Current.file_data.url : this.Directory + '/' + this.Current.retrieve('file').name), this.Current.retrieve('file') ]); this.hide(); }, create: function(e){ e.stop(); var self = this; new Dialog(this.language.createdir, { language: { confirm: this.language.create, decline: this.language.cancel }, content: [ new Element('input', {'class': 'createDirectory'}) ], onOpen: this.onDialogOpen.bind(this), onClose: this.onDialogClose.bind(this), onShow: function(){ var self = this; this.el.getElement('input').addEvent('keyup', function(e){ if (e.key == 'enter') self.el.getElement('button-confirm').fireEvent('click'); }).focus(); }, onConfirm: function(){ new FileManager.Request({ url: self.options.url + '?event=create', onSuccess: self.fill.bind(self), data: { file: this.el.getElement('input').get('value'), directory: self.Directory } }, self).post(); } }); }, deselect: function(el){ if (el && this.Current != el) return; if (el) this.fillInfo(); if (this.Current) this.Current.removeClass('selected'); this.Current = null; this.switchButton(); }, load: function(dir, nofade){ this.deselect(); if (!nofade) this.info.fade(0); if (this.Request) this.Request.cancel(); this.Request = new FileManager.Request({ url: this.options.url, onSuccess: (function(j){ this.fill(j, nofade); }).bind(this), data: { directory: dir } }, this).post(); }, destroy: function(e, file){ e.stop(); this.tips.hide(); var self = this; new Dialog(this.language.destroyfile, { language: { confirm: this.language.destroy, decline: this.language.cancel }, onOpen: this.onDialogOpen.bind(this), onClose: this.onDialogClose.bind(this), onConfirm: function(){ new FileManager.Request({ url: self.options.url + '?event=destroy', data: { file: file.name, directory: self.Directory }, onSuccess: function(j){ if (!j || j.content!='destroyed'){ new Dialog(self.language.nodestroy, {language: {confirm: self.language.ok}, buttons: ['confirm']}); return; } self.fireEvent('modify', [$unlink(file)]); file.element.getParent().fade(0).get('tween').chain(function(){ self.deselect(file.element); this.element.destroy(); }); } }, self).post(); } }); }, rename: function(e, file){ e.stop(); this.tips.hide(); var name = file.name; if (file.mime != 'text/directory') name = name.replace(/\..*$/, ''); var self = this; new Dialog(this.language.renamefile, { language: { confirm: this.language.rename, decline: this.language.cancel }, content: [ new Element('input', {'class': 'rename', value: name}) ], onOpen: this.onDialogOpen.bind(this), onClose: this.onDialogClose.bind(this), onShow: function(){ var self = this; this.el.getElement('input').addEvent('keyup', function(e){ if (e.key=='enter') self.el.getElement('button-confirm').fireEvent('click'); }).focus(); }, onConfirm: function(){ new FileManager.Request({ url: self.options.url + '?event=move', onSuccess: (function(j){ if (!j || !j.name) return; self.fireEvent('modify', [$unlink(file)]); file.element.getElement('span').set('text', j.name); file.name = j.name; self.fillInfo(file); }).bind(this), data: { file: file.name, name: this.el.getElement('input').get('value'), directory: self.Directory } }, self).post(); } }); }, fill: function(j, nofade){ this.Directory = j.path; this.CurrentDir = j.dir; if (!nofade) this.fillInfo(j.dir); this.browser.empty(); if (!j.files) return; var els = [[], []]; $each(j.files, function(file){ file.dir = j.path; var el = file.element = new Element('span', {'class': 'fi', href: '#'}).adopt( new Asset.image(this.options.assetBasePath + 'Icons/' + file.icon + '.png'), new Element('span', {text: file.name}) ).store('file', file); var icons = []; if (file.mime!='text/directory') icons.push(new Asset.image(this.options.assetBasePath + 'disk.png', {title: this.language.download}).addClass('browser-icon').addEvent('click', (function(e){ this.tips.hide(); e.stop(); window.open(this.options.baseURL + this.normalize(this.Directory + '/' + file.name)); }).bind(this)).inject(el, 'top')); if (file.name != '..') ['rename', 'destroy'].each(function(v){ icons.push(new Asset.image(this.options.assetBasePath + v + '.png', {title: this.language[v]}).addClass('browser-icon').addEvent('click', this[v].bindWithEvent(this, [file])).injectTop(el)); }, this); els[file.mime == 'text/directory' ? 1 : 0].push(el); if (file.name == '..') el.set('opacity', 0.7); el.inject(new Element('li').inject(this.browser)).store('parent', el.getParent()); icons = $$(icons.map(function(icon){ return icon.appearOn(icon, [1, 0.7]); })).appearOn(el.getParent('li'), 0.7); }, this); var self = this, revert = function(el){ el.set('opacity', 1).store('block', true).removeClass('drag').removeClass('move').setStyles({ opacity: 1, zIndex: '', position: 'relative', width: 'auto', left: 0, top: 0 }).inject(el.retrieve('parent')); el.getElements('img.browser-icon').set('opacity', 0); document.removeEvents('keydown', self.bound.keydown).removeEvents('keyup', self.bound.keydown); self.imageadd.fade(0); self.relayClick.apply(el); }; if(0) // This (drag to move into subdirectory) is breaking IE, we don't need it that badly // See: http://github.com/cpojer/mootools-filemanager/issues#issue/11 $$(els[0]).makeDraggable({ droppables: $$(this.droppables, els[1]), onDrag: function(el, e){ self.imageadd.setStyles({ left: e.page.x + 15, top: e.page.y + 15 }); }, onBeforeStart: function(el){ self.deselect(); self.tips.hide(); var position = el.getPosition(); el.addClass('drag').setStyles({ zIndex: self.dragZIndex, position: 'absolute', width: el.getWidth() - el.getStyle('paddingLeft').toInt(), left: position.x, top: position.y }).inject(self.container); }, onCancel: revert, onStart: function(el){ el.set('opacity', 0.7).addClass('move'); document.addEvents({ keydown: self.bound.keydown, keyup: self.bound.keyup }); }, onEnter: function(el, droppable){ droppable.addClass('droppable'); }, onLeave: function(el, droppable){ droppable.removeClass('droppable'); }, onDrop: function(el, droppable, e){ revert(el); if (e.control || e.meta || !droppable) el.setStyles({left: 0, top: 0}); if (!droppable && !e.control && !e.meta) return; var dir; if (droppable){ droppable.addClass('selected').removeClass('droppable'); (function(){ droppable.removeClass('selected'); }).delay(300); if (self.onDragComplete(el, droppable)) return; dir = droppable.retrieve('file'); } var file = el.retrieve('file'); new FileManager.Request({ url: self.options.url + '?event=move', data: { file: file.name, directory: self.Directory, newDirectory: dir ? dir.dir + '/' + dir.name : self.Directory, copy: e.control || e.meta ? 1 : 0 }, onSuccess: function(){ if (!dir) self.load(self.Directory); } }, self).post(); self.fireEvent('modify', [$unlink(file)]); if (!e.control && !e.meta) el.fade(0).get('tween').chain(function(){ self.deselect(el); el.getParent().destroy(); }); } }); $$(els).setStyles({left: 0, top: 0}); this.tips.attach(this.browser.getElements('img.browser-icon')); }, fillInfo: function(file, path){ if (!file) file = this.CurrentDir; if (!path) path = this.Directory; if (!file) return; var size = this.size(file.size); this.info.fade(1).getElement('img').set({ src: this.options.assetBasePath + 'Icons/' + file.icon + '.png', alt: file.mime }); this.fireHooks('cleanup'); this.preview.empty(); // Xinha: We need to remove our custom attributes form when the preview is hidden this.fireEvent('hidePreview'); this.info.getElement('h1').set('text', file.name); this.info.getElement('dd.filemanager-modified').set('text', file.date); this.info.getElement('dd.filemanager-type').set('text', file.mime); this.info.getElement('dd.filemanager-size').set('text', !size[0] && size[1] == 'Bytes' ? '-' : (size.join(' ') + (size[1] != 'Bytes' ? ' (' + file.size + ' Bytes)' : ''))); this.info.getElement('h2.filemanager-headline').setStyle('display', file.mime == 'text/directory' ? 'none' : 'block'); var text = [], pre = []; path.split('/').each(function(v){ if (!v) return; pre.push(v); text.push(new Element('a', { 'class': 'icon', href: '#', text: v }).addEvent('click', (function(e, dir){ e.stop(); this.load(dir); }).bindWithEvent(this, [pre.join('/')])) ); text.push(new Element('span', {text: ' / '})); }, this); text.pop(); text[text.length-1].addClass('selected').removeEvents('click').addEvent('click', function(e){ e.stop(); }); this.info.getElement('dd.filemanager-dir').empty().adopt(new Element('span', {text: '/ '}), text); if (file.mime=='text/directory') return; if (this.Request) this.Request.cancel(); this.Request = new FileManager.Request({ url: this.options.url + '?event=detail', onSuccess: (function(j){ var prev = this.preview.removeClass('filemanager-loading').set('html', j && j.content ? j.content.substitute(this.language, /\\?\$\{([^{}]+)\}/g) : '').getElement('img.prev'); if (prev) prev.addEvent('load', function(){ this.setStyle('background', 'none'); }); var els = this.preview.getElements('button'); if (els) els.addEvent('click', function(e){ e.stop(); window.open(this.get('value')); }); // Xinha: We need to add in a form for setting the attributes of images etc, // so we add this event and pass it the information we have about the item // as returned by Backend/FileManager.php this.fireEvent('details', [j]); // Xinha: We also want to hold onto the data so we can access it // when selecting the image. if(this.Current) this.Current.file_data = j; }).bind(this), data: { directory: this.Directory, file: file.name } }, this).post(); }, size: function(size){ var tab = ['Bytes', 'KB', 'MB', 'GB', 'TB']; for(var i = 0; size > 1024; i++) size = size/1024; return [Math.round(size), tab[i]]; }, normalize: function(str){ return str.replace(/\/+/g, '/'); }, switchButton: function(){ var chk = !!this.Current; var el = this.menu.getElement('button.filemanager-open'); if (el) el.set('disabled', !chk)[(chk ? 'remove' : 'add') + 'Class']('disabled'); }, addMenuButton: function(name){ var el = new Element('button', { 'class': 'filemanager-' + name, text: this.language[name] }).inject(this.menu, 'top'); if (this[name]) el.addEvent('click', this[name].bind(this)); return el; }, fireHooks: function(hook){ var args = Array.slice(arguments, 1); for(var key in this.hooks[hook]) this.hooks[hook][key].apply(this, args); return this; }, onRequest: function(){ this.loader.set('opacity', 1); }, onComplete: function(){ this.loader.fade(0); }, onDialogOpen: $empty, onDialogClose: $empty, onDragComplete: $lambda(false) }); FileManager.Request = new Class({ Extends: Request.JSON, initialize: function(options, filebrowser){ // Xinha: We need ALL requests from the FileManager to have our authorisation data on it // normal MootoolsFileManager only has the flash send it :-( if(filebrowser) { options.url += (options.url.match(/\?/) ? '&' : '?') +Hash.toQueryString(filebrowser.options.uploadAuthData); } // Xinha: We also need to clean up the url because our backend already includes a query string // and MootoolsFileManager adds ?event=..... indiscriminately, our query string always // ends in an ampersand, so we can just clean up '&?event=' to be '&event=' options.url = options.url.replace(/&\?event=/, '&event='); this.parent(options); if (filebrowser) this.addEvents({ request: filebrowser.onRequest.bind(filebrowser), complete: filebrowser.onComplete.bind(filebrowser) }); } }); FileManager.Language = {};
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.js
JavaScript
art
21,291
/* --- description: FileManager Additions authors: - Christoph Pojer requires: core/1.2.4: '*' provides: - filemanager.additions license: MIT-style license contains: - Element.appearOn: Can be used to show an element when another one is hovered: $(myElement).appearOn(myWrapper) - Element.center: Centers an element - Dialog, Overlay: Classes used by the FileManager ... */ (function(){ Element.implement({ appearOn: function(el, opacity, options){ opacity = $type(opacity) == 'array' ? [opacity[0] || 1, opacity[1] || 0] : [opacity || 1, 0]; this.set({ opacity: opacity[1], tween: options || {duration: 200} }); $(el).addEvents({ mouseenter: this.fade.bind(this, opacity[0]), mouseleave: this.fade.bind(this, opacity[1]) }); return this; }, center: function(offsets){ var scroll = document.getScroll(), offset = document.getSize(), size = this.getSize(), values = {x: 'left', y: 'top'}; if (!offsets) offsets = {}; for (var z in values){ var style = scroll[z] + (offset[z] - size[z]) / 2 + (offsets[z] || 0); this.setStyle(values[z], style < 10 ? 10 : style); } return this; } }); this.Dialog = new Class({ Implements: [Options, Events], options: { /*onShow: $empty, onOpen: $empty, onConfirm: $empty, onDecline: $empty, onClose: $empty,*/ request: null, buttons: ['confirm', 'decline'], language: {} }, initialize: function(text, options){ this.setOptions(options); this.el = new Element('div', { 'class': 'fm-dialog fm-dialog-engine-' + Browser.Engine.name + ' fm-dialog-engine-' + Browser.Engine.name + (Browser.Engine.trident ? Browser.Engine.version : ''), opacity: 0, tween: {duration: 250} }).adopt([ $type(text) == 'string' ? new Element('div', {text: text}) : text ]); if (this.options.content) this.el.getElement('div').adopt(this.options.content); Array.each(this.options.buttons, function(v){ new Element('button', {'class': 'fm-dialog-' + v, text: this.options.language[v]}).addEvent('click', (function(e){ if (e) e.stop(); this.fireEvent(v).fireEvent('close'); this.overlay.hide(); this.destroy(); }).bind(this)).inject(this.el); }, this); this.overlay = new Overlay({ 'class': 'fm-overlay fm-overlay-dialog', events: {click: this.fireEvent.bind(this, ['close'])}, tween: {duration: 250} }); this.bound = { scroll: (function(){ if (!this.el) this.destroy(); else this.el.center(); }).bind(this), keyesc: (function(e){ if (e.key == 'esc') this.fireEvent('close').destroy(); }).bind(this) }; this.show(); }, show: function(){ this.overlay.show(); var self = this.fireEvent('open'); this.el.setStyle('display', 'block').inject(document.body).center().fade(1).get('tween').chain(function(){ var button = this.element.getElement('button.fm-dialog-confirm') || this.element.getElement('button'); if (button) button.focus(); self.fireEvent('show'); }); window.addEvents({ scroll: this.bound.scroll, resize: this.bound.scroll, keyup: this.bound.keyesc }); }, destroy: function(){ if (this.el) this.el.fade(0).get('tween').chain((function(){ this.overlay.destroy(); this.el.destroy(); }).bind(this)); window.removeEvent('scroll', this.bound.scroll).removeEvent('resize', this.bound.scroll).removeEvent('keyup', this.bound.keyesc); } }); this.Overlay = new Class({ initialize: function(options){ this.el = new Element('div', $extend({ 'class': 'fm-overlay' }, options)).inject(document.body); }, show: function(){ this.objects = $$('object, select, embed').filter(function(el){ return el.id == 'SwiffFileManagerUpload' || el.style.visibility == 'hidden' ? false : !!(el.style.visibility = 'hidden'); }); this.resize = (function(){ if (!this.el) this.destroy(); else this.el.setStyles({ width: document.getScrollWidth(), height: document.getScrollHeight() }); }).bind(this); this.resize(); this.el.setStyles({ opacity: 0, display: 'block' }).get('tween').pause().start('opacity', 0.5); window.addEvent('resize', this.resize); return this; }, hide: function(){ this.el.fade(0).get('tween').chain((function(){ this.revertObjects(); this.el.setStyle('display', 'none'); }).bind(this)); window.removeEvent('resize', this.resize); return this; }, destroy: function(){ this.revertObjects().el.destroy(); }, revertObjects: function(){ if (this.objects && this.objects.length) this.objects.each(function(el){ el.style.visibility = 'visible'; }); return this; } }); })();
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Source/Additions.js
JavaScript
art
4,691
<!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>Testground</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="http://og5.net/christoph/favicon.png" /> <style type="text/css"> body { font-size: 11px; font-family: Tahoma, sans-serif; } h1 { margin: 0 0 10px 0; padding: 0; color: #666; font-weight: normal; font-size: 24px; letter-spacing: 1px; word-spacing: 2px; line-height: 22px; min-height: 25px; } h1 span { font-size: 11px; letter-spacing: 0; word-spacing: 0; text-shadow: none; } .blue { color: #1f52b0; } div.content { min-height: 200px; margin: 23px 34px; padding: 10px 17px; border: 1px solid #b2b2b2; background: #fff; -moz-box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 2px; } div.content div.example { float: left; clear: both; margin: 10px 0; } button { margin: 5px 0; } </style> <link rel="stylesheet" media="all" type="text/css" href="../Css/FileManager.css" /> <link rel="stylesheet" media="all" type="text/css" href="../Css/Additions.css" /> <script type="text/javascript" src="mootools-core.js"></script> <script type="text/javascript" src="mootools-more.js"></script> <script type="text/javascript" src="../Source/FileManager.js"></script> <script type="text/javascript" src="../Language/Language.en.js"></script> <script type="text/javascript" src="../Language/Language.de.js"></script> <script type="text/javascript" src="../Source/Additions.js"></script> <script type="text/javascript" src="../Source/Uploader/Fx.ProgressBar.js"></script> <script type="text/javascript" src="../Source/Uploader/Swiff.Uploader.js"></script> <script type="text/javascript" src="../Source/Uploader.js"></script> <script type="text/javascript" src="../Source/Gallery.js"></script> <script type="text/javascript"> window.addEvent('domready', function(){ /* Simple Example */ var manager1 = new FileManager({ url: 'manager.php', assetBasePath: '../Assets', language: 'en', uploadAuthData: {session: 'MySessionId'} }); $('example1').addEvent('click', manager1.show.bind(manager1)); /* Select a file */ var el = $('example2'); var div, manager2; var complete = function(path, file){ el.set('value', path); if(div) div.destroy(); var icon = new Asset.image(this.options.assetBasePath+'cancel.png', {'class': 'file-cancel', title: this.language.deselect}).addEvent('click', function(e){ e.stop(); el.set('value', ''); var self = this; div.fade(0).get('tween').chain(function(){ div.destroy(); manager2.tips.hide(); manager2.tips.detach(self); }); }); manager2.tips.attach(icon); div = new Element('div', {'class': 'selected-file', text: 'Selected file: '}).adopt( new Asset.image(this.options.assetBasePath+'Icons/'+file.icon+'.png', {'class': 'mime-icon'}), new Element('span', {text: file.name}), icon ).inject(el, 'after'); }; manager2 = new FileManager({ url: 'selectImage.php', assetBasePath: '../Assets', language: 'en', selectable: true, uploadAuthData: {session: 'MySessionId'}, onComplete: complete }); el.setStyle('display', 'none'); var val = el.get('value'); if(val) complete.apply(manager2, [val, { name: val.split('/').getLast(), icon: val.split('.').getLast() }]); new Element('button', {'class': 'browser', text: 'Select an image'}).addEvent('click', manager2.show.bind(manager2)).inject(el, 'before'); /* Localized Example */ var manager3 = new FileManager({ url: 'manager.php', assetBasePath: '../Assets', language: 'de', hideOnClick: true, uploadAuthData: {session: 'MySessionId'} }); $('example3').addEvent('click', manager3.show.bind(manager3)); /* Gallery Example */ var global = this; var example4 = $('myGallery'); var manager4 = new FileManager.Gallery({ url: 'selectImage.php', assetBasePath: '../Assets', hideOnClick: true, uploadAuthData: {session: 'MySessionId'}, onShow: function(){ var obj; $try(function(){ obj = JSON.decode(example4.get('value')); }); this.populate(obj); }, onComplete: function(serialized){ example4.set('value', JSON.encode(serialized)); }, onPreview: function(src, caption, li){ /* Suggestion */ /* if (global.Slimbox) global.Slimbox.open(src, caption || '', { onClose: function(){ li.fireEvent('click', [e]); } }); */ } }); $('example4').addEvent('click', manager4.show.bind(manager4)); }); </script> </head> <body> <div id="content" class="content"> <h1>FileManager Demo</h1> <div class="example"> <button id="example1" class="BrowseExample">Open File-Manager</button> </div> <div class="example"> <input name="BrowseExample2" type="text" id="example2" value="Smile.gif" /> </div> <div class="example"> <a href="#" id="example3" class="BrowseExample">Open File-Manager from a link (German)</a> </div> <div class="example"> <button id="example4">Create a Gallery</button> <input name="BrowseExample4" type="text" id="myGallery" value="Gallery output will be stored in here" style="width: 250px;" /> </div> <div style="clear: both;"></div> </div> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/index.html
HTML
art
5,647
<!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>Testground</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="http://og5.net/christoph/favicon.png" /> <style type="text/css"> body { font-size: 11px; font-family: Tahoma, sans-serif; } h1 { margin: 0 0 10px 0; padding: 0; color: #666; font-weight: normal; font-size: 24px; letter-spacing: 1px; word-spacing: 2px; line-height: 22px; min-height: 25px; } h1 span { font-size: 11px; letter-spacing: 0; word-spacing: 0; text-shadow: none; } .blue { color: #1f52b0; } div.content { min-height: 200px; margin: 23px 34px; padding: 10px 17px; border: 1px solid #b2b2b2; background: #fff; -moz-box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 2px; } div.content div { margin: 10px 0; } </style> <link rel="stylesheet" media="all" type="text/css" href="../Css/FileManager.css" /> <link rel="stylesheet" media="all" type="text/css" href="../Css/Additions.css" /> <script type="text/javascript" src="TinyMCE/tiny_mce.js"></script> <script type="text/javascript" src="mootools-core.js"></script> <script type="text/javascript" src="mootools-more.js"></script> <script type="text/javascript" src="../Source/FileManager.js"></script> <script type="text/javascript" src="../Language/Language.en.js"></script> <script type="text/javascript" src="../Language/Language.de.js"></script> <script type="text/javascript" src="../Source/Additions.js"></script> <script type="text/javascript" src="../Source/Uploader/Fx.ProgressBar.js"></script> <script type="text/javascript" src="../Source/Uploader/Swiff.Uploader.js"></script> <script type="text/javascript" src="../Source/Uploader.js"></script> <script type="text/javascript" src="../Source/FileManager.TinyMCE.js"></script> <script type="text/javascript"> tinyMCE.init({ mode: 'textareas', language: 'en', theme: 'advanced', skin: 'o2k7', skin_variant: 'silver', plugins: 'safari,advimage,advlink,inlinepopups', theme_advanced_toolbar_location: 'top', theme_advanced_buttons1: 'link,unlink,image,forecolor,backcolor,|,sub,sup,|,hr,charmap,|,undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent,blockquote,bullist,numlist', theme_advanced_buttons2: '', theme_advanced_buttons3: '', width: '100%', height: '300px', /* Here goes the Magic */ file_browser_callback: FileManager.TinyMCE(function(type){ return { url: type=='image' ? 'selectImage.php' : 'manager.php', assetBasePath: '../Assets', language: 'de', selectable: true, uploadAuthData: {session: 'MySessionId'} }; }) }); window.addEvent('domready', function(){ $('getEditorText').addEvent('click', function(e){ e.stop(); $('editorContent').set('html', tinyMCE.activeEditor.getContent()); }); }); </script> </head> <body> <div id="content" class="content"> <h1>FileManager Demo</h1> <div> <textarea>Add an image or a link to a file!</textarea> <button id="getEditorText" name="getEditorTextButton">Get editor content</button> </div> <div id="editorContent"></div> </div> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/tinymce.html
HTML
art
3,482
<?php include('../Backend/FileManager.php'); // Please add your own authentication here function UploadIsAuthenticated($get){ if(!empty($get['session'])) return true; return false; } $browser = new FileManager(array( 'directory' => 'Files/', 'assetBasePath' => '../Assets', 'upload' => false, 'destroy' => false, )); $browser->fireEvent(!empty($_GET['event']) ? $_GET['event'] : null);
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/manager.php
PHP
art
398
/* --- script: Core.js description: The core of MooTools, contains all the base functions and the Native and Hash implementations. Required by all the other scripts. license: MIT-style license. copyright: Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/). authors: The MooTools production team (http://mootools.net/developers/) inspiration: - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) provides: [Mootools, Native, Hash.base, Array.each, $util] ... */ var MooTools = { 'version': '1.2.4', 'build': '0d9113241a90b9cd5643b926795852a2026710d4' }; var Native = function(options){ options = options || {}; var name = options.name; var legacy = options.legacy; var protect = options.protect; var methods = options.implement; var generics = options.generics; var initialize = options.initialize; var afterImplement = options.afterImplement || function(){}; var object = initialize || legacy; generics = generics !== false; object.constructor = Native; object.$family = {name: 'native'}; if (legacy && initialize) object.prototype = legacy.prototype; object.prototype.constructor = object; if (name){ var family = name.toLowerCase(); object.prototype.$family = {name: family}; Native.typize(object, family); } var add = function(obj, name, method, force){ if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method; if (generics) Native.genericize(obj, name, protect); afterImplement.call(obj, name, method); return obj; }; object.alias = function(a1, a2, a3){ if (typeof a1 == 'string'){ var pa1 = this.prototype[a1]; if ((a1 = pa1)) return add(this, a2, a1, a3); } for (var a in a1) this.alias(a, a1[a], a2); return this; }; object.implement = function(a1, a2, a3){ if (typeof a1 == 'string') return add(this, a1, a2, a3); for (var p in a1) add(this, p, a1[p], a2); return this; }; if (methods) object.implement(methods); return object; }; Native.genericize = function(object, property, check){ if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){ var args = Array.prototype.slice.call(arguments); return object.prototype[property].apply(args.shift(), args); }; }; Native.implement = function(objects, properties){ for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties); }; Native.typize = function(object, family){ if (!object.type) object.type = function(item){ return ($type(item) === family); }; }; (function(){ var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String}; for (var n in natives) new Native({name: n, initialize: natives[n], protect: true}); var types = {'boolean': Boolean, 'native': Native, 'object': Object}; for (var t in types) Native.typize(types[t], t); var generics = { 'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"], 'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"] }; for (var g in generics){ for (var i = generics[g].length; i--;) Native.genericize(natives[g], generics[g][i], true); } })(); var Hash = new Native({ name: 'Hash', initialize: function(object){ if ($type(object) == 'hash') object = $unlink(object.getClean()); for (var key in object) this[key] = object[key]; return this; } }); Hash.implement({ forEach: function(fn, bind){ for (var key in this){ if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this); } }, getClean: function(){ var clean = {}; for (var key in this){ if (this.hasOwnProperty(key)) clean[key] = this[key]; } return clean; }, getLength: function(){ var length = 0; for (var key in this){ if (this.hasOwnProperty(key)) length++; } return length; } }); Hash.alias('forEach', 'each'); Array.implement({ forEach: function(fn, bind){ for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this); } }); Array.alias('forEach', 'each'); function $A(iterable){ if (iterable.item){ var l = iterable.length, array = new Array(l); while (l--) array[l] = iterable[l]; return array; } return Array.prototype.slice.call(iterable); }; function $arguments(i){ return function(){ return arguments[i]; }; }; function $chk(obj){ return !!(obj || obj === 0); }; function $clear(timer){ clearTimeout(timer); clearInterval(timer); return null; }; function $defined(obj){ return (obj != undefined); }; function $each(iterable, fn, bind){ var type = $type(iterable); ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind); }; function $empty(){}; function $extend(original, extended){ for (var key in (extended || {})) original[key] = extended[key]; return original; }; function $H(object){ return new Hash(object); }; function $lambda(value){ return ($type(value) == 'function') ? value : function(){ return value; }; }; function $merge(){ var args = Array.slice(arguments); args.unshift({}); return $mixin.apply(null, args); }; function $mixin(mix){ for (var i = 1, l = arguments.length; i < l; i++){ var object = arguments[i]; if ($type(object) != 'object') continue; for (var key in object){ var op = object[key], mp = mix[key]; mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $mixin(mp, op) : $unlink(op); } } return mix; }; function $pick(){ for (var i = 0, l = arguments.length; i < l; i++){ if (arguments[i] != undefined) return arguments[i]; } return null; }; function $random(min, max){ return Math.floor(Math.random() * (max - min + 1) + min); }; function $splat(obj){ var type = $type(obj); return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : []; }; var $time = Date.now || function(){ return +new Date; }; function $try(){ for (var i = 0, l = arguments.length; i < l; i++){ try { return arguments[i](); } catch(e){} } return null; }; function $type(obj){ if (obj == undefined) return false; if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name; if (obj.nodeName){ switch (obj.nodeType){ case 1: return 'element'; case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace'; } } else if (typeof obj.length == 'number'){ if (obj.callee) return 'arguments'; else if (obj.item) return 'collection'; } return typeof obj; }; function $unlink(object){ var unlinked; switch ($type(object)){ case 'object': unlinked = {}; for (var p in object) unlinked[p] = $unlink(object[p]); break; case 'hash': unlinked = new Hash(object); break; case 'array': unlinked = []; for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]); break; default: return object; } return unlinked; }; /* --- script: Browser.js description: The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash. license: MIT-style license. requires: - /Native - /$util provides: [Browser, Window, Document, $exec] ... */ var Browser = $merge({ Engine: {name: 'unknown', version: 0}, Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()}, Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)}, Plugins: {}, Engines: { presto: function(){ return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925)); }, trident: function(){ return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? ((document.querySelectorAll) ? 6 : 5) : 4); }, webkit: function(){ return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419); }, gecko: function(){ return (!document.getBoxObjectFor && window.mozInnerScreenX == null) ? false : ((document.getElementsByClassName) ? 19 : 18); } } }, Browser || {}); Browser.Platform[Browser.Platform.name] = true; Browser.detect = function(){ for (var engine in this.Engines){ var version = this.Engines[engine](); if (version){ this.Engine = {name: engine, version: version}; this.Engine[engine] = this.Engine[engine + version] = true; break; } } return {name: engine, version: version}; }; Browser.detect(); Browser.Request = function(){ return $try(function(){ return new XMLHttpRequest(); }, function(){ return new ActiveXObject('MSXML2.XMLHTTP'); }, function(){ return new ActiveXObject('Microsoft.XMLHTTP'); }); }; Browser.Features.xhr = !!(Browser.Request()); Browser.Plugins.Flash = (function(){ var version = ($try(function(){ return navigator.plugins['Shockwave Flash'].description; }, function(){ return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); }) || '0 r0').match(/\d+/g); return {version: parseInt(version[0] || 0 + '.' + version[1], 10) || 0, build: parseInt(version[2], 10) || 0}; })(); function $exec(text){ if (!text) return text; if (window.execScript){ window.execScript(text); } else { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text; document.head.appendChild(script); document.head.removeChild(script); } return text; }; Native.UID = 1; var $uid = (Browser.Engine.trident) ? function(item){ return (item.uid || (item.uid = [Native.UID++]))[0]; } : function(item){ return item.uid || (item.uid = Native.UID++); }; var Window = new Native({ name: 'Window', legacy: (Browser.Engine.trident) ? null: window.Window, initialize: function(win){ $uid(win); if (!win.Element){ win.Element = $empty; if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2 win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {}; } win.document.window = win; return $extend(win, Window.Prototype); }, afterImplement: function(property, value){ window[property] = Window.Prototype[property] = value; } }); Window.Prototype = {$family: {name: 'window'}}; new Window(window); var Document = new Native({ name: 'Document', legacy: (Browser.Engine.trident) ? null: window.Document, initialize: function(doc){ $uid(doc); doc.head = doc.getElementsByTagName('head')[0]; doc.html = doc.getElementsByTagName('html')[0]; if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){ doc.execCommand("BackgroundImageCache", false, true); }); if (Browser.Engine.trident) doc.window.attachEvent('onunload', function(){ doc.window.detachEvent('onunload', arguments.callee); doc.head = doc.html = doc.window = null; }); return $extend(doc, Document.Prototype); }, afterImplement: function(property, value){ document[property] = Document.Prototype[property] = value; } }); Document.Prototype = {$family: {name: 'document'}}; new Document(document); /* --- script: Array.js description: Contains Array Prototypes like each, contains, and erase. license: MIT-style license. requires: - /$util - /Array.each provides: [Array] ... */ Array.implement({ every: function(fn, bind){ for (var i = 0, l = this.length; i < l; i++){ if (!fn.call(bind, this[i], i, this)) return false; } return true; }, filter: function(fn, bind){ var results = []; for (var i = 0, l = this.length; i < l; i++){ if (fn.call(bind, this[i], i, this)) results.push(this[i]); } return results; }, clean: function(){ return this.filter($defined); }, indexOf: function(item, from){ var len = this.length; for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){ if (this[i] === item) return i; } return -1; }, map: function(fn, bind){ var results = []; for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this); return results; }, some: function(fn, bind){ for (var i = 0, l = this.length; i < l; i++){ if (fn.call(bind, this[i], i, this)) return true; } return false; }, associate: function(keys){ var obj = {}, length = Math.min(this.length, keys.length); for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; return obj; }, link: function(object){ var result = {}; for (var i = 0, l = this.length; i < l; i++){ for (var key in object){ if (object[key](this[i])){ result[key] = this[i]; delete object[key]; break; } } } return result; }, contains: function(item, from){ return this.indexOf(item, from) != -1; }, extend: function(array){ for (var i = 0, j = array.length; i < j; i++) this.push(array[i]); return this; }, getLast: function(){ return (this.length) ? this[this.length - 1] : null; }, getRandom: function(){ return (this.length) ? this[$random(0, this.length - 1)] : null; }, include: function(item){ if (!this.contains(item)) this.push(item); return this; }, combine: function(array){ for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); return this; }, erase: function(item){ for (var i = this.length; i--; i){ if (this[i] === item) this.splice(i, 1); } return this; }, empty: function(){ this.length = 0; return this; }, flatten: function(){ var array = []; for (var i = 0, l = this.length; i < l; i++){ var type = $type(this[i]); if (!type) continue; array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]); } return array; }, hexToRgb: function(array){ if (this.length != 3) return null; var rgb = this.map(function(value){ if (value.length == 1) value += value; return value.toInt(16); }); return (array) ? rgb : 'rgb(' + rgb + ')'; }, rgbToHex: function(array){ if (this.length < 3) return null; if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; var hex = []; for (var i = 0; i < 3; i++){ var bit = (this[i] - 0).toString(16); hex.push((bit.length == 1) ? '0' + bit : bit); } return (array) ? hex : '#' + hex.join(''); } }); /* --- script: Function.js description: Contains Function Prototypes like create, bind, pass, and delay. license: MIT-style license. requires: - /Native - /$util provides: [Function] ... */ Function.implement({ extend: function(properties){ for (var property in properties) this[property] = properties[property]; return this; }, create: function(options){ var self = this; options = options || {}; return function(event){ var args = options.arguments; args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0); if (options.event) args = [event || window.event].extend(args); var returns = function(){ return self.apply(options.bind || null, args); }; if (options.delay) return setTimeout(returns, options.delay); if (options.periodical) return setInterval(returns, options.periodical); if (options.attempt) return $try(returns); return returns(); }; }, run: function(args, bind){ return this.apply(bind, $splat(args)); }, pass: function(args, bind){ return this.create({bind: bind, arguments: args}); }, bind: function(bind, args){ return this.create({bind: bind, arguments: args}); }, bindWithEvent: function(bind, args){ return this.create({bind: bind, arguments: args, event: true}); }, attempt: function(args, bind){ return this.create({bind: bind, arguments: args, attempt: true})(); }, delay: function(delay, bind, args){ return this.create({bind: bind, arguments: args, delay: delay})(); }, periodical: function(periodical, bind, args){ return this.create({bind: bind, arguments: args, periodical: periodical})(); } }); /* --- script: Number.js description: Contains Number Prototypes like limit, round, times, and ceil. license: MIT-style license. requires: - /Native - /$util provides: [Number] ... */ Number.implement({ limit: function(min, max){ return Math.min(max, Math.max(min, this)); }, round: function(precision){ precision = Math.pow(10, precision || 0); return Math.round(this * precision) / precision; }, times: function(fn, bind){ for (var i = 0; i < this; i++) fn.call(bind, i, this); }, toFloat: function(){ return parseFloat(this); }, toInt: function(base){ return parseInt(this, base || 10); } }); Number.alias('times', 'each'); (function(math){ var methods = {}; math.each(function(name){ if (!Number[name]) methods[name] = function(){ return Math[name].apply(null, [this].concat($A(arguments))); }; }); Number.implement(methods); })(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); /* --- script: String.js description: Contains String Prototypes like camelCase, capitalize, test, and toInt. license: MIT-style license. requires: - /Native provides: [String] ... */ String.implement({ test: function(regex, params){ return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this); }, contains: function(string, separator){ return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1; }, trim: function(){ return this.replace(/^\s+|\s+$/g, ''); }, clean: function(){ return this.replace(/\s+/g, ' ').trim(); }, camelCase: function(){ return this.replace(/-\D/g, function(match){ return match.charAt(1).toUpperCase(); }); }, hyphenate: function(){ return this.replace(/[A-Z]/g, function(match){ return ('-' + match.charAt(0).toLowerCase()); }); }, capitalize: function(){ return this.replace(/\b[a-z]/g, function(match){ return match.toUpperCase(); }); }, escapeRegExp: function(){ return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); }, toInt: function(base){ return parseInt(this, base || 10); }, toFloat: function(){ return parseFloat(this); }, hexToRgb: function(array){ var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); return (hex) ? hex.slice(1).hexToRgb(array) : null; }, rgbToHex: function(array){ var rgb = this.match(/\d{1,3}/g); return (rgb) ? rgb.rgbToHex(array) : null; }, stripScripts: function(option){ var scripts = ''; var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){ scripts += arguments[1] + '\n'; return ''; }); if (option === true) $exec(scripts); else if ($type(option) == 'function') option(scripts, text); return text; }, substitute: function(object, regexp){ return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ if (match.charAt(0) == '\\') return match.slice(1); return (object[name] != undefined) ? object[name] : ''; }); } }); /* --- script: Hash.js description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. license: MIT-style license. requires: - /Hash.base provides: [Hash] ... */ Hash.implement({ has: Object.prototype.hasOwnProperty, keyOf: function(value){ for (var key in this){ if (this.hasOwnProperty(key) && this[key] === value) return key; } return null; }, hasValue: function(value){ return (Hash.keyOf(this, value) !== null); }, extend: function(properties){ Hash.each(properties || {}, function(value, key){ Hash.set(this, key, value); }, this); return this; }, combine: function(properties){ Hash.each(properties || {}, function(value, key){ Hash.include(this, key, value); }, this); return this; }, erase: function(key){ if (this.hasOwnProperty(key)) delete this[key]; return this; }, get: function(key){ return (this.hasOwnProperty(key)) ? this[key] : null; }, set: function(key, value){ if (!this[key] || this.hasOwnProperty(key)) this[key] = value; return this; }, empty: function(){ Hash.each(this, function(value, key){ delete this[key]; }, this); return this; }, include: function(key, value){ if (this[key] == undefined) this[key] = value; return this; }, map: function(fn, bind){ var results = new Hash; Hash.each(this, function(value, key){ results.set(key, fn.call(bind, value, key, this)); }, this); return results; }, filter: function(fn, bind){ var results = new Hash; Hash.each(this, function(value, key){ if (fn.call(bind, value, key, this)) results.set(key, value); }, this); return results; }, every: function(fn, bind){ for (var key in this){ if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false; } return true; }, some: function(fn, bind){ for (var key in this){ if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true; } return false; }, getKeys: function(){ var keys = []; Hash.each(this, function(value, key){ keys.push(key); }); return keys; }, getValues: function(){ var values = []; Hash.each(this, function(value){ values.push(value); }); return values; }, toQueryString: function(base){ var queryString = []; Hash.each(this, function(value, key){ if (base) key = base + '[' + key + ']'; var result; switch ($type(value)){ case 'object': result = Hash.toQueryString(value, key); break; case 'array': var qs = {}; value.each(function(val, i){ qs[i] = val; }); result = Hash.toQueryString(qs, key); break; default: result = key + '=' + encodeURIComponent(value); } if (value != undefined) queryString.push(result); }); return queryString.join('&'); } }); Hash.alias({keyOf: 'indexOf', hasValue: 'contains'}); /* --- script: Event.js description: Contains the Event Class, to make the event object cross-browser. license: MIT-style license. requires: - /Window - /Document - /Hash - /Array - /Function - /String provides: [Event] ... */ var Event = new Native({ name: 'Event', initialize: function(event, win){ win = win || window; var doc = win.document; event = event || win.event; if (event.$extended) return event; this.$extended = true; var type = event.type; var target = event.target || event.srcElement; while (target && target.nodeType == 3) target = target.parentNode; if (type.test(/key/)){ var code = event.which || event.keyCode; var key = Event.Keys.keyOf(code); if (type == 'keydown'){ var fKey = code - 111; if (fKey > 0 && fKey < 13) key = 'f' + fKey; } key = key || String.fromCharCode(code).toLowerCase(); } else if (type.match(/(click|mouse|menu)/i)){ doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; var page = { x: event.pageX || event.clientX + doc.scrollLeft, y: event.pageY || event.clientY + doc.scrollTop }; var client = { x: (event.pageX) ? event.pageX - win.pageXOffset : event.clientX, y: (event.pageY) ? event.pageY - win.pageYOffset : event.clientY }; if (type.match(/DOMMouseScroll|mousewheel/)){ var wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; } var rightClick = (event.which == 3) || (event.button == 2); var related = null; if (type.match(/over|out/)){ switch (type){ case 'mouseover': related = event.relatedTarget || event.fromElement; break; case 'mouseout': related = event.relatedTarget || event.toElement; } if (!(function(){ while (related && related.nodeType == 3) related = related.parentNode; return true; }).create({attempt: Browser.Engine.gecko})()) related = false; } } return $extend(this, { event: event, type: type, page: page, client: client, rightClick: rightClick, wheel: wheel, relatedTarget: related, target: target, code: code, key: key, shift: event.shiftKey, control: event.ctrlKey, alt: event.altKey, meta: event.metaKey }); } }); Event.Keys = new Hash({ 'enter': 13, 'up': 38, 'down': 40, 'left': 37, 'right': 39, 'esc': 27, 'space': 32, 'backspace': 8, 'tab': 9, 'delete': 46 }); Event.implement({ stop: function(){ return this.stopPropagation().preventDefault(); }, stopPropagation: function(){ if (this.event.stopPropagation) this.event.stopPropagation(); else this.event.cancelBubble = true; return this; }, preventDefault: function(){ if (this.event.preventDefault) this.event.preventDefault(); else this.event.returnValue = false; return this; } }); /* --- script: Class.js description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. license: MIT-style license. requires: - /$util - /Native - /Array - /String - /Function - /Number - /Hash provides: [Class] ... */ function Class(params){ if (params instanceof Function) params = {initialize: params}; var newClass = function(){ Object.reset(this); if (newClass._prototyping) return this; this._current = $empty; var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; delete this._current; delete this.caller; return value; }.extend(this); newClass.implement(params); newClass.constructor = Class; newClass.prototype.constructor = newClass; return newClass; }; Function.prototype.protect = function(){ this._protected = true; return this; }; Object.reset = function(object, key){ if (key == null){ for (var p in object) Object.reset(object, p); return object; } delete object[key]; switch ($type(object[key])){ case 'object': var F = function(){}; F.prototype = object[key]; var i = new F; object[key] = Object.reset(i); break; case 'array': object[key] = $unlink(object[key]); break; } return object; }; new Native({name: 'Class', initialize: Class}).extend({ instantiate: function(F){ F._prototyping = true; var proto = new F; delete F._prototyping; return proto; }, wrap: function(self, key, method){ if (method._origin) method = method._origin; return function(){ if (method._protected && this._current == null) throw new Error('The method "' + key + '" cannot be called.'); var caller = this.caller, current = this._current; this.caller = current; this._current = arguments.callee; var result = method.apply(this, arguments); this._current = current; this.caller = caller; return result; }.extend({_owner: self, _origin: method, _name: key}); } }); Class.implement({ implement: function(key, value){ if ($type(key) == 'object'){ for (var p in key) this.implement(p, key[p]); return this; } var mutator = Class.Mutators[key]; if (mutator){ value = mutator.call(this, value); if (value == null) return this; } var proto = this.prototype; switch ($type(value)){ case 'function': if (value._hidden) return this; proto[key] = Class.wrap(this, key, value); break; case 'object': var previous = proto[key]; if ($type(previous) == 'object') $mixin(previous, value); else proto[key] = $unlink(value); break; case 'array': proto[key] = $unlink(value); break; default: proto[key] = value; } return this; } }); Class.Mutators = { Extends: function(parent){ this.parent = parent; this.prototype = Class.instantiate(parent); this.implement('parent', function(){ var name = this.caller._name, previous = this.caller._owner.parent.prototype[name]; if (!previous) throw new Error('The method "' + name + '" has no parent.'); return previous.apply(this, arguments); }.protect()); }, Implements: function(items){ $splat(items).each(function(item){ if (item instanceof Function) item = Class.instantiate(item); this.implement(item); }, this); } }; /* --- script: Class.Extras.js description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. license: MIT-style license. requires: - /Class provides: [Chain, Events, Options] ... */ var Chain = new Class({ $chain: [], chain: function(){ this.$chain.extend(Array.flatten(arguments)); return this; }, callChain: function(){ return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; }, clearChain: function(){ this.$chain.empty(); return this; } }); var Events = new Class({ $events: {}, addEvent: function(type, fn, internal){ type = Events.removeOn(type); if (fn != $empty){ this.$events[type] = this.$events[type] || []; this.$events[type].include(fn); if (internal) fn.internal = true; } return this; }, addEvents: function(events){ for (var type in events) this.addEvent(type, events[type]); return this; }, fireEvent: function(type, args, delay){ type = Events.removeOn(type); if (!this.$events || !this.$events[type]) return this; this.$events[type].each(function(fn){ fn.create({'bind': this, 'delay': delay, 'arguments': args})(); }, this); return this; }, removeEvent: function(type, fn){ type = Events.removeOn(type); if (!this.$events[type]) return this; if (!fn.internal) this.$events[type].erase(fn); return this; }, removeEvents: function(events){ var type; if ($type(events) == 'object'){ for (type in events) this.removeEvent(type, events[type]); return this; } if (events) events = Events.removeOn(events); for (type in this.$events){ if (events && events != type) continue; var fns = this.$events[type]; for (var i = fns.length; i--; i) this.removeEvent(type, fns[i]); } return this; } }); Events.removeOn = function(string){ return string.replace(/^on([A-Z])/, function(full, first){ return first.toLowerCase(); }); }; var Options = new Class({ setOptions: function(){ this.options = $merge.run([this.options].extend(arguments)); if (!this.addEvent) return this; for (var option in this.options){ if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; this.addEvent(option, this.options[option]); delete this.options[option]; } return this; } }); /* --- script: Element.js description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements. license: MIT-style license. requires: - /Window - /Document - /Array - /String - /Function - /Number - /Hash provides: [Element, Elements, $, $$, Iframe] ... */ var Element = new Native({ name: 'Element', legacy: window.Element, initialize: function(tag, props){ var konstructor = Element.Constructors.get(tag); if (konstructor) return konstructor(props); if (typeof tag == 'string') return document.newElement(tag, props); return document.id(tag).set(props); }, afterImplement: function(key, value){ Element.Prototype[key] = value; if (Array[key]) return; Elements.implement(key, function(){ var items = [], elements = true; for (var i = 0, j = this.length; i < j; i++){ var returns = this[i][key].apply(this[i], arguments); items.push(returns); if (elements) elements = ($type(returns) == 'element'); } return (elements) ? new Elements(items) : items; }); } }); Element.Prototype = {$family: {name: 'element'}}; Element.Constructors = new Hash; var IFrame = new Native({ name: 'IFrame', generics: false, initialize: function(){ var params = Array.link(arguments, {properties: Object.type, iframe: $defined}); var props = params.properties || {}; var iframe = document.id(params.iframe); var onload = props.onload || $empty; delete props.onload; props.id = props.name = $pick(props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + $time()); iframe = new Element(iframe || 'iframe', props); var onFrameLoad = function(){ var host = $try(function(){ return iframe.contentWindow.location.host; }); if (!host || host == window.location.host){ var win = new Window(iframe.contentWindow); new Document(iframe.contentWindow.document); $extend(win.Element.prototype, Element.Prototype); } onload.call(iframe.contentWindow, iframe.contentWindow.document); }; var contentWindow = $try(function(){ return iframe.contentWindow; }); ((contentWindow && contentWindow.document.body) || window.frames[props.id]) ? onFrameLoad() : iframe.addListener('load', onFrameLoad); return iframe; } }); var Elements = new Native({ initialize: function(elements, options){ options = $extend({ddup: true, cash: true}, options); elements = elements || []; if (options.ddup || options.cash){ var uniques = {}, returned = []; for (var i = 0, l = elements.length; i < l; i++){ var el = document.id(elements[i], !options.cash); if (options.ddup){ if (uniques[el.uid]) continue; uniques[el.uid] = true; } if (el) returned.push(el); } elements = returned; } return (options.cash) ? $extend(elements, this) : elements; } }); Elements.implement({ filter: function(filter, bind){ if (!filter) return this; return new Elements(Array.filter(this, (typeof filter == 'string') ? function(item){ return item.match(filter); } : filter, bind)); } }); Document.implement({ newElement: function(tag, props){ if (Browser.Engine.trident && props){ ['name', 'type', 'checked'].each(function(attribute){ if (!props[attribute]) return; tag += ' ' + attribute + '="' + props[attribute] + '"'; if (attribute != 'checked') delete props[attribute]; }); tag = '<' + tag + '>'; } return document.id(this.createElement(tag)).set(props); }, newTextNode: function(text){ return this.createTextNode(text); }, getDocument: function(){ return this; }, getWindow: function(){ return this.window; }, id: (function(){ var types = { string: function(id, nocash, doc){ id = doc.getElementById(id); return (id) ? types.element(id, nocash) : null; }, element: function(el, nocash){ $uid(el); if (!nocash && !el.$family && !(/^object|embed$/i).test(el.tagName)){ var proto = Element.Prototype; for (var p in proto) el[p] = proto[p]; }; return el; }, object: function(obj, nocash, doc){ if (obj.toElement) return types.element(obj.toElement(doc), nocash); return null; } }; types.textnode = types.whitespace = types.window = types.document = $arguments(0); return function(el, nocash, doc){ if (el && el.$family && el.uid) return el; var type = $type(el); return (types[type]) ? types[type](el, nocash, doc || document) : null; }; })() }); if (window.$ == null) Window.implement({ $: function(el, nc){ return document.id(el, nc, this.document); } }); Window.implement({ $$: function(selector){ if (arguments.length == 1 && typeof selector == 'string') return this.document.getElements(selector); var elements = []; var args = Array.flatten(arguments); for (var i = 0, l = args.length; i < l; i++){ var item = args[i]; switch ($type(item)){ case 'element': elements.push(item); break; case 'string': elements.extend(this.document.getElements(item, true)); } } return new Elements(elements); }, getDocument: function(){ return this.document; }, getWindow: function(){ return this; } }); Native.implement([Element, Document], { getElement: function(selector, nocash){ return document.id(this.getElements(selector, true)[0] || null, nocash); }, getElements: function(tags, nocash){ tags = tags.split(','); var elements = []; var ddup = (tags.length > 1); tags.each(function(tag){ var partial = this.getElementsByTagName(tag.trim()); (ddup) ? elements.extend(partial) : elements = partial; }, this); return new Elements(elements, {ddup: ddup, cash: !nocash}); } }); (function(){ var collected = {}, storage = {}; var props = {input: 'checked', option: 'selected', textarea: (Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerHTML' : 'value'}; var get = function(uid){ return (storage[uid] || (storage[uid] = {})); }; var clean = function(item, retain){ if (!item) return; var uid = item.uid; if (Browser.Engine.trident){ if (item.clearAttributes){ var clone = retain && item.cloneNode(false); item.clearAttributes(); if (clone) item.mergeAttributes(clone); } else if (item.removeEvents){ item.removeEvents(); } if ((/object/i).test(item.tagName)){ for (var p in item){ if (typeof item[p] == 'function') item[p] = $empty; } Element.dispose(item); } } if (!uid) return; collected[uid] = storage[uid] = null; }; var purge = function(){ Hash.each(collected, clean); if (Browser.Engine.trident) $A(document.getElementsByTagName('object')).each(clean); if (window.CollectGarbage) CollectGarbage(); collected = storage = null; }; var walk = function(element, walk, start, match, all, nocash){ var el = element[start || walk]; var elements = []; while (el){ if (el.nodeType == 1 && (!match || Element.match(el, match))){ if (!all) return document.id(el, nocash); elements.push(el); } el = el[walk]; } return (all) ? new Elements(elements, {ddup: false, cash: !nocash}) : null; }; var attributes = { 'html': 'innerHTML', 'class': 'className', 'for': 'htmlFor', 'defaultValue': 'defaultValue', 'text': (Browser.Engine.trident || (Browser.Engine.webkit && Browser.Engine.version < 420)) ? 'innerText' : 'textContent' }; var bools = ['compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', 'disabled', 'readonly', 'multiple', 'selected', 'noresize', 'defer']; var camels = ['value', 'type', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', 'frameBorder', 'maxLength', 'readOnly', 'rowSpan', 'tabIndex', 'useMap']; bools = bools.associate(bools); Hash.extend(attributes, bools); Hash.extend(attributes, camels.associate(camels.map(String.toLowerCase))); var inserters = { before: function(context, element){ if (element.parentNode) element.parentNode.insertBefore(context, element); }, after: function(context, element){ if (!element.parentNode) return; var next = element.nextSibling; (next) ? element.parentNode.insertBefore(context, next) : element.parentNode.appendChild(context); }, bottom: function(context, element){ element.appendChild(context); }, top: function(context, element){ var first = element.firstChild; (first) ? element.insertBefore(context, first) : element.appendChild(context); } }; inserters.inside = inserters.bottom; Hash.each(inserters, function(inserter, where){ where = where.capitalize(); Element.implement('inject' + where, function(el){ inserter(this, document.id(el, true)); return this; }); Element.implement('grab' + where, function(el){ inserter(document.id(el, true), this); return this; }); }); Element.implement({ set: function(prop, value){ switch ($type(prop)){ case 'object': for (var p in prop) this.set(p, prop[p]); break; case 'string': var property = Element.Properties.get(prop); (property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value); } return this; }, get: function(prop){ var property = Element.Properties.get(prop); return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop); }, erase: function(prop){ var property = Element.Properties.get(prop); (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop); return this; }, setProperty: function(attribute, value){ var key = attributes[attribute]; if (value == undefined) return this.removeProperty(attribute); if (key && bools[attribute]) value = !!value; (key) ? this[key] = value : this.setAttribute(attribute, '' + value); return this; }, setProperties: function(attributes){ for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); return this; }, getProperty: function(attribute){ var key = attributes[attribute]; var value = (key) ? this[key] : this.getAttribute(attribute, 2); return (bools[attribute]) ? !!value : (key) ? value : value || null; }, getProperties: function(){ var args = $A(arguments); return args.map(this.getProperty, this).associate(args); }, removeProperty: function(attribute){ var key = attributes[attribute]; (key) ? this[key] = (key && bools[attribute]) ? false : '' : this.removeAttribute(attribute); return this; }, removeProperties: function(){ Array.each(arguments, this.removeProperty, this); return this; }, hasClass: function(className){ return this.className.contains(className, ' '); }, addClass: function(className){ if (!this.hasClass(className)) this.className = (this.className + ' ' + className).clean(); return this; }, removeClass: function(className){ this.className = this.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1'); return this; }, toggleClass: function(className){ return this.hasClass(className) ? this.removeClass(className) : this.addClass(className); }, adopt: function(){ Array.flatten(arguments).each(function(element){ element = document.id(element, true); if (element) this.appendChild(element); }, this); return this; }, appendText: function(text, where){ return this.grab(this.getDocument().newTextNode(text), where); }, grab: function(el, where){ inserters[where || 'bottom'](document.id(el, true), this); return this; }, inject: function(el, where){ inserters[where || 'bottom'](this, document.id(el, true)); return this; }, replaces: function(el){ el = document.id(el, true); el.parentNode.replaceChild(this, el); return this; }, wraps: function(el, where){ el = document.id(el, true); return this.replaces(el).grab(el, where); }, getPrevious: function(match, nocash){ return walk(this, 'previousSibling', null, match, false, nocash); }, getAllPrevious: function(match, nocash){ return walk(this, 'previousSibling', null, match, true, nocash); }, getNext: function(match, nocash){ return walk(this, 'nextSibling', null, match, false, nocash); }, getAllNext: function(match, nocash){ return walk(this, 'nextSibling', null, match, true, nocash); }, getFirst: function(match, nocash){ return walk(this, 'nextSibling', 'firstChild', match, false, nocash); }, getLast: function(match, nocash){ return walk(this, 'previousSibling', 'lastChild', match, false, nocash); }, getParent: function(match, nocash){ return walk(this, 'parentNode', null, match, false, nocash); }, getParents: function(match, nocash){ return walk(this, 'parentNode', null, match, true, nocash); }, getSiblings: function(match, nocash){ return this.getParent().getChildren(match, nocash).erase(this); }, getChildren: function(match, nocash){ return walk(this, 'nextSibling', 'firstChild', match, true, nocash); }, getWindow: function(){ return this.ownerDocument.window; }, getDocument: function(){ return this.ownerDocument; }, getElementById: function(id, nocash){ var el = this.ownerDocument.getElementById(id); if (!el) return null; for (var parent = el.parentNode; parent != this; parent = parent.parentNode){ if (!parent) return null; } return document.id(el, nocash); }, getSelected: function(){ return new Elements($A(this.options).filter(function(option){ return option.selected; })); }, getComputedStyle: function(property){ if (this.currentStyle) return this.currentStyle[property.camelCase()]; var computed = this.getDocument().defaultView.getComputedStyle(this, null); return (computed) ? computed.getPropertyValue([property.hyphenate()]) : null; }, toQueryString: function(){ var queryString = []; this.getElements('input, select, textarea', true).each(function(el){ if (!el.name || el.disabled || el.type == 'submit' || el.type == 'reset' || el.type == 'file') return; var value = (el.tagName.toLowerCase() == 'select') ? Element.getSelected(el).map(function(opt){ return opt.value; }) : ((el.type == 'radio' || el.type == 'checkbox') && !el.checked) ? null : el.value; $splat(value).each(function(val){ if (typeof val != 'undefined') queryString.push(el.name + '=' + encodeURIComponent(val)); }); }); return queryString.join('&'); }, clone: function(contents, keepid){ contents = contents !== false; var clone = this.cloneNode(contents); var clean = function(node, element){ if (!keepid) node.removeAttribute('id'); if (Browser.Engine.trident){ node.clearAttributes(); node.mergeAttributes(element); node.removeAttribute('uid'); if (node.options){ var no = node.options, eo = element.options; for (var j = no.length; j--;) no[j].selected = eo[j].selected; } } var prop = props[element.tagName.toLowerCase()]; if (prop && element[prop]) node[prop] = element[prop]; }; if (contents){ var ce = clone.getElementsByTagName('*'), te = this.getElementsByTagName('*'); for (var i = ce.length; i--;) clean(ce[i], te[i]); } clean(clone, this); return document.id(clone); }, destroy: function(){ Element.empty(this); Element.dispose(this); clean(this, true); return null; }, empty: function(){ $A(this.childNodes).each(function(node){ Element.destroy(node); }); return this; }, dispose: function(){ return (this.parentNode) ? this.parentNode.removeChild(this) : this; }, hasChild: function(el){ el = document.id(el, true); if (!el) return false; if (Browser.Engine.webkit && Browser.Engine.version < 420) return $A(this.getElementsByTagName(el.tagName)).contains(el); return (this.contains) ? (this != el && this.contains(el)) : !!(this.compareDocumentPosition(el) & 16); }, match: function(tag){ return (!tag || (tag == this) || (Element.get(this, 'tag') == tag)); } }); Native.implement([Element, Window, Document], { addListener: function(type, fn){ if (type == 'unload'){ var old = fn, self = this; fn = function(){ self.removeListener('unload', fn); old(); }; } else { collected[this.uid] = this; } if (this.addEventListener) this.addEventListener(type, fn, false); else this.attachEvent('on' + type, fn); return this; }, removeListener: function(type, fn){ if (this.removeEventListener) this.removeEventListener(type, fn, false); else this.detachEvent('on' + type, fn); return this; }, retrieve: function(property, dflt){ var storage = get(this.uid), prop = storage[property]; if (dflt != undefined && prop == undefined) prop = storage[property] = dflt; return $pick(prop); }, store: function(property, value){ var storage = get(this.uid); storage[property] = value; return this; }, eliminate: function(property){ var storage = get(this.uid); delete storage[property]; return this; } }); window.addListener('unload', purge); })(); Element.Properties = new Hash; Element.Properties.style = { set: function(style){ this.style.cssText = style; }, get: function(){ return this.style.cssText; }, erase: function(){ this.style.cssText = ''; } }; Element.Properties.tag = { get: function(){ return this.tagName.toLowerCase(); } }; Element.Properties.html = (function(){ var wrapper = document.createElement('div'); var translations = { table: [1, '<table>', '</table>'], select: [1, '<select>', '</select>'], tbody: [2, '<table><tbody>', '</tbody></table>'], tr: [3, '<table><tbody><tr>', '</tr></tbody></table>'] }; translations.thead = translations.tfoot = translations.tbody; var html = { set: function(){ var html = Array.flatten(arguments).join(''); var wrap = Browser.Engine.trident && translations[this.get('tag')]; if (wrap){ var first = wrapper; first.innerHTML = wrap[1] + html + wrap[2]; for (var i = wrap[0]; i--;) first = first.firstChild; this.empty().adopt(first.childNodes); } else { this.innerHTML = html; } } }; html.erase = html.set; return html; })(); if (Browser.Engine.webkit && Browser.Engine.version < 420) Element.Properties.text = { get: function(){ if (this.innerText) return this.innerText; var temp = this.ownerDocument.newElement('div', {html: this.innerHTML}).inject(this.ownerDocument.body); var text = temp.innerText; temp.destroy(); return text; } }; /* --- script: Element.Event.js description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events. license: MIT-style license. requires: - /Element - /Event provides: [Element.Event] ... */ Element.Properties.events = {set: function(events){ this.addEvents(events); }}; Native.implement([Element, Window, Document], { addEvent: function(type, fn){ var events = this.retrieve('events', {}); events[type] = events[type] || {'keys': [], 'values': []}; if (events[type].keys.contains(fn)) return this; events[type].keys.push(fn); var realType = type, custom = Element.Events.get(type), condition = fn, self = this; if (custom){ if (custom.onAdd) custom.onAdd.call(this, fn); if (custom.condition){ condition = function(event){ if (custom.condition.call(this, event)) return fn.call(this, event); return true; }; } realType = custom.base || realType; } var defn = function(){ return fn.call(self); }; var nativeEvent = Element.NativeEvents[realType]; if (nativeEvent){ if (nativeEvent == 2){ defn = function(event){ event = new Event(event, self.getWindow()); if (condition.call(self, event) === false) event.stop(); }; } this.addListener(realType, defn); } events[type].values.push(defn); return this; }, removeEvent: function(type, fn){ var events = this.retrieve('events'); if (!events || !events[type]) return this; var pos = events[type].keys.indexOf(fn); if (pos == -1) return this; events[type].keys.splice(pos, 1); var value = events[type].values.splice(pos, 1)[0]; var custom = Element.Events.get(type); if (custom){ if (custom.onRemove) custom.onRemove.call(this, fn); type = custom.base || type; } return (Element.NativeEvents[type]) ? this.removeListener(type, value) : this; }, addEvents: function(events){ for (var event in events) this.addEvent(event, events[event]); return this; }, removeEvents: function(events){ var type; if ($type(events) == 'object'){ for (type in events) this.removeEvent(type, events[type]); return this; } var attached = this.retrieve('events'); if (!attached) return this; if (!events){ for (type in attached) this.removeEvents(type); this.eliminate('events'); } else if (attached[events]){ while (attached[events].keys[0]) this.removeEvent(events, attached[events].keys[0]); attached[events] = null; } return this; }, fireEvent: function(type, args, delay){ var events = this.retrieve('events'); if (!events || !events[type]) return this; events[type].keys.each(function(fn){ fn.create({'bind': this, 'delay': delay, 'arguments': args})(); }, this); return this; }, cloneEvents: function(from, type){ from = document.id(from); var fevents = from.retrieve('events'); if (!fevents) return this; if (!type){ for (var evType in fevents) this.cloneEvents(from, evType); } else if (fevents[type]){ fevents[type].keys.each(function(fn){ this.addEvent(type, fn); }, this); } return this; } }); Element.NativeEvents = { click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons mousewheel: 2, DOMMouseScroll: 2, //mouse wheel mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement keydown: 2, keypress: 2, keyup: 2, //keyboard focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, //form elements load: 1, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window error: 1, abort: 1, scroll: 1 //misc }; (function(){ var $check = function(event){ var related = event.relatedTarget; if (related == undefined) return true; if (related === false) return false; return ($type(this) != 'document' && related != this && related.prefix != 'xul' && !this.hasChild(related)); }; Element.Events = new Hash({ mouseenter: { base: 'mouseover', condition: $check }, mouseleave: { base: 'mouseout', condition: $check }, mousewheel: { base: (Browser.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel' } }); })(); /* --- script: Element.Style.js description: Contains methods for interacting with the styles of Elements in a fashionable way. license: MIT-style license. requires: - /Element provides: [Element.Style] ... */ Element.Properties.styles = {set: function(styles){ this.setStyles(styles); }}; Element.Properties.opacity = { set: function(opacity, novisibility){ if (!novisibility){ if (opacity == 0){ if (this.style.visibility != 'hidden') this.style.visibility = 'hidden'; } else { if (this.style.visibility != 'visible') this.style.visibility = 'visible'; } } if (!this.currentStyle || !this.currentStyle.hasLayout) this.style.zoom = 1; if (Browser.Engine.trident) this.style.filter = (opacity == 1) ? '' : 'alpha(opacity=' + opacity * 100 + ')'; this.style.opacity = opacity; this.store('opacity', opacity); }, get: function(){ return this.retrieve('opacity', 1); } }; Element.implement({ setOpacity: function(value){ return this.set('opacity', value, true); }, getOpacity: function(){ return this.get('opacity'); }, setStyle: function(property, value){ switch (property){ case 'opacity': return this.set('opacity', parseFloat(value)); case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat'; } property = property.camelCase(); if ($type(value) != 'string'){ var map = (Element.Styles.get(property) || '@').split(' '); value = $splat(value).map(function(val, i){ if (!map[i]) return ''; return ($type(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; }).join(' '); } else if (value == String(Number(value))){ value = Math.round(value); } this.style[property] = value; return this; }, getStyle: function(property){ switch (property){ case 'opacity': return this.get('opacity'); case 'float': property = (Browser.Engine.trident) ? 'styleFloat' : 'cssFloat'; } property = property.camelCase(); var result = this.style[property]; if (!$chk(result)){ result = []; for (var style in Element.ShortStyles){ if (property != style) continue; for (var s in Element.ShortStyles[style]) result.push(this.getStyle(s)); return result.join(' '); } result = this.getComputedStyle(property); } if (result){ result = String(result); var color = result.match(/rgba?\([\d\s,]+\)/); if (color) result = result.replace(color[0], color[0].rgbToHex()); } if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(result, 10)))){ if (property.test(/^(height|width)$/)){ var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; values.each(function(value){ size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); }, this); return this['offset' + property.capitalize()] - size + 'px'; } if ((Browser.Engine.presto) && String(result).test('px')) return result; if (property.test(/(border(.+)Width|margin|padding)/)) return '0px'; } return result; }, setStyles: function(styles){ for (var style in styles) this.setStyle(style, styles[style]); return this; }, getStyles: function(){ var result = {}; Array.flatten(arguments).each(function(key){ result[key] = this.getStyle(key); }, this); return result; } }); Element.Styles = new Hash({ left: '@px', top: '@px', bottom: '@px', right: '@px', width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', backgroundColor: 'rgb(@, @, @)', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' }); Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; ['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ var Short = Element.ShortStyles; var All = Element.Styles; ['margin', 'padding'].each(function(style){ var sd = style + direction; Short[style][sd] = All[sd] = '@px'; }); var bd = 'border' + direction; Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; Short[bd] = {}; Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; }); /* --- script: Element.Dimensions.js description: Contains methods to work with size, scroll, or positioning of Elements and the window object. license: MIT-style license. credits: - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). requires: - /Element provides: [Element.Dimensions] ... */ (function(){ Element.implement({ scrollTo: function(x, y){ if (isBody(this)){ this.getWindow().scrollTo(x, y); } else { this.scrollLeft = x; this.scrollTop = y; } return this; }, getSize: function(){ if (isBody(this)) return this.getWindow().getSize(); return {x: this.offsetWidth, y: this.offsetHeight}; }, getScrollSize: function(){ if (isBody(this)) return this.getWindow().getScrollSize(); return {x: this.scrollWidth, y: this.scrollHeight}; }, getScroll: function(){ if (isBody(this)) return this.getWindow().getScroll(); return {x: this.scrollLeft, y: this.scrollTop}; }, getScrolls: function(){ var element = this, position = {x: 0, y: 0}; while (element && !isBody(element)){ position.x += element.scrollLeft; position.y += element.scrollTop; element = element.parentNode; } return position; }, getOffsetParent: function(){ var element = this; if (isBody(element)) return null; if (!Browser.Engine.trident) return element.offsetParent; while ((element = element.parentNode) && !isBody(element)){ if (styleString(element, 'position') != 'static') return element; } return null; }, getOffsets: function(){ if (this.getBoundingClientRect){ var bound = this.getBoundingClientRect(), html = document.id(this.getDocument().documentElement), htmlScroll = html.getScroll(), elemScrolls = this.getScrolls(), elemScroll = this.getScroll(), isFixed = (styleString(this, 'position') == 'fixed'); return { x: bound.left.toInt() + elemScrolls.x - elemScroll.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, y: bound.top.toInt() + elemScrolls.y - elemScroll.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop }; } var element = this, position = {x: 0, y: 0}; if (isBody(this)) return position; while (element && !isBody(element)){ position.x += element.offsetLeft; position.y += element.offsetTop; if (Browser.Engine.gecko){ if (!borderBox(element)){ position.x += leftBorder(element); position.y += topBorder(element); } var parent = element.parentNode; if (parent && styleString(parent, 'overflow') != 'visible'){ position.x += leftBorder(parent); position.y += topBorder(parent); } } else if (element != this && Browser.Engine.webkit){ position.x += leftBorder(element); position.y += topBorder(element); } element = element.offsetParent; } if (Browser.Engine.gecko && !borderBox(this)){ position.x -= leftBorder(this); position.y -= topBorder(this); } return position; }, getPosition: function(relative){ if (isBody(this)) return {x: 0, y: 0}; var offset = this.getOffsets(), scroll = this.getScrolls(); var position = { x: offset.x - scroll.x, y: offset.y - scroll.y }; var relativePosition = (relative && (relative = document.id(relative))) ? relative.getPosition() : {x: 0, y: 0}; return {x: position.x - relativePosition.x, y: position.y - relativePosition.y}; }, getCoordinates: function(element){ if (isBody(this)) return this.getWindow().getCoordinates(); var position = this.getPosition(element), size = this.getSize(); var obj = { left: position.x, top: position.y, width: size.x, height: size.y }; obj.right = obj.left + obj.width; obj.bottom = obj.top + obj.height; return obj; }, computePosition: function(obj){ return { left: obj.x - styleNumber(this, 'margin-left'), top: obj.y - styleNumber(this, 'margin-top') }; }, setPosition: function(obj){ return this.setStyles(this.computePosition(obj)); } }); Native.implement([Document, Window], { getSize: function(){ if (Browser.Engine.presto || Browser.Engine.webkit){ var win = this.getWindow(); return {x: win.innerWidth, y: win.innerHeight}; } var doc = getCompatElement(this); return {x: doc.clientWidth, y: doc.clientHeight}; }, getScroll: function(){ var win = this.getWindow(), doc = getCompatElement(this); return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; }, getScrollSize: function(){ var doc = getCompatElement(this), min = this.getSize(); return {x: Math.max(doc.scrollWidth, min.x), y: Math.max(doc.scrollHeight, min.y)}; }, getPosition: function(){ return {x: 0, y: 0}; }, getCoordinates: function(){ var size = this.getSize(); return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; } }); // private methods var styleString = Element.getComputedStyle; function styleNumber(element, style){ return styleString(element, style).toInt() || 0; }; function borderBox(element){ return styleString(element, '-moz-box-sizing') == 'border-box'; }; function topBorder(element){ return styleNumber(element, 'border-top-width'); }; function leftBorder(element){ return styleNumber(element, 'border-left-width'); }; function isBody(element){ return (/^(?:body|html)$/i).test(element.tagName); }; function getCompatElement(element){ var doc = element.getDocument(); return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; }; })(); //aliases Element.alias('setPosition', 'position'); //compatability Native.implement([Window, Document, Element], { getHeight: function(){ return this.getSize().y; }, getWidth: function(){ return this.getSize().x; }, getScrollTop: function(){ return this.getScroll().y; }, getScrollLeft: function(){ return this.getScroll().x; }, getScrollHeight: function(){ return this.getScrollSize().y; }, getScrollWidth: function(){ return this.getScrollSize().x; }, getTop: function(){ return this.getPosition().y; }, getLeft: function(){ return this.getPosition().x; } }); /* --- script: Selectors.js description: Adds advanced CSS-style querying capabilities for targeting HTML Elements. Includes pseudo selectors. license: MIT-style license. requires: - /Element provides: [Selectors] ... */ Native.implement([Document, Element], { getElements: function(expression, nocash){ expression = expression.split(','); var items, local = {}; for (var i = 0, l = expression.length; i < l; i++){ var selector = expression[i], elements = Selectors.Utils.search(this, selector, local); if (i != 0 && elements.item) elements = $A(elements); items = (i == 0) ? elements : (items.item) ? $A(items).concat(elements) : items.concat(elements); } return new Elements(items, {ddup: (expression.length > 1), cash: !nocash}); } }); Element.implement({ match: function(selector){ if (!selector || (selector == this)) return true; var tagid = Selectors.Utils.parseTagAndID(selector); var tag = tagid[0], id = tagid[1]; if (!Selectors.Filters.byID(this, id) || !Selectors.Filters.byTag(this, tag)) return false; var parsed = Selectors.Utils.parseSelector(selector); return (parsed) ? Selectors.Utils.filter(this, parsed, {}) : true; } }); var Selectors = {Cache: {nth: {}, parsed: {}}}; Selectors.RegExps = { id: (/#([\w-]+)/), tag: (/^(\w+|\*)/), quick: (/^(\w+|\*)$/), splitter: (/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g), combined: (/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g) }; Selectors.Utils = { chk: function(item, uniques){ if (!uniques) return true; var uid = $uid(item); if (!uniques[uid]) return uniques[uid] = true; return false; }, parseNthArgument: function(argument){ if (Selectors.Cache.nth[argument]) return Selectors.Cache.nth[argument]; var parsed = argument.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/); if (!parsed) return false; var inta = parseInt(parsed[1], 10); var a = (inta || inta === 0) ? inta : 1; var special = parsed[2] || false; var b = parseInt(parsed[3], 10) || 0; if (a != 0){ b--; while (b < 1) b += a; while (b >= a) b -= a; } else { a = b; special = 'index'; } switch (special){ case 'n': parsed = {a: a, b: b, special: 'n'}; break; case 'odd': parsed = {a: 2, b: 0, special: 'n'}; break; case 'even': parsed = {a: 2, b: 1, special: 'n'}; break; case 'first': parsed = {a: 0, special: 'index'}; break; case 'last': parsed = {special: 'last-child'}; break; case 'only': parsed = {special: 'only-child'}; break; default: parsed = {a: (a - 1), special: 'index'}; } return Selectors.Cache.nth[argument] = parsed; }, parseSelector: function(selector){ if (Selectors.Cache.parsed[selector]) return Selectors.Cache.parsed[selector]; var m, parsed = {classes: [], pseudos: [], attributes: []}; while ((m = Selectors.RegExps.combined.exec(selector))){ var cn = m[1], an = m[2], ao = m[3], av = m[5], pn = m[6], pa = m[7]; if (cn){ parsed.classes.push(cn); } else if (pn){ var parser = Selectors.Pseudo.get(pn); if (parser) parsed.pseudos.push({parser: parser, argument: pa}); else parsed.attributes.push({name: pn, operator: '=', value: pa}); } else if (an){ parsed.attributes.push({name: an, operator: ao, value: av}); } } if (!parsed.classes.length) delete parsed.classes; if (!parsed.attributes.length) delete parsed.attributes; if (!parsed.pseudos.length) delete parsed.pseudos; if (!parsed.classes && !parsed.attributes && !parsed.pseudos) parsed = null; return Selectors.Cache.parsed[selector] = parsed; }, parseTagAndID: function(selector){ var tag = selector.match(Selectors.RegExps.tag); var id = selector.match(Selectors.RegExps.id); return [(tag) ? tag[1] : '*', (id) ? id[1] : false]; }, filter: function(item, parsed, local){ var i; if (parsed.classes){ for (i = parsed.classes.length; i--; i){ var cn = parsed.classes[i]; if (!Selectors.Filters.byClass(item, cn)) return false; } } if (parsed.attributes){ for (i = parsed.attributes.length; i--; i){ var att = parsed.attributes[i]; if (!Selectors.Filters.byAttribute(item, att.name, att.operator, att.value)) return false; } } if (parsed.pseudos){ for (i = parsed.pseudos.length; i--; i){ var psd = parsed.pseudos[i]; if (!Selectors.Filters.byPseudo(item, psd.parser, psd.argument, local)) return false; } } return true; }, getByTagAndID: function(ctx, tag, id){ if (id){ var item = (ctx.getElementById) ? ctx.getElementById(id, true) : Element.getElementById(ctx, id, true); return (item && Selectors.Filters.byTag(item, tag)) ? [item] : []; } else { return ctx.getElementsByTagName(tag); } }, search: function(self, expression, local){ var splitters = []; var selectors = expression.trim().replace(Selectors.RegExps.splitter, function(m0, m1, m2){ splitters.push(m1); return ':)' + m2; }).split(':)'); var items, filtered, item; for (var i = 0, l = selectors.length; i < l; i++){ var selector = selectors[i]; if (i == 0 && Selectors.RegExps.quick.test(selector)){ items = self.getElementsByTagName(selector); continue; } var splitter = splitters[i - 1]; var tagid = Selectors.Utils.parseTagAndID(selector); var tag = tagid[0], id = tagid[1]; if (i == 0){ items = Selectors.Utils.getByTagAndID(self, tag, id); } else { var uniques = {}, found = []; for (var j = 0, k = items.length; j < k; j++) found = Selectors.Getters[splitter](found, items[j], tag, id, uniques); items = found; } var parsed = Selectors.Utils.parseSelector(selector); if (parsed){ filtered = []; for (var m = 0, n = items.length; m < n; m++){ item = items[m]; if (Selectors.Utils.filter(item, parsed, local)) filtered.push(item); } items = filtered; } } return items; } }; Selectors.Getters = { ' ': function(found, self, tag, id, uniques){ var items = Selectors.Utils.getByTagAndID(self, tag, id); for (var i = 0, l = items.length; i < l; i++){ var item = items[i]; if (Selectors.Utils.chk(item, uniques)) found.push(item); } return found; }, '>': function(found, self, tag, id, uniques){ var children = Selectors.Utils.getByTagAndID(self, tag, id); for (var i = 0, l = children.length; i < l; i++){ var child = children[i]; if (child.parentNode == self && Selectors.Utils.chk(child, uniques)) found.push(child); } return found; }, '+': function(found, self, tag, id, uniques){ while ((self = self.nextSibling)){ if (self.nodeType == 1){ if (Selectors.Utils.chk(self, uniques) && Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self); break; } } return found; }, '~': function(found, self, tag, id, uniques){ while ((self = self.nextSibling)){ if (self.nodeType == 1){ if (!Selectors.Utils.chk(self, uniques)) break; if (Selectors.Filters.byTag(self, tag) && Selectors.Filters.byID(self, id)) found.push(self); } } return found; } }; Selectors.Filters = { byTag: function(self, tag){ return (tag == '*' || (self.tagName && self.tagName.toLowerCase() == tag)); }, byID: function(self, id){ return (!id || (self.id && self.id == id)); }, byClass: function(self, klass){ return (self.className && self.className.contains && self.className.contains(klass, ' ')); }, byPseudo: function(self, parser, argument, local){ return parser.call(self, argument, local); }, byAttribute: function(self, name, operator, value){ var result = Element.prototype.getProperty.call(self, name); if (!result) return (operator == '!='); if (!operator || value == undefined) return true; switch (operator){ case '=': return (result == value); case '*=': return (result.contains(value)); case '^=': return (result.substr(0, value.length) == value); case '$=': return (result.substr(result.length - value.length) == value); case '!=': return (result != value); case '~=': return result.contains(value, ' '); case '|=': return result.contains(value, '-'); } return false; } }; Selectors.Pseudo = new Hash({ // w3c pseudo selectors checked: function(){ return this.checked; }, empty: function(){ return !(this.innerText || this.textContent || '').length; }, not: function(selector){ return !Element.match(this, selector); }, contains: function(text){ return (this.innerText || this.textContent || '').contains(text); }, 'first-child': function(){ return Selectors.Pseudo.index.call(this, 0); }, 'last-child': function(){ var element = this; while ((element = element.nextSibling)){ if (element.nodeType == 1) return false; } return true; }, 'only-child': function(){ var prev = this; while ((prev = prev.previousSibling)){ if (prev.nodeType == 1) return false; } var next = this; while ((next = next.nextSibling)){ if (next.nodeType == 1) return false; } return true; }, 'nth-child': function(argument, local){ argument = (argument == undefined) ? 'n' : argument; var parsed = Selectors.Utils.parseNthArgument(argument); if (parsed.special != 'n') return Selectors.Pseudo[parsed.special].call(this, parsed.a, local); var count = 0; local.positions = local.positions || {}; var uid = $uid(this); if (!local.positions[uid]){ var self = this; while ((self = self.previousSibling)){ if (self.nodeType != 1) continue; count ++; var position = local.positions[$uid(self)]; if (position != undefined){ count = position + count; break; } } local.positions[uid] = count; } return (local.positions[uid] % parsed.a == parsed.b); }, // custom pseudo selectors index: function(index){ var element = this, count = 0; while ((element = element.previousSibling)){ if (element.nodeType == 1 && ++count > index) return false; } return (count == index); }, even: function(argument, local){ return Selectors.Pseudo['nth-child'].call(this, '2n+1', local); }, odd: function(argument, local){ return Selectors.Pseudo['nth-child'].call(this, '2n', local); }, selected: function(){ return this.selected; }, enabled: function(){ return (this.disabled === false); } }); /* --- script: DomReady.js description: Contains the custom event domready. license: MIT-style license. requires: - /Element.Event provides: [DomReady] ... */ Element.Events.domready = { onAdd: function(fn){ if (Browser.loaded) fn.call(this); } }; (function(){ var domready = function(){ if (Browser.loaded) return; Browser.loaded = true; window.fireEvent('domready'); document.fireEvent('domready'); }; window.addEvent('load', domready); if (Browser.Engine.trident){ var temp = document.createElement('div'); (function(){ ($try(function(){ temp.doScroll(); // Technique by Diego Perini return document.id(temp).inject(document.body).set('html', 'temp').dispose(); })) ? domready() : arguments.callee.delay(50); })(); } else if (Browser.Engine.webkit && Browser.Engine.version < 525){ (function(){ (['loaded', 'complete'].contains(document.readyState)) ? domready() : arguments.callee.delay(50); })(); } else { document.addEvent('DOMContentLoaded', domready); } })(); /* --- script: JSON.js description: JSON encoder and decoder. license: MIT-style license. See Also: <http://www.json.org/> requires: - /Array - /String - /Number - /Function - /Hash provides: [JSON] ... */ var JSON = new Hash(this.JSON && { stringify: JSON.stringify, parse: JSON.parse }).extend({ $specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}, $replaceChars: function(chr){ return JSON.$specialChars[chr] || '\\u00' + Math.floor(chr.charCodeAt() / 16).toString(16) + (chr.charCodeAt() % 16).toString(16); }, encode: function(obj){ switch ($type(obj)){ case 'string': return '"' + obj.replace(/[\x00-\x1f\\"]/g, JSON.$replaceChars) + '"'; case 'array': return '[' + String(obj.map(JSON.encode).clean()) + ']'; case 'object': case 'hash': var string = []; Hash.each(obj, function(value, key){ var json = JSON.encode(value); if (json) string.push(JSON.encode(key) + ':' + json); }); return '{' + string + '}'; case 'number': case 'boolean': return String(obj); case false: return 'null'; } return null; }, decode: function(string, secure){ if ($type(string) != 'string' || !string.length) return null; if (secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null; return eval('(' + string + ')'); } }); Native.implement([Hash, Array, String, Number], { toJSON: function(){ return JSON.encode(this); } }); /* --- script: Cookie.js description: Class for creating, reading, and deleting browser Cookies. license: MIT-style license. credits: - Based on the functions by Peter-Paul Koch (http://quirksmode.org). requires: - /Options provides: [Cookie] ... */ var Cookie = new Class({ Implements: Options, options: { path: false, domain: false, duration: false, secure: false, document: document }, initialize: function(key, options){ this.key = key; this.setOptions(options); }, write: function(value){ value = encodeURIComponent(value); if (this.options.domain) value += '; domain=' + this.options.domain; if (this.options.path) value += '; path=' + this.options.path; if (this.options.duration){ var date = new Date(); date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); value += '; expires=' + date.toGMTString(); } if (this.options.secure) value += '; secure'; this.options.document.cookie = this.key + '=' + value; return this; }, read: function(){ var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); return (value) ? decodeURIComponent(value[1]) : null; }, dispose: function(){ new Cookie(this.key, $merge(this.options, {duration: -1})).write(''); return this; } }); Cookie.write = function(key, value, options){ return new Cookie(key, options).write(value); }; Cookie.read = function(key){ return new Cookie(key).read(); }; Cookie.dispose = function(key, options){ return new Cookie(key, options).dispose(); }; /* --- script: Swiff.js description: Wrapper for embedding SWF movies. Supports External Interface Communication. license: MIT-style license. credits: - Flash detection & Internet Explorer + Flash Player 9 fix inspired by SWFObject. requires: - /Options - /$util provides: [Swiff] ... */ var Swiff = new Class({ Implements: [Options], options: { id: null, height: 1, width: 1, container: null, properties: {}, params: { quality: 'high', allowScriptAccess: 'always', wMode: 'transparent', swLiveConnect: true }, callBacks: {}, vars: {} }, toElement: function(){ return this.object; }, initialize: function(path, options){ this.instance = 'Swiff_' + $time(); this.setOptions(options); options = this.options; var id = this.id = options.id || this.instance; var container = document.id(options.container); Swiff.CallBacks[this.instance] = {}; var params = options.params, vars = options.vars, callBacks = options.callBacks; var properties = $extend({height: options.height, width: options.width}, options.properties); var self = this; for (var callBack in callBacks){ Swiff.CallBacks[this.instance][callBack] = (function(option){ return function(){ return option.apply(self.object, arguments); }; })(callBacks[callBack]); vars[callBack] = 'Swiff.CallBacks.' + this.instance + '.' + callBack; } params.flashVars = Hash.toQueryString(vars); if (Browser.Engine.trident){ properties.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; params.movie = path; } else { properties.type = 'application/x-shockwave-flash'; properties.data = path; } var build = '<object id="' + id + '"'; for (var property in properties) build += ' ' + property + '="' + properties[property] + '"'; build += '>'; for (var param in params){ if (params[param]) build += '<param name="' + param + '" value="' + params[param] + '" />'; } build += '</object>'; this.object = ((container) ? container.empty() : new Element('div')).set('html', build).firstChild; }, replaces: function(element){ element = document.id(element, true); element.parentNode.replaceChild(this.toElement(), element); return this; }, inject: function(element){ document.id(element, true).appendChild(this.toElement()); return this; }, remote: function(){ return Swiff.remote.apply(Swiff, [this.toElement()].extend(arguments)); } }); Swiff.CallBacks = {}; Swiff.remote = function(obj, fn){ var rs = obj.CallFunction('<invoke name="' + fn + '" returntype="javascript">' + __flash__argumentsToXML(arguments, 2) + '</invoke>'); return eval(rs); }; /* --- script: Fx.js description: Contains the basic animation logic to be extended by all other Fx Classes. license: MIT-style license. requires: - /Chain - /Events - /Options provides: [Fx] ... */ var Fx = new Class({ Implements: [Chain, Events, Options], options: { /* onStart: $empty, onCancel: $empty, onComplete: $empty, */ fps: 50, unit: false, duration: 500, link: 'ignore' }, initialize: function(options){ this.subject = this.subject || this; this.setOptions(options); this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt(); var wait = this.options.wait; if (wait === false) this.options.link = 'cancel'; }, getTransition: function(){ return function(p){ return -(Math.cos(Math.PI * p) - 1) / 2; }; }, step: function(){ var time = $time(); if (time < this.time + this.options.duration){ var delta = this.transition((time - this.time) / this.options.duration); this.set(this.compute(this.from, this.to, delta)); } else { this.set(this.compute(this.from, this.to, 1)); this.complete(); } }, set: function(now){ return now; }, compute: function(from, to, delta){ return Fx.compute(from, to, delta); }, check: function(){ if (!this.timer) return true; switch (this.options.link){ case 'cancel': this.cancel(); return true; case 'chain': this.chain(this.caller.bind(this, arguments)); return false; } return false; }, start: function(from, to){ if (!this.check(from, to)) return this; this.from = from; this.to = to; this.time = 0; this.transition = this.getTransition(); this.startTimer(); this.onStart(); return this; }, complete: function(){ if (this.stopTimer()) this.onComplete(); return this; }, cancel: function(){ if (this.stopTimer()) this.onCancel(); return this; }, onStart: function(){ this.fireEvent('start', this.subject); }, onComplete: function(){ this.fireEvent('complete', this.subject); if (!this.callChain()) this.fireEvent('chainComplete', this.subject); }, onCancel: function(){ this.fireEvent('cancel', this.subject).clearChain(); }, pause: function(){ this.stopTimer(); return this; }, resume: function(){ this.startTimer(); return this; }, stopTimer: function(){ if (!this.timer) return false; this.time = $time() - this.time; this.timer = $clear(this.timer); return true; }, startTimer: function(){ if (this.timer) return false; this.time = $time() - this.time; this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this); return true; } }); Fx.compute = function(from, to, delta){ return (to - from) * delta + from; }; Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; /* --- script: Fx.CSS.js description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. license: MIT-style license. requires: - /Fx - /Element.Style provides: [Fx.CSS] ... */ Fx.CSS = new Class({ Extends: Fx, //prepares the base from/to object prepare: function(element, property, values){ values = $splat(values); var values1 = values[1]; if (!$chk(values1)){ values[1] = values[0]; values[0] = element.getStyle(property); } var parsed = values.map(this.parse); return {from: parsed[0], to: parsed[1]}; }, //parses a value into an array parse: function(value){ value = $lambda(value)(); value = (typeof value == 'string') ? value.split(' ') : $splat(value); return value.map(function(val){ val = String(val); var found = false; Fx.CSS.Parsers.each(function(parser, key){ if (found) return; var parsed = parser.parse(val); if ($chk(parsed)) found = {value: parsed, parser: parser}; }); found = found || {value: val, parser: Fx.CSS.Parsers.String}; return found; }); }, //computes by a from and to prepared objects, using their parsers. compute: function(from, to, delta){ var computed = []; (Math.min(from.length, to.length)).times(function(i){ computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); }); computed.$family = {name: 'fx:css:value'}; return computed; }, //serves the value as settable serve: function(value, unit){ if ($type(value) != 'fx:css:value') value = this.parse(value); var returned = []; value.each(function(bit){ returned = returned.concat(bit.parser.serve(bit.value, unit)); }); return returned; }, //renders the change to an element render: function(element, property, value, unit){ element.setStyle(property, this.serve(value, unit)); }, //searches inside the page css to find the values for a selector search: function(selector){ if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; var to = {}; Array.each(document.styleSheets, function(sheet, j){ var href = sheet.href; if (href && href.contains('://') && !href.contains(document.domain)) return; var rules = sheet.rules || sheet.cssRules; Array.each(rules, function(rule, i){ if (!rule.style) return; var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ return m.toLowerCase(); }) : null; if (!selectorText || !selectorText.test('^' + selector + '$')) return; Element.Styles.each(function(value, style){ if (!rule.style[style] || Element.ShortStyles[style]) return; value = String(rule.style[style]); to[style] = (value.test(/^rgb/)) ? value.rgbToHex() : value; }); }); }); return Fx.CSS.Cache[selector] = to; } }); Fx.CSS.Cache = {}; Fx.CSS.Parsers = new Hash({ Color: { parse: function(value){ if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; }, compute: function(from, to, delta){ return from.map(function(value, i){ return Math.round(Fx.compute(from[i], to[i], delta)); }); }, serve: function(value){ return value.map(Number); } }, Number: { parse: parseFloat, compute: Fx.compute, serve: function(value, unit){ return (unit) ? value + unit : value; } }, String: { parse: $lambda(false), compute: $arguments(1), serve: $arguments(0) } }); /* --- script: Fx.Tween.js description: Formerly Fx.Style, effect to transition any CSS property for an element. license: MIT-style license. requires: - /Fx.CSS provides: [Fx.Tween, Element.fade, Element.highlight] ... */ Fx.Tween = new Class({ Extends: Fx.CSS, initialize: function(element, options){ this.element = this.subject = document.id(element); this.parent(options); }, set: function(property, now){ if (arguments.length == 1){ now = property; property = this.property || this.options.property; } this.render(this.element, property, now, this.options.unit); return this; }, start: function(property, from, to){ if (!this.check(property, from, to)) return this; var args = Array.flatten(arguments); this.property = this.options.property || args.shift(); var parsed = this.prepare(this.element, this.property, args); return this.parent(parsed.from, parsed.to); } }); Element.Properties.tween = { set: function(options){ var tween = this.retrieve('tween'); if (tween) tween.cancel(); return this.eliminate('tween').store('tween:options', $extend({link: 'cancel'}, options)); }, get: function(options){ if (options || !this.retrieve('tween')){ if (options || !this.retrieve('tween:options')) this.set('tween', options); this.store('tween', new Fx.Tween(this, this.retrieve('tween:options'))); } return this.retrieve('tween'); } }; Element.implement({ tween: function(property, from, to){ this.get('tween').start(arguments); return this; }, fade: function(how){ var fade = this.get('tween'), o = 'opacity', toggle; how = $pick(how, 'toggle'); switch (how){ case 'in': fade.start(o, 1); break; case 'out': fade.start(o, 0); break; case 'show': fade.set(o, 1); break; case 'hide': fade.set(o, 0); break; case 'toggle': var flag = this.retrieve('fade:flag', this.get('opacity') == 1); fade.start(o, (flag) ? 0 : 1); this.store('fade:flag', !flag); toggle = true; break; default: fade.start(o, arguments); } if (!toggle) this.eliminate('fade:flag'); return this; }, highlight: function(start, end){ if (!end){ end = this.retrieve('highlight:original', this.getStyle('background-color')); end = (end == 'transparent') ? '#fff' : end; } var tween = this.get('tween'); tween.start('background-color', start || '#ffff88', end).chain(function(){ this.setStyle('background-color', this.retrieve('highlight:original')); tween.callChain(); }.bind(this)); return this; } }); /* --- script: Fx.Morph.js description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. license: MIT-style license. requires: - /Fx.CSS provides: [Fx.Morph] ... */ Fx.Morph = new Class({ Extends: Fx.CSS, initialize: function(element, options){ this.element = this.subject = document.id(element); this.parent(options); }, set: function(now){ if (typeof now == 'string') now = this.search(now); for (var p in now) this.render(this.element, p, now[p], this.options.unit); return this; }, compute: function(from, to, delta){ var now = {}; for (var p in from) now[p] = this.parent(from[p], to[p], delta); return now; }, start: function(properties){ if (!this.check(properties)) return this; if (typeof properties == 'string') properties = this.search(properties); var from = {}, to = {}; for (var p in properties){ var parsed = this.prepare(this.element, p, properties[p]); from[p] = parsed.from; to[p] = parsed.to; } return this.parent(from, to); } }); Element.Properties.morph = { set: function(options){ var morph = this.retrieve('morph'); if (morph) morph.cancel(); return this.eliminate('morph').store('morph:options', $extend({link: 'cancel'}, options)); }, get: function(options){ if (options || !this.retrieve('morph')){ if (options || !this.retrieve('morph:options')) this.set('morph', options); this.store('morph', new Fx.Morph(this, this.retrieve('morph:options'))); } return this.retrieve('morph'); } }; Element.implement({ morph: function(props){ this.get('morph').start(props); return this; } }); /* --- script: Fx.Transitions.js description: Contains a set of advanced transitions to be used with any of the Fx Classes. license: MIT-style license. credits: - Easing Equations by Robert Penner, <http://www.robertpenner.com/easing/>, modified and optimized to be used with MooTools. requires: - /Fx provides: [Fx.Transitions] ... */ Fx.implement({ getTransition: function(){ var trans = this.options.transition || Fx.Transitions.Sine.easeInOut; if (typeof trans == 'string'){ var data = trans.split(':'); trans = Fx.Transitions; trans = trans[data[0]] || trans[data[0].capitalize()]; if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')]; } return trans; } }); Fx.Transition = function(transition, params){ params = $splat(params); return $extend(transition, { easeIn: function(pos){ return transition(pos, params); }, easeOut: function(pos){ return 1 - transition(1 - pos, params); }, easeInOut: function(pos){ return (pos <= 0.5) ? transition(2 * pos, params) / 2 : (2 - transition(2 * (1 - pos), params)) / 2; } }); }; Fx.Transitions = new Hash({ linear: $arguments(0) }); Fx.Transitions.extend = function(transitions){ for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); }; Fx.Transitions.extend({ Pow: function(p, x){ return Math.pow(p, x[0] || 6); }, Expo: function(p){ return Math.pow(2, 8 * (p - 1)); }, Circ: function(p){ return 1 - Math.sin(Math.acos(p)); }, Sine: function(p){ return 1 - Math.sin((1 - p) * Math.PI / 2); }, Back: function(p, x){ x = x[0] || 1.618; return Math.pow(p, 2) * ((x + 1) * p - x); }, Bounce: function(p){ var value; for (var a = 0, b = 1; 1; a += b, b /= 2){ if (p >= (7 - 4 * a) / 11){ value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); break; } } return value; }, Elastic: function(p, x){ return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3); } }); ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ Fx.Transitions[transition] = new Fx.Transition(function(p){ return Math.pow(p, [i + 2]); }); }); /* --- script: Request.js description: Powerful all purpose Request Class. Uses XMLHTTPRequest. license: MIT-style license. requires: - /Element - /Chain - /Events - /Options - /Browser provides: [Request] ... */ var Request = new Class({ Implements: [Chain, Events, Options], options: {/* onRequest: $empty, onComplete: $empty, onCancel: $empty, onSuccess: $empty, onFailure: $empty, onException: $empty,*/ url: '', data: '', headers: { 'X-Requested-With': 'XMLHttpRequest', 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }, async: true, format: false, method: 'post', link: 'ignore', isSuccess: null, emulation: true, urlEncoded: true, encoding: 'utf-8', evalScripts: false, evalResponse: false, noCache: false }, initialize: function(options){ this.xhr = new Browser.Request(); this.setOptions(options); this.options.isSuccess = this.options.isSuccess || this.isSuccess; this.headers = new Hash(this.options.headers); }, onStateChange: function(){ if (this.xhr.readyState != 4 || !this.running) return; this.running = false; this.status = 0; $try(function(){ this.status = this.xhr.status; }.bind(this)); this.xhr.onreadystatechange = $empty; if (this.options.isSuccess.call(this, this.status)){ this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML}; this.success(this.response.text, this.response.xml); } else { this.response = {text: null, xml: null}; this.failure(); } }, isSuccess: function(){ return ((this.status >= 200) && (this.status < 300)); }, processScripts: function(text){ if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return $exec(text); return text.stripScripts(this.options.evalScripts); }, success: function(text, xml){ this.onSuccess(this.processScripts(text), xml); }, onSuccess: function(){ this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); }, failure: function(){ this.onFailure(); }, onFailure: function(){ this.fireEvent('complete').fireEvent('failure', this.xhr); }, setHeader: function(name, value){ this.headers.set(name, value); return this; }, getHeader: function(name){ return $try(function(){ return this.xhr.getResponseHeader(name); }.bind(this)); }, check: function(){ if (!this.running) return true; switch (this.options.link){ case 'cancel': this.cancel(); return true; case 'chain': this.chain(this.caller.bind(this, arguments)); return false; } return false; }, send: function(options){ if (!this.check(options)) return this; this.running = true; var type = $type(options); if (type == 'string' || type == 'element') options = {data: options}; var old = this.options; options = $extend({data: old.data, url: old.url, method: old.method}, options); var data = options.data, url = String(options.url), method = options.method.toLowerCase(); switch ($type(data)){ case 'element': data = document.id(data).toQueryString(); break; case 'object': case 'hash': data = Hash.toQueryString(data); } if (this.options.format){ var format = 'format=' + this.options.format; data = (data) ? format + '&' + data : format; } if (this.options.emulation && !['get', 'post'].contains(method)){ var _method = '_method=' + method; data = (data) ? _method + '&' + data : _method; method = 'post'; } if (this.options.urlEncoded && method == 'post'){ var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; this.headers.set('Content-type', 'application/x-www-form-urlencoded' + encoding); } if (this.options.noCache){ var noCache = 'noCache=' + new Date().getTime(); data = (data) ? noCache + '&' + data : noCache; } var trimPosition = url.lastIndexOf('/'); if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition); if (data && method == 'get'){ url = url + (url.contains('?') ? '&' : '?') + data; data = null; } this.xhr.open(method.toUpperCase(), url, this.options.async); this.xhr.onreadystatechange = this.onStateChange.bind(this); this.headers.each(function(value, key){ try { this.xhr.setRequestHeader(key, value); } catch (e){ this.fireEvent('exception', [key, value]); } }, this); this.fireEvent('request'); this.xhr.send(data); if (!this.options.async) this.onStateChange(); return this; }, cancel: function(){ if (!this.running) return this; this.running = false; this.xhr.abort(); this.xhr.onreadystatechange = $empty; this.xhr = new Browser.Request(); this.fireEvent('cancel'); return this; } }); (function(){ var methods = {}; ['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ methods[method] = function(){ var params = Array.link(arguments, {url: String.type, data: $defined}); return this.send($extend(params, {method: method})); }; }); Request.implement(methods); })(); Element.Properties.send = { set: function(options){ var send = this.retrieve('send'); if (send) send.cancel(); return this.eliminate('send').store('send:options', $extend({ data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') }, options)); }, get: function(options){ if (options || !this.retrieve('send')){ if (options || !this.retrieve('send:options')) this.set('send', options); this.store('send', new Request(this.retrieve('send:options'))); } return this.retrieve('send'); } }; Element.implement({ send: function(url){ var sender = this.get('send'); sender.send({data: this, url: url || sender.options.url}); return this; } }); /* --- script: Request.JSON.js description: Extends the basic Request Class with additional methods for sending and receiving JSON data. license: MIT-style license. requires: - /Request JSON provides: [Request.HTML] ... */ Request.JSON = new Class({ Extends: Request, options: { secure: true }, initialize: function(options){ this.parent(options); this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'}); }, success: function(text){ this.response.json = JSON.decode(text, this.options.secure); this.onSuccess(this.response.json, text); } });
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/mootools-core.js
JavaScript
art
100,498
<?php include('../Backend/FileManager.php'); $browser = new FileManager(array( 'directory' => 'Files/', 'assetBasePath' => '../Assets', 'upload' => false, 'destroy' => false, 'filter' => 'image/', )); $browser->fireEvent(!empty($_GET['event']) ? $_GET['event'] : null);
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/selectImage.php
PHP
art
277
//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License. /* --- script: More.js description: MooTools More license: MIT-style license authors: - Guillermo Rauch - Thomas Aylott - Scott Kyle requires: - core:1.2.4/MooTools provides: [MooTools.More] ... */ MooTools.More = { 'version': '1.2.4.2dev', 'build': '%build%' }; /* --- script: Element.Delegation.js description: Extends the Element native object to include the delegate method for more efficient event management. credits: - "Event checking based on the work of Daniel Steigerwald. License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz" license: MIT-style license authors: - Aaron Newton - Daniel Steigerwald requires: - core:1.2.4/Element.Event - core:1.2.4/Selectors - /MooTools.More provides: [Element.Delegation] ... */ (function(addEvent, removeEvent){ var match = /(.*?):relay\(([^)]+)\)$/, combinators = /[+>~\s]/, splitType = function(type){ var bits = type.match(match); return !bits ? {event: type} : { event: bits[1], selector: bits[2] }; }, check = function(e, selector){ var t = e.target; if (combinators.test(selector = selector.trim())){ var els = this.getElements(selector); for (var i = els.length; i--; ){ var el = els[i]; if (t == el || el.hasChild(t)) return el; } } else { for ( ; t && t != this; t = t.parentNode){ if (Element.match(t, selector)) return document.id(t); } } return null; }; Element.implement({ addEvent: function(type, fn){ var splitted = splitType(type); if (splitted.selector){ var monitors = this.retrieve('$moo:delegateMonitors', {}); if (!monitors[type]){ var monitor = function(e){ var el = check.call(this, e, splitted.selector); if (el) this.fireEvent(type, [e, el], 0, el); }.bind(this); monitors[type] = monitor; addEvent.call(this, splitted.event, monitor); } } return addEvent.apply(this, arguments); }, removeEvent: function(type, fn){ var splitted = splitType(type); if (splitted.selector){ var events = this.retrieve('events'); if (!events || !events[type] || (fn && !events[type].keys.contains(fn))) return this; if (fn) removeEvent.apply(this, [type, fn]); else removeEvent.apply(this, type); events = this.retrieve('events'); if (events && events[type] && events[type].keys.length == 0){ var monitors = this.retrieve('$moo:delegateMonitors', {}); removeEvent.apply(this, [splitted.event, monitors[type]]); delete monitors[type]; } return this; } return removeEvent.apply(this, arguments); }, fireEvent: function(type, args, delay, bind){ var events = this.retrieve('events'); if (!events || !events[type]) return this; events[type].keys.each(function(fn){ fn.create({bind: bind || this, delay: delay, arguments: args})(); }, this); return this; } }); })(Element.prototype.addEvent, Element.prototype.removeEvent); /* --- script: Drag.js description: The base Drag Class. Can be used to drag and resize Elements using mouse events. license: MIT-style license authors: - Valerio Proietti - Tom Occhinno - Jan Kassens requires: - core:1.2.4/Events - core:1.2.4/Options - core:1.2.4/Element.Event - core:1.2.4/Element.Style - /MooTools.More provides: [Drag] */ var Drag = new Class({ Implements: [Events, Options], options: {/* onBeforeStart: $empty(thisElement), onStart: $empty(thisElement, event), onSnap: $empty(thisElement) onDrag: $empty(thisElement, event), onCancel: $empty(thisElement), onComplete: $empty(thisElement, event),*/ snap: 6, unit: 'px', grid: false, style: true, limit: false, handle: false, invert: false, preventDefault: false, modifiers: {x: 'left', y: 'top'} }, initialize: function(){ var params = Array.link(arguments, {'options': Object.type, 'element': $defined}); this.element = document.id(params.element); this.document = this.element.getDocument(); this.setOptions(params.options || {}); var htype = $type(this.options.handle); this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; this.mouse = {'now': {}, 'pos': {}}; this.value = {'start': {}, 'now': {}}; this.selection = (Browser.Engine.trident) ? 'selectstart' : 'mousedown'; this.bound = { start: this.start.bind(this), check: this.check.bind(this), drag: this.drag.bind(this), stop: this.stop.bind(this), cancel: this.cancel.bind(this), eventStop: $lambda(false) }; this.attach(); }, attach: function(){ this.handles.addEvent('mousedown', this.bound.start); return this; }, detach: function(){ this.handles.removeEvent('mousedown', this.bound.start); return this; }, start: function(event){ if (event.rightClick) return; if (this.options.preventDefault) event.preventDefault(); this.mouse.start = event.page; this.fireEvent('beforeStart', this.element); var limit = this.options.limit; this.limit = {x: [], y: []}; for (var z in this.options.modifiers){ if (!this.options.modifiers[z]) continue; if (this.options.style) this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); else this.value.now[z] = this.element[this.options.modifiers[z]]; if (this.options.invert) this.value.now[z] *= -1; this.mouse.pos[z] = event.page[z] - this.value.now[z]; if (limit && limit[z]){ for (var i = 2; i--; i){ if ($chk(limit[z][i])) this.limit[z][i] = $lambda(limit[z][i])(); } } } if ($type(this.options.grid) == 'number') this.options.grid = {x: this.options.grid, y: this.options.grid}; this.document.addEvents({mousemove: this.bound.check, mouseup: this.bound.cancel}); this.document.addEvent(this.selection, this.bound.eventStop); }, check: function(event){ if (this.options.preventDefault) event.preventDefault(); var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); if (distance > this.options.snap){ this.cancel(); this.document.addEvents({ mousemove: this.bound.drag, mouseup: this.bound.stop }); this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element); } }, drag: function(event){ if (this.options.preventDefault) event.preventDefault(); this.mouse.now = event.page; for (var z in this.options.modifiers){ if (!this.options.modifiers[z]) continue; this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; if (this.options.invert) this.value.now[z] *= -1; if (this.options.limit && this.limit[z]){ if ($chk(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])){ this.value.now[z] = this.limit[z][1]; } else if ($chk(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])){ this.value.now[z] = this.limit[z][0]; } } if (this.options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % this.options.grid[z]); if (this.options.style) { this.element.setStyle(this.options.modifiers[z], this.value.now[z] + this.options.unit); } else { this.element[this.options.modifiers[z]] = this.value.now[z]; } } this.fireEvent('drag', [this.element, event]); }, cancel: function(event){ this.document.removeEvent('mousemove', this.bound.check); this.document.removeEvent('mouseup', this.bound.cancel); if (event){ this.document.removeEvent(this.selection, this.bound.eventStop); this.fireEvent('cancel', this.element); } }, stop: function(event){ this.document.removeEvent(this.selection, this.bound.eventStop); this.document.removeEvent('mousemove', this.bound.drag); this.document.removeEvent('mouseup', this.bound.stop); if (event) this.fireEvent('complete', [this.element, event]); } }); Element.implement({ makeResizable: function(options){ var drag = new Drag(this, $merge({modifiers: {x: 'width', y: 'height'}}, options)); this.store('resizer', drag); return drag.addEvent('drag', function(){ this.fireEvent('resize', drag); }.bind(this)); } }); /* --- script: Drag.Move.js description: A Drag extension that provides support for the constraining of draggables to containers and droppables. license: MIT-style license authors: - Valerio Proietti - Tom Occhinno - Jan Kassens - Aaron Newton - Scott Kyle requires: - core:1.2.4/Element.Dimensions - /Drag provides: [Drag.Move] ... */ Drag.Move = new Class({ Extends: Drag, options: {/* onEnter: $empty(thisElement, overed), onLeave: $empty(thisElement, overed), onDrop: $empty(thisElement, overed, event),*/ droppables: [], container: false, precalculate: false, includeMargins: true, checkDroppables: true }, initialize: function(element, options){ this.parent(element, options); element = this.element; this.droppables = $$(this.options.droppables); this.container = document.id(this.options.container); if (this.container && $type(this.container) != 'element') this.container = document.id(this.container.getDocument().body); var styles = element.getStyles('left', 'top', 'position'); if (styles.left == 'auto' || styles.top == 'auto') element.setPosition(element.getPosition(element.getOffsetParent())); if (styles.position == 'static') element.setStyle('position', 'absolute'); this.addEvent('start', this.checkDroppables, true); this.overed = null; }, start: function(event){ if (this.container) this.options.limit = this.calculateLimit(); if (this.options.precalculate){ this.positions = this.droppables.map(function(el){ return el.getCoordinates(); }); } this.parent(event); }, calculateLimit: function(){ var offsetParent = this.element.getOffsetParent(), containerCoordinates = this.container.getCoordinates(offsetParent), containerBorder = {}, elementMargin = {}, elementBorder = {}, containerMargin = {}, offsetParentPadding = {}; ['top', 'right', 'bottom', 'left'].each(function(pad){ containerBorder[pad] = this.container.getStyle('border-' + pad).toInt(); elementBorder[pad] = this.element.getStyle('border-' + pad).toInt(); elementMargin[pad] = this.element.getStyle('margin-' + pad).toInt(); containerMargin[pad] = this.container.getStyle('margin-' + pad).toInt(); offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt(); }, this); var width = this.element.offsetWidth + elementMargin.left + elementMargin.right, height = this.element.offsetHeight + elementMargin.top + elementMargin.bottom, left = 0, top = 0, right = containerCoordinates.right - containerBorder.right - width, bottom = containerCoordinates.bottom - containerBorder.bottom - height; if (this.options.includeMargins){ left += elementMargin.left; top += elementMargin.top; } else { right += elementMargin.right; bottom += elementMargin.bottom; } if (this.element.getStyle('position') == 'relative'){ var coords = this.element.getCoordinates(offsetParent); coords.left -= this.element.getStyle('left').toInt(); coords.top -= this.element.getStyle('top').toInt(); left += containerBorder.left - coords.left; top += containerBorder.top - coords.top; right += elementMargin.left - coords.left; bottom += elementMargin.top - coords.top; if (this.container != offsetParent){ left += containerMargin.left + offsetParentPadding.left; top += (Browser.Engine.trident4 ? 0 : containerMargin.top) + offsetParentPadding.top; } } else { left -= elementMargin.left; top -= elementMargin.top; if (this.container == offsetParent){ right -= containerBorder.left; bottom -= containerBorder.top; } else { left += containerCoordinates.left + containerBorder.left; top += containerCoordinates.top + containerBorder.top; } } return { x: [left, right], y: [top, bottom] }; }, checkAgainst: function(el, i){ el = (this.positions) ? this.positions[i] : el.getCoordinates(); var now = this.mouse.now; return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); }, checkDroppables: function(){ var overed = this.droppables.filter(this.checkAgainst, this).getLast(); if (this.overed != overed){ if (this.overed) this.fireEvent('leave', [this.element, this.overed]); if (overed) this.fireEvent('enter', [this.element, overed]); this.overed = overed; } }, drag: function(event){ this.parent(event); if (this.options.checkDroppables && this.droppables.length) this.checkDroppables(); }, stop: function(event){ this.checkDroppables(); this.fireEvent('drop', [this.element, this.overed, event]); this.overed = null; return this.parent(event); } }); Element.implement({ makeDraggable: function(options){ var drag = new Drag.Move(this, options); this.store('dragger', drag); return drag; } }); /* --- script: Assets.js description: Provides methods to dynamically load JavaScript, CSS, and Image files into the document. license: MIT-style license authors: - Valerio Proietti requires: - core:1.2.4/Element.Event - /MooTools.More provides: [Assets] ... */ var Asset = { javascript: function(source, properties){ properties = $extend({ onload: $empty, document: document, check: $lambda(true) }, properties); var script = new Element('script', {src: source, type: 'text/javascript'}); var load = properties.onload.bind(script), check = properties.check, doc = properties.document; delete properties.onload; delete properties.check; delete properties.document; script.addEvents({ load: load, readystatechange: function(){ if (['loaded', 'complete'].contains(this.readyState)) load(); } }).set(properties); if (Browser.Engine.webkit419) var checker = (function(){ if (!$try(check)) return; $clear(checker); load(); }).periodical(50); return script.inject(doc.head); }, css: function(source, properties){ return new Element('link', $merge({ rel: 'stylesheet', media: 'screen', type: 'text/css', href: source }, properties)).inject(document.head); }, image: function(source, properties){ properties = $merge({ onload: $empty, onabort: $empty, onerror: $empty }, properties); var image = new Image(); var element = document.id(image) || new Element('img'); ['load', 'abort', 'error'].each(function(name){ var type = 'on' + name; var event = properties[type]; delete properties[type]; image[type] = function(){ if (!image) return; if (!element.parentNode){ element.width = image.width; element.height = image.height; } image = image.onload = image.onabort = image.onerror = null; event.delay(1, element, element); element.fireEvent(name, element, 1); }; }); image.src = element.src = source; if (image && image.complete) image.onload.delay(1); return element.set(properties); }, images: function(sources, options){ options = $merge({ onComplete: $empty, onProgress: $empty, onError: $empty, properties: {} }, options); sources = $splat(sources); var images = []; var counter = 0; return new Elements(sources.map(function(source){ return Asset.image(source, $extend(options.properties, { onload: function(){ options.onProgress.call(this, counter, sources.indexOf(source)); counter++; if (counter == sources.length) options.onComplete(); }, onerror: function(){ options.onError.call(this, counter, sources.indexOf(source)); counter++; if (counter == sources.length) options.onComplete(); } })); })); } }; /* --- script: Tips.js description: Class for creating nice tips that follow the mouse cursor when hovering an element. license: MIT-style license authors: - Valerio Proietti - Christoph Pojer requires: - core:1.2.4/Options - core:1.2.4/Events - core:1.2.4/Element.Event - core:1.2.4/Element.Style - core:1.2.4/Element.Dimensions - /MooTools.More provides: [Tips] ... */ (function(){ var read = function(option, element){ return (option) ? ($type(option) == 'function' ? option(element) : element.get(option)) : ''; }; this.Tips = new Class({ Implements: [Events, Options], options: { /* onAttach: $empty(element), onDetach: $empty(element), */ onShow: function(){ this.tip.setStyle('display', 'block'); }, onHide: function(){ this.tip.setStyle('display', 'none'); }, title: 'title', text: function(element){ return element.get('rel') || element.get('href'); }, showDelay: 100, hideDelay: 100, className: 'tip-wrap', offset: {x: 16, y: 16}, fixed: false }, initialize: function(){ var params = Array.link(arguments, {options: Object.type, elements: $defined}); this.setOptions(params.options); document.id(this); if (params.elements) this.attach(params.elements); }, toElement: function(){ if (this.tip) return this.tip; this.container = new Element('div', {'class': 'tip'}); return this.tip = new Element('div', { 'class': this.options.className, styles: { display: 'none', position: 'absolute', top: 0, left: 0 } }).adopt( new Element('div', {'class': 'tip-top'}), this.container, new Element('div', {'class': 'tip-bottom'}) ).inject(document.body); }, attach: function(elements){ $$(elements).each(function(element){ var title = read(this.options.title, element), text = read(this.options.text, element); element.erase('title').store('tip:native', title).retrieve('tip:title', title); element.retrieve('tip:text', text); this.fireEvent('attach', [element]); var events = ['enter', 'leave']; if (!this.options.fixed) events.push('move'); events.each(function(value){ var event = element.retrieve('tip:' + value); if (!event) event = this['element' + value.capitalize()].bindWithEvent(this, element); element.store('tip:' + value, event).addEvent('mouse' + value, event); }, this); }, this); return this; }, detach: function(elements){ $$(elements).each(function(element){ ['enter', 'leave', 'move'].each(function(value){ element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value); }); this.fireEvent('detach', [element]); if (this.options.title == 'title'){ // This is necessary to check if we can revert the title var original = element.retrieve('tip:native'); if (original) element.set('title', original); } }, this); return this; }, elementEnter: function(event, element){ this.container.empty(); ['title', 'text'].each(function(value){ var content = element.retrieve('tip:' + value); if (content) this.fill(new Element('div', {'class': 'tip-' + value}).inject(this.container), content); }, this); $clear(this.timer); this.timer = this.show.delay(this.options.showDelay, this, element); this.position((this.options.fixed) ? {page: element.getPosition()} : event); }, elementLeave: function(event, element){ $clear(this.timer); this.timer = this.hide.delay(this.options.hideDelay, this, element); this.fireForParent(event, element); }, fireForParent: function(event, element) { parentNode = element.getParent(); if (parentNode == document.body) return; if (parentNode.retrieve('tip:enter')) parentNode.fireEvent('mouseenter', event); else return this.fireForParent(event, parentNode); // Why was this reversed in the original? }, elementMove: function(event, element){ this.position(event); }, position: function(event){ var size = window.getSize(), scroll = window.getScroll(), tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight}, props = {x: 'left', y: 'top'}, obj = {}; for (var z in props){ obj[props[z]] = event.page[z] + this.options.offset[z]; if ((obj[props[z]] + tip[z] - scroll[z]) > size[z]) obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z]; } this.tip.setStyles(obj); }, fill: function(element, contents){ if(typeof contents == 'string') element.set('html', contents); else element.adopt(contents); }, show: function(element){ this.fireEvent('show', [element]); }, hide: function(element){ this.fireEvent('hide', [element]); } }); })();
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Demos/mootools-more.js
JavaScript
art
20,614
div.filemanager-container { display: none; } div.filemanager * { outline: 0; } div.filemanager a img { border: 0 } div.filemanager-container, div.filemanager, div.filemanager button, div.filemanager label, div.filemanager h1 { width: auto; margin: 0; font-family: Tahoma, sans-serif; font-size: 12px; font-weight: normal; text-transform: none; letter-spacing: 0; } div.filemanager { background: #eee; position: absolute; z-index: 1001; width: 800px; height: 450px; box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; -moz-box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; } div.filemanager div.filemanager-menu { position: absolute; height: 30px; left: 30%; width: 70%; bottom: 0; line-height: 30px; border-top: 1px solid #bebebe; background: url(../Assets/menu.png) repeat-x; } div.filemanager button { cursor: pointer; height: 22px; line-height: 22px; margin: 4px 5px; padding: 0 2px; color: #333; text-shadow: #eee 1px 1px 1px; clear: none; background: url(../Assets/button.png) repeat-x; border: 1px solid #a1aeb9; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } div.filemanager-engine-trident4 button, div.filemanager-engine-trident5 button { padding: 0 .25em; overflow: visible; } div.filemanager-menu button { float: right; } div.filemanager button:hover, div.filemanager button.hover, div.filemanager button:focus { border: 1px solid #5f676e; } div.filemanager button.disabled, div.filemanager button.disabled:hover, div.filemanager button.disabled:focus { cursor: default; color: #666; text-shadow: none; background: url(../Assets/button_disabled.png) repeat-x; border-color: #bababa; } div.filemanager button.filemanager-open { font-weight: bold; } div.filemanager-menu label { cursor: pointer; float: right; width: auto; height: auto; line-height: 30px; font-size: 11px; } div.filemanager-menu div.loader { float: left; width: 16px; height: 16px; margin: 8px 0; background: url(../Assets/loader.gif) no-repeat; } div.filemanager ul { margin: 0; padding: 0; position: relative; line-height: 1.8em; overflow: auto; overflow-x: hidden; zoom: 1; } div.filemanager ul li { background: none; list-style-image: none; list-style-type: none; list-style: none; line-height: 1.8em; margin: 0; padding: 0; height: 21px; white-space: nowrap; } div.filemanager ul.filemanager-browser { left: 0px; top: 0px; height: 100%; width: 30%; border: 0; border-right: 1px solid #bebebe; background: url(../Assets/filelist.png) repeat-x #c1c7cf; } div.filemanager-container span.fi { height: 21px; line-height: 1.8em; padding-left: 5px; color: #000; text-decoration: none; display: block; white-space: nowrap; cursor: pointer; } div.filemanager-container span.fi span { white-space: nowrap; display: block; width: 65%; overflow: hidden; } div.filemanager-container span.drag span, div.filemanager-engine-trident4 ul li span.fi span, div.filemanager-engine-trident5 ul li span.fi span, div.filemanager-engine-presto ul li span.fi span, div.filemanager ul li:hover span.fi span { overflow: hidden; } div.filemanager ul li span.dir { background-color: transparent; } div.filemanager ul li span.droppable { background-color: #99b7e7; } ul.filemanager-browser a, ul.filemanager-browser span { position: relative; } div.filemanager ul li a.selected, div.filemanager ul li span.selected { background: url(../Assets/filelist_selected.png) repeat-x; color: #eee; outline: none; } div.filemanager-container span.fi img { display: block; float: left; margin: 3px 3px 0 0; } div.filemanager-container span.fi img.browser-icon { float: right; } div.filemanager-container span.move img.browser-icon { display: none; } div.filemanager span.notice { position: absolute; bottom: 16px; left: 16px; } div.filemanager div.filemanager-close { position: absolute; right: -10px; top: -10px; height: 20px; width: 20px; cursor: pointer; background: url(../Assets/button.png) repeat-x; border: 1px solid #a1aeb9; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } div.filemanager div.filemanager-close img { padding: 2px; } div.filemanager-infos { position: absolute; left: 30%; top: 0; width: 70%; line-height: 1.6em; overflow: auto; } div.filemanager-head { height: 32px; overflow: hidden; } img.filemanager-icon { float: left; margin: 10px 12px; } div.filemanager h1 { margin: 0; padding: 0; width: 80%; height: 32px; line-height: 32px; color: #333; font-size: 20px; letter-spacing: 1px; overflow: hidden; white-space: nowrap; background-color: transparent; } div.filemanager h2 { margin: 0; border-top: 1px solid #bebebe; font-size: 14px; font-weight: bold; padding: 2px 0 0 5px; clear: both; } div.filemanager dl { margin: 5px 0; width: 100%; clear: both; overflow: auto; } div.filemanager dt, div.filemanager dd { float: left; line-height: 20px; font-size: 11px; } div.filemanager dt { clear: both; width: 22%; margin-left: 5%; font-weight: bold; } div.filemanager dd { width: 60%; white-space: nowrap; overflow: auto; } div.filemanager div.margin { margin-left: 15px; } div.filemanager dd.filemanager-dir a.icon { border: 1px solid #bebebe; padding: 2px 5px 2px 20px; text-decoration: none; background: #eee url(../Assets/Icons/dir.png) 2px 0 no-repeat; color: #000; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } div.filemanager dd.filemanager-dir a.icon:hover { text-decoration: none; background-color: #fff; } div.filemanager dd.filemanager-dir a.selected, div.filemanager dd.filemanager-dir a.selected:hover { margin: 0 1px; background-color: transparent; border: none; cursor: auto; } div.filemanager-preview { margin-top: 5px; } div.filemanager-preview img.preview { margin: 0 auto 1em; display: block; max-height: 100px; background: transparent; } div.filemanager-engine-trident4 div.filemanager-preview img.preview { height: 100px; } div.filemanager-preview ul, div.filemanager-uploader ul, div.filemanager-preview div.textpreview { border: 1px solid #bebebe; background: #fff; padding: 2px; margin: 1em auto; width: 490px; height: 220px; overflow: auto; } div.filemanager-preview div.textpreview { font: 9px Verdana, Arial, Helvetica, sans-serif; } div.filemanager-preview div.object { width: 200px; height: 20px; border: 1px solid #bebebe; margin: 0 0 1em 190px; overflow: hidden; } div.filemanager-container img.browser-add { position: absolute; width: 16px; height: 16px; z-index: 1010; } /* UPLOAD */ div.filemanager-container .file span { padding: 0 5px 0 0; } div.filemanager-container .file .file-size { color: #666; } div.filemanager-container .file .file-cancel { cursor: pointer; padding-left: 5px; float: right; } div.filemanager-container .file .file-progress { margin-top: 5px; float: right; width: 125px; height: 12px; background-image: url(../Assets/progress.gif); } div.filemanager div.checkbox { float: left; height: 12px; width: 16px; margin: 10px 3px 0; background: url(../Assets/checkbox.png) no-repeat; } div.filemanager div.checkboxChecked { background-position: 0 -12px; } /* SELECTED FILE */ div.selected-file img { vertical-align: bottom; padding: 0 3px 0 0; } div.selected-file span { line-height: 16px; } div.selected-file .file-cancel { cursor: pointer; padding: 0 0 0 5px; } /* GALLERY */ div.filemanager button.filemanager-serialize { font-weight: bold; } div.filemanager-gallery { position: absolute; z-index: 1000; width: 750px; height: 144px; display: none; font-family: Tahoma, sans-serif; font-size: 12px; border: 1px solid #bebebe; border-top: 0; background: #eee; border-radius-bottomleft: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-radius-bottomleft: 5px; border-radius-bottomright: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-radius-bottomright: 5px; box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; -moz-box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 40px; } div.filemanager-gallery div.howto { position: absolute; z-index: 1002; left: 50px; top: 60px; color: #666; font-size: 18px; font-style: italic; } div.filemanager-gallery ul { height: 121px; margin: 7px 6px; padding: 4px; overflow: auto; overflow-x: hidden; border: 1px solid #bebebe; background: #f2f2f2; } div.filemanager-gallery ul.droppable { background-color: #99b7e7; } div.filemanager-gallery ul li { position: relative; float: left; margin: 0; width: 79px; height: 60px; list-style: none; background: url(../Assets/loader.gif) center center no-repeat; } div.filemanager-gallery ul li img { padding: 2px; width: 75px; height: 56px; cursor: pointer; } div.filemanager-gallery ul li img.filemanager-remove { position: absolute; right: -7px; top: -7px; width: 16px; height: 16px; } div.filemanager-wrapper { position: absolute; z-index: 1020; width: 222px; height: 250px; font-family: Tahoma, sans-serif; font-size: 12px; border: 1px solid #bebebe; background: #eee; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } div.filemanager-wrapper div.img { width: 210px; height: 160px; margin: 5px; border: 1px solid #bebebe; background: #fff; } div.filemanager-wrapper span { display: block; margin: 3px 8px 1px; font-weight: bold; } div.filemanager-wrapper input { width: 210px; margin: 3px 5px 0; border: 1px solid #bebebe; background: #fff; } div.filemanager-wrapper button { margin: 3px 7px; } img.filemanager-clone { cursor: pointer; } /* TIPS */ .tip-filebrowser { z-index: 1201; } .tip-filebrowser .tip { background: #000; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } .tip-filebrowser .tip-title { color: #fff; font-size: 11px; padding: 1px 4px; line-height: 21px; text-align: center; font-weight: bold; } .tip-filebrowser .tip-text { display: none; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Css/FileManager.css
CSS
art
10,631
/* Overlay */ div.fm-overlay { position: absolute; left: 0; top: 0; display: none; z-index: 999; background: #aaa; } /* Dialog */ div.fm-overlay-dialog { z-index: 1999; background: #fff; } div.fm-dialog { position: absolute; display: none; z-index: 2000; width: 229px; padding-bottom: 40px; color: #bebebe; font-family: Tahoma, sans-serif; font-size: 12px; background: rgba(0, 0, 0, 0.8); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; -moz-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; -webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 0 10px; } div.fm-dialog-engine-trident { background: #000; } div.fm-dialog-engine-trident4 { width: 249px; } div.fm-dialog a { color: #aaa; } div.fm-dialog a:hover { text-decoration: none; } div.fm-dialog div { margin: 10px; } div.fm-dialog input, div.fm-dialog select { width: 94%; margin: 20px 2%; padding: 2px 1%; border: 1px solid #bebebe; background: #fff; color: #333; font-family: Tahoma, sans-serif; font-size: 12px; } div.fm-dialog-engine-trident4 input, div.fm-dialog-engine-trident5 input { width: 80%; } div.fm-dialog button { position: absolute; bottom: 15px; right: 15px; width: auto; height: 22px; padding: 2px; border: 1px solid #bebebe; cursor: pointer; color: #333; text-shadow: #eee 1px 1px 1px; font-family: Tahoma, sans-serif; letter-spacing: 0; font-size: 12px; font-weight: normal; margin: 0; background: url(../Assets/button.png) repeat-x; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } div.fm-dialog-engine-trident4 button, div.fm-dialog-engine-trident5 button { padding: 0 .25em; overflow: visible; } div.fm-dialog button.fm-dialog-decline { right: auto; left: 15px; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/mootools-filemanager/Css/Additions.css
CSS
art
1,884
<?php /** = MootoolsFileManager Configuration File = Configure either by directly editing the config.php file (not recommended) or as follows... 1. You need to be able to put PHP in your XinhaConfig.js, so you may want to call it XinhaConfig.php instead, or whatever other method you choose (eg put the config as an inline script in your main php page). 2. In step 3 of your XinhaConfig write something like... {{{ with (xinha_config.MootoolsFileManager) { <?php require_once('/path/to/xinha/contrib/php-xinha.php'); xinha_pass_to_php_backend ( array ( 'images_dir' => '/home/your/directory', 'images_url' => '/directory', 'allow_images_upload' => true, ) ) ?> } }}} This will work provided you are using normal file-based PHP sessions (most likely), if not, you may need to modify the php-xinha.php file to suit your setup. * @author $Author$ * @version $Id$ * @package MootoolsFileManager * */ /** == File Paths REQUIRED == This plugin operates (optionally) in two modes. 1. As a File Manager where people are inserting a link to a file (eg a doc or pdf commonly), we call this "files" mode. 2. As an Image Manager where people are inserting an inline image, we call this "images" mode. You may provide one of, or both of, files_dir and images_dir. If you do not provide one, that mode of MootoolsFileManager will be disabled. # `files_dir` -- Directory path to the location where ordinary files are stored (eg /home/you/public_html/downloads/ ) # `files_url` -- The URL path to the files_dir (eg /downloads/) # `images_dir` -- Directory path to the location where inline images are stored (eg /home/you/public_html/images/) # `images_url` -- The URL path to the images_dir === Security Caution === You should ensure that the paths you specify are protected against having PHP and other scripts from being executed. The following .htaccess file is a good idea {{{ <IfModule mod_php.c> php_flag engine off </IfModule> AddType text/html .html .htm .shtml .php .php3 .php4 .php5 .php6 .php7 .php8 .phtml .phtm .pl .py .cgi RemoveHandler .php RemoveHandler .php8 RemoveHandler .php7 RemoveHandler .php6 RemoveHandler .php5 RemoveHandler .php4 RemoveHandler .php3 }}} */ $IMConfig['files_dir'] = FALSE; // No trailing slash $IMConfig['files_url'] = FALSE; // No trailing slash $IMConfig['images_dir'] = FALSE; // No trailing slash $IMConfig['images_url'] = FALSE; // No trailing slash /** == Turning On Uploads == We have two sets of settings for turning on uploads, one controls the files mode of the plugin, the other is for images mode. Note that allowing upload also permits the user to create subdirectories to better organise the files. === Maximum File Sizes === Each mode can have a different maximum file size that can be uploaded, this size is a number followed by one of M, KB or B. === Suggested Image Dimensions === Each mode can have a different "suggested maximum image dimension", when the user uses the Mootools File Manager to upload a file, they are able to choose to "resize large images" on upload. This defines what "large" means. */ $IMConfig['allow_files_upload'] = false; $IMConfig['allow_files_delete'] = false; $IMConfig['max_files_upload_size'] = '3M'; $IMConfig['suggested_files_image_dimension'] = array('width' => 2048, 'height' => 1536); $IMConfig['allow_images_upload'] = false; $IMConfig['allow_images_delete'] = false; $IMConfig['max_images_upload_size'] = '3M'; $IMConfig['suggested_images_image_dimension'] = array('width' => 1024, 'height' => 768); // ------------------------------------------------------------------------- // OPTIONAL SETTINGS // ------------------------------------------------------------------------- /** == Plugin Path == For most people the defaults will work fine, but if you have trouble, you can set `base_dir` to be the directory path to xinha/plugins/MootoolsFileManager `base_url` to be the url path to xinha/plugins/MootoolsFileManager */ $IMConfig['base_dir'] = getcwd(); $IMConfig['base_url'] = preg_replace('/\/backend\.php.*/', '', $_SERVER['REQUEST_URI']); /** // Future use, not yet required. == ImageMagick Path == Certain operations require that ImageMagick is available on your server, mogrify, convert and identify executables are required. If these executables are not in your executable path, you'll want to set the path to them here, for Linux/Unix etc this will be something like {{{ /usr/bin }}} for Windows servers, something like {{{ C:/"Program Files"/ImageMagick-5.5.7-Q16/ }}} $IMConfig['IMAGE_TRANSFORM_LIB_PATH'] = ''; */ //////////////////////////////////////////////////////////////////////////////// // ================== END OF CONFIGURATION ======================= // //////////////////////////////////////////////////////////////////////////////// // Standard PHP Backend Data Passing // if data was passed using xinha_pass_to_php_backend() we merge the items // provided into the Config require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php')); if($passed_data = xinha_read_passed_data()) { $IMConfig = array_merge($IMConfig, $passed_data); } @session_write_close(); // Close session now so we don't lock. ?>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/config.php
PHP
art
5,908
.filemanager-container .filemanager { overflow:visible; } .filemanager-info-area { width:50%; float:left; clear:left; } .filemanager-preview-area { width:50%; float:left; clear:right; } div.filemanager-info-area dt, div.filemanager-preview-area dt { width:25%; margin-left:5px; } div.filemanager-info-area dd, div.filemanager-preview-area dd { width:auto; } div.filemanager-preview-area dt { float:left; } div.filemanager-preview-area h2 { display:none; } div.filemanager-preview-area img.preview { margin-left:5px; margin-right:5px; margin-top:0px; float:right; clear:right; max-width:140px; } div.filemanager-preview-area dl { float:left; clear:left; width:auto; } div.filemanager-preview div.object { margin-left:15%; margin-right:15%; margin-top:0px; float:right; clear:right; } div.filemanager td, div.filemanager th, div.filemanager input[type=text] { line-height: 20px; font-size: 11px; } div.filemanager th { font-weight:bold; text-align:left; padding-left:0px; } div.filemanager td.filemanager-f_alt input {width:100%;} div.filemanager table.filemanager-extended-options { width:550px; margin-left:5px; margin-right:5px; border-collapse:collapse; } table.filemanager-extended-options .buttonColor { width :1em; margin-left: 2px; cursor: default; } table.filemanager-extended-options .buttonColor .chooser, table.filemanager-extended-options .buttonColor .nocolor { height: 0.6em; border: 1px solid; padding: 0px 1em; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; } table.filemanager-extended-options .buttonColor .buttonClick { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; } table.filemanager-extended-options .buttonColor .buttonColor-hilite { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; } table.filemanager-extended-options .buttonColor .nocolor { padding: 0px; } table.filemanager-extended-options .buttonColor .nocolor-hilite { background-color: #fff; color: #f00; } div.filemanager-uploader-area { clear:both; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/MootoolsFileManager.css
CSS
art
2,050
<?php /** * Unified backend for ImageManager * * Image Manager was originally developed by: * Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou. * * Unified backend sponsored by DTLink Software, http://www.dtlink.com * Implementation by Yermo Lamers, http://www.formvista.com * * (c) DTLink, LLC 2005. * Distributed under the same terms as HTMLArea itself. * This notice MUST stay intact for use (see license.txt). * * DESCRIPTION: * * Instead of using separate URL's for each function, ImageManager now * routes all requests to the server through this single, replaceable, * entry point. backend.php expects at least two URL variable parameters: * * __plugin=ImageManager for future expansion; identify the plugin being requested. * __function=thumbs|images|editorFrame|editor|manager function being called. * * Having a single entry point that strictly adheres to a defined interface will * make the backend code much easier to maintain and expand. It will make it easier * on integrators, not to mention it'll make it easier to have separate * implementations of the backend in different languages (Perl, Python, ASP, etc.) * * @see config.inc.php */ // Strip slashes if MQGPC is on set_magic_quotes_runtime(0); if(get_magic_quotes_gpc()) { $to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE); while(count($to_clean)) { $cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))]; unset($to_clean[array_pop($junk = array_keys($to_clean))]); foreach(array_keys($cleaning) as $k) { if(is_array($cleaning[$k])) { $to_clean[] =& $cleaning[$k]; } else { $cleaning[$k] = stripslashes($cleaning[$k]); } } } } function size_to_bytes($s) { if(preg_match('/([0-9\.])+([a-zA-Z]+)/', $s, $M)) { switch(strtolower($M)) { case 'm': return floor(floatval($M[1]) * 1024 * 1024); case 'b': return intval($M[1]); case 'kb': return floor(floatval($M[1]) * 1024); } } if(floatval($s) < 10) return floor(floatval($s) * 1024 * 1024); if(floatval($s) < 1024) return floor(floatval($s) * 1024); // Kilobytes return intval($s); // Bytes } require_once('config.php'); switch ( @$_REQUEST[ "__function" ] ) { case 'read-config': // This is used so that the javascript can read the config // so we don't have to have a js config and a php config duplicating // settings echo xinha_to_js($IMConfig); break; case 'image-manager': include('mootools-filemanager/Backend/FileManager.php'); $browser = new FileManager(array( 'directory' => $IMConfig['images_dir'], 'baseURL' => $IMConfig['images_url'], 'assetBasePath' => $IMConfig['base_url'] .'/mootools-filemanager/Assets', 'upload' => $IMConfig['allow_images_upload'], 'maxUploadSize' => size_to_bytes($IMConfig['max_images_upload_size']), 'suggestedMaxImageDimension' => $IMConfig['suggested_images_image_dimension'], 'destroy' => $IMConfig['allow_images_delete'], 'filter' => 'image/', )); $browser->fireEvent(!empty($_REQUEST['event']) ? $_REQUEST['event'] : null); break; case 'file-manager': include('mootools-filemanager/Backend/FileManager.php'); $browser = new FileManager(array( 'directory' => $IMConfig['files_dir'], 'baseURL' => $IMConfig['files_url'], 'assetBasePath' => $IMConfig['base_url'] .'/mootools-filemanager/Assets', 'upload' => $IMConfig['allow_files_upload'], 'maxUploadSize' => size_to_bytes($IMConfig['max_files_upload_size']), 'suggestedMaxImageDimension' => $IMConfig['suggested_files_image_dimension'], 'destroy' => $IMConfig['allow_files_delete'], // 'filter' => $IMConfig['files_filter'], )); $browser->fireEvent(!empty($_REQUEST['event']) ? $_REQUEST['event'] : null); break; } ?>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/backend.php
PHP
art
4,086
/** = Mootools File Manager = == Image Manager == The functions in this file extend the MootoolsFileManager plugin with support for managing images. This file is loaded automatically. * @author $Author$ * @version $Id$ * @package MootoolsFileManager */ /** Open the Image Manager version of the plugin. * * Called from the _insertImage method of the editor (see the hookup in MootoolsFileManager.js) * Optional image for future external use. */ MootoolsFileManager.prototype.OpenImageManager = function(image) { var editor = this.editor; // for nested functions var self = this; var outparam = null; if (typeof image == "undefined") { image = editor.getParentElement(); if (image && !/^img$/i.test(image.tagName)) { image = null; } } if ( image ) { outparam = { f_url : Xinha.is_ie ? image.src : image.src, f_alt : image.alt, f_border : image.style.borderWidth ? image.style.borderWidth : image.border, f_align : image.hasAttribute('align') ? image.align : null, f_padding: image.style.padding, f_margin : image.style.margin, f_width : image.hasAttribute('width') ? image.width : null, f_height : image.hasAttribute('height') ? image.height : null, f_backgroundColor: image.style.backgroundColor, f_borderColor: image.style.borderColor, f_hspace: image.hspace && image.hspace != '-1' ? parseInt(image.hspace) : null, f_vspace: image.vspace && image.vspace != '-1' ? parseInt(image.vspace) : null }; outparam.f_border = this.shortSize(outparam.f_border); outparam.f_padding = this.shortSize(outparam.f_padding); outparam.f_margin = this.shortSize(outparam.f_margin); outparam.f_backgroundColor = this.convertToHex(outparam.f_backgroundColor); outparam.f_borderColor = this.convertToHex(outparam.f_borderColor); } this.current_image = image; this.current_attributes = outparam; if(!this.ImageManagerWidget) { this.ImageManagerWidget = new FileManager({ url: this.editor.config.MootoolsFileManager.backend+'__function=image-manager&', assetBasePath: Xinha.getPluginDir('MootoolsFileManager')+'/mootools-filemanager/Assets', language: _editor_lang, selectable: true, upload: this.phpcfg.allow_images_upload, uploadAuthData: this.editor.config.MootoolsFileManager.backend_data, onComplete: function(path, file) { self.ImageManagerReturn(path,file); }, onHide: function() { if(this.swf && this.swf.box) this.swf.box.style.display = 'none'; }, onShow: function() { if(this.swf && this.swf.box) this.swf.box.style.display = ''; }, onDetails: function(details) { this.info.adopt(self.ImageManagerAttributes(details)); return true; }, onHidePreview: function() { $(self.ImageManagerAttributes().table).dispose(); return true; } }); } this.ImageManagerWidget.show(); }; /** Return a DOM fragment which has all the fields needed to set the * attributes for an image given a structure of initial values. * * OR return a structure of values taken from the currently table. */ MootoolsFileManager.prototype.ImageManagerAttributes = function (details) { var self = this; self._LastImageDetails = details; function f(name) { var e = self._ImageManagerAttributesTable.getElementsByTagName('input'); for(var i = 0; i < e.length; i++) { if(e[i].name == name) return e[i]; } var e = self._ImageManagerAttributesTable.getElementsByTagName('select'); for(var i = 0; i < e.length; i++) { if(e[i].name == name) return e[i]; } return null; } function s(name, value) { for(var i = 0; i < f(name).options.length; i++) { if(f(name).options[i].value == value) { // f(name).options[i].selected = true; f(name).selectedIndex = i; } } } if(!this._ImageManagerAttributesTable) { this._ImageManagerAttributesTable = (function() { var table = document.createElement('table'); table.className = 'filemanager-extended-options'; var tbody = table.appendChild(document.createElement('tbody')); { // Description var tr = tbody.appendChild(document.createElement('tr')); var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Description:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); td.colSpan = 6; input.name = 'f_alt'; input.type = 'text'; th.className = td.className = 'filemanager-f_alt'; } { // Width, Constrain, Margin, var tr = tbody.appendChild(document.createElement('tr')); { // Width var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Width:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_width'; input.size = 4; input.type = 'text'; // @TODO Constrain Ratio th.className = td.className = 'filemanager-f_width'; } { // Constrain var td = tr.appendChild(document.createElement('td')); td.rowSpan = 2; var div = td.appendChild(document.createElement('div')); div.style.position = 'relative'; var img = div.appendChild(document.createElement('img')); img.src = '/plugins/ImageManager/img/locked.gif'; img.width = 25; img.height = 32; img.alt = 'Constrain Proportions'; img.style.verticalAlign = 'middle'; var input = document.createElement('input'); input.type = 'checkbox'; input.name = 'f_constrain'; input.style.position = 'absolute'; input.style.top = '8px'; input.style.left = '0px'; input.value = 'on'; input.checked = true; div.appendChild(input); td.className = 'filemanager-f_constrain'; } if(self.phpcfg.UseHSpaceVSpace) { // HSPACE/VSPACE var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Margin:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_hspace'; input.size = 3; input.type = 'text'; td.appendChild(document.createTextNode(' x ')); var input = td.appendChild(document.createElement('input')); input.name = 'f_vspace'; input.size = 3; input.type = 'text'; td.appendChild(document.createTextNode(' px ')); th.className = td.className = 'filemanager-f_hspace filemanager-f_vspace'; } else { // Margin var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Margin:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_margin'; input.size = 3; input.type = 'text'; td.appendChild(document.createTextNode(' px ')); th.className = td.className = 'filemanager-f_margin'; } } { // Height, Padding, Colour var tr = tbody.appendChild(document.createElement('tr')); { // Height var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Height:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_height'; input.size = 4; input.type = 'text'; // @TODO Constrain Ratio th.className = td.className = 'filemanager-f_width'; } { // Padding var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Padding:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_padding'; input.size = 3; input.type = 'text'; td.appendChild(document.createTextNode(' px ')); th.className = td.className = 'filemanager-f_padding'; } { // Padding Colour (Background) var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Colour:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_backgroundColor'; input.size = 7; input.type = 'text'; new Xinha.colorPicker.InputBinding(input); th.className = td.className = 'filemanager-f_backgroundColor'; } } { // Alignment, Border, Colour var tr = tbody.appendChild(document.createElement('tr')); { // Alignment var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Alignment:')); var td = tr.appendChild(document.createElement('td')); td.colSpan = 2; var input = td.appendChild(document.createElement('select')); input.name = 'f_align'; input.title = 'Positioning of this image'; input.options[0] = new Option('', true, true); input.options[1] = new Option('Left'); input.options[2] = new Option('Right'); input.options[3] = new Option('Top'); input.options[4] = new Option('Middle'); input.options[5] = new Option('Bottom'); // @TODO Constrain Ratio th.className = td.className = 'filemanager-f_align'; } { // Border var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Border:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_border'; input.size = 3; input.type = 'text'; td.appendChild(document.createTextNode(' px ')); th.className = td.className = 'filemanager-f_border'; } { // Border Colour var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Colour:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); input.name = 'f_borderColor'; input.size = 7; input.type = 'text'; new Xinha.colorPicker.InputBinding(input); th.className = td.className = 'filemanager-f_borderColor'; } } var div = document.createElement('div'); var h2 = document.createElement('h2'); h2.appendChild(document.createTextNode('Image Attributes')); div.appendChild(h2); div.appendChild(table); return div; })(); f('f_width').onkeyup = function() { if(!f('f_constrain').checked) return true; if(!f('f_width').value) { f('f_width').value = ''; f('f_height').value = ''; } else if(f('f_height').value && self._LastImageDetails) { f('f_height').value = self.ScaleImage(self._LastImageDetails, { width: f('f_width').value, height: null }).height; } else if(!self._LastImageDetails) { f('f_height').value = ''; } return true; } f('f_height').onkeyup = function() { if(!f('f_constrain').checked) return true; if(!f('f_height').value) { f('f_width').value = ''; f('f_height').value = ''; } else if(f('f_width').value && self._LastImageDetails) { f('f_width').value = self.ScaleImage(self._LastImageDetails, { width: null, height: f('f_height').value }).width; } else if(!self._LastImageDetails) { f('f_width').value = ''; } return true; } f('f_constrain').onclick = function() { if(this.checked && f('f_width').value && f('f_height').value) { var new_dim = self.ScaleImage(self._LastImageDetails, { width:f('f_width').value, height:f('f_height').value }); f('f_width').value = new_dim.width; f('f_height').value = new_dim.height; } } } if(this.current_attributes) { f('f_alt').value = this.current_attributes.f_alt; f('f_border').value = this.current_attributes.f_border; s('f_align', this.current_attributes.f_align); f('f_padding').value = this.current_attributes.f_padding; if(f('f_margin')) f('f_margin').value = this.current_attributes.f_margin; f('f_backgroundColor').value = this.current_attributes.f_backgroundColor; f('f_borderColor').value = this.current_attributes.f_borderColor; if(f('f_hspace')) f('f_hspace').value = this.current_attributes.f_hspace; if(f('f_vspace')) f('f_vspace').value = this.current_attributes.f_vspace; f('f_width').value = this.current_attributes.f_width ? this.current_attributes.f_width : ''; f('f_height').value = this.current_attributes.f_height ? this.current_attributes.f_height : ''; this.current_attributes = null; } // If no details were supplied, we return the current ones if(!details) { var details = { f_alt: f('f_alt').value, f_border: f('f_border').value, f_align: f('f_align').options[f('f_align').selectedIndex].value, f_padding: f('f_padding').value, f_margin: f('f_margin') ? f('f_margin').value : null, f_backgroundColor: f('f_backgroundColor').value, f_borderColor: f('f_borderColor').value, f_hspace: f('f_hspace') ? f('f_hspace').value : null, f_vspace: f('f_vspace') ? f('f_vspace').value : null, f_width: f('f_width').value, f_height: f('f_height').value, table: this._ImageManagerAttributesTable } return details; } // If details were supplied, we set the appropriate ones. if( (f('f_width').value && f('f_width').value != details.width) || (f('f_height').value && f('f_height').value != details.height) ) { new Dialog('This image is a different size, would you like to use the new size?', { language: { confirm: 'Shrink/Grow To Fit', decline: 'Fullsize' }, buttons: [ 'confirm', 'decline' ], onConfirm: function(){ if(f('f_constrain').checked) { var new_size = self.ScaleImage(details, {width: f('f_width').value, height: f('f_height').value}); f('f_width').value = f('f_width').value ? new_size.width : ''; f('f_height').value = f('f_height').value ? new_size.height : ''; } }, onDecline: function(){ f('f_width').value = ''; f('f_height').value = ''; } }); } f('f_align').style.visibility = ''; // Ensure that the select hasn't been hidden by an overlay and not put back return this._ImageManagerAttributesTable; }; /** Handle the "Select" return from the File Manager, inserting or updating an * image as appropriate. Calles ImageManagerAttributes() with no arguments * to find out the attributes to set. */ MootoolsFileManager.prototype.ImageManagerReturn = function(path, file) { var editor = this.editor; var self = this; var image = this.current_image; var param = self.ImageManagerAttributes(); param.f_url = path; var img = image; if (!img) { if (Xinha.is_ie) { var sel = editor._getSelection(); var range = editor._createRange(sel); editor._doc.execCommand("insertimage", false, param.f_url); img = range.parentElement(); // wonder if this works... if (img.tagName.toLowerCase() != "img") { img = img.previousSibling; } } else { img = document.createElement('img'); img.src = param.f_url; editor.insertNodeAtSelection(img); } } else { img.src = param.f_url; } for (field in param) { var value = param[field]; // @TODO: Add ability to mfm for this to be possible. switch (field) { case "f_alt" : img.alt = value; break; case "f_border" : if(value.length) { img.style.borderWidth = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px'); if(img.style.borderWidth && !img.style.borderStyle) { img.style.borderStyle = 'solid'; } } else { img.style.borderWidth = ''; img.style.borderStyle = ''; } break; case "f_borderColor": img.style.borderColor = value; break; case "f_backgroundColor": img.style.backgroundColor = value; break; case "f_padding": { if(value.length) { img.style.padding = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px'); } else { img.style.padding = ''; } } break; case "f_margin": { if(value.length) { img.style.margin = /[^0-9]/.test(value) ? value : (parseInt(value) + 'px'); } else { img.style.margin = ''; } } break; case "f_align" : if(img.align && img.align !== true) { img.align = value; } else { img.removeAttribute('align'); } break; case "f_width" : { if(!isNaN(parseInt(value))) { img.width = parseInt(value); } else { img.removeAttribute('width'); } } break; case "f_height": { if(!isNaN(parseInt(value))) { img.height = parseInt(value); } else { img.removeAttribute('height'); } } break; case "f_hspace" : { if(!isNaN(parseInt(value))) { img.hspace = parseInt(value); } else { img.removeAttribute('hspace'); } } break; case "f_vspace" : { if(!isNaN(parseInt(value))) { img.vspace = parseInt(value); } else { img.removeAttribute('vspace'); } } break; } } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/MootoolsFileManager.ImageManager.js
JavaScript
art
20,059
/** = Mootools File Manager = The MootoolsFileManager plugin allows for the management, selection and insertion of links to files and inline images to the edited HTML. It requires the use of Mootools. If you do not use mootools plugins, then mootools is not loaded. If mootools is already loaded, it will not be reloaded (so if you want to use your own version of Mootools then load it first). == Usage == Instruct Xinha to load the MootoolsFileManager plugin (follow the NewbieGuide). Configure the plugin as per the directions in the config.php file. * @author $Author$ * @version $Id$ * @package MootoolsFileManager */ MootoolsFileManager._pluginInfo = { name : "Mootols File Manager", version : "1.0", developer : "James Sleeman (Xinha), Christoph Pojer (FileManager)", license : "MIT" }; // All the configuration is done through PHP, please read config.php to learn how (or if you're in a real // hurry, just edit config.php) Xinha.Config.prototype.MootoolsFileManager = { 'backend' : Xinha.getPluginDir("MootoolsFileManager") + '/backend.php?__plugin=MootoolsFileManager&', 'backend_data' : { } }; MootoolsFileManager.AssetLoader = Xinha.includeAssets(); // In case you want to use your own version of Mootools, you can load it first. if(typeof MooTools == 'undefined') { MootoolsFileManager.AssetLoader .loadScript('mootools-filemanager/Demos/mootools-core.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Demos/mootools-more.js', 'MootoolsFileManager'); } // In case you want to use your own version of FileManager, you can load it first. // You better look at the changes we had to do to the standard one though. if(typeof FileManager == 'undefined') { MootoolsFileManager.AssetLoader .loadStyle('mootools-filemanager/Css/FileManager.css', 'MootoolsFileManager') .loadStyle('mootools-filemanager/Css/Additions.css', 'MootoolsFileManager') .loadScript('mootools-filemanager/Source/FileManager.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Language/Language.en.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Source/Additions.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Source/Uploader/Fx.ProgressBar.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Source/Uploader/Swiff.Uploader.js', 'MootoolsFileManager') .loadScript('mootools-filemanager/Source/Uploader.js', 'MootoolsFileManager'); } MootoolsFileManager.AssetLoader.loadStyle('MootoolsFileManager.css', 'MootoolsFileManager'); function MootoolsFileManager(editor) { this.editor = editor; var self = this; var cfg = editor.config; // Do a callback to the PHP backend and get it to "decode" the configuration for us into a // javascript object. Xinha._postback(editor.config.MootoolsFileManager.backend+'__function=read-config', editor.config.MootoolsFileManager.backend_data, function(phpcfg) { eval ('var f = '+phpcfg+';'); self.phpcfg = f; self.hookUpButtons(); }); return; }; /** Connect up/insert the appropriate buttons and load in the auxillary files. * * The different "modes" of this plugin have been split into several auxilliary files * as it's likely you may not want them all (esp if we add more modes later). * * Each mode's "include" is loaded as soon as we know it could be needed by the * editor, we don't wait until the button is pressed as that would be slow for * the user to respond. * */ MootoolsFileManager.prototype.hookUpButtons = function() { var self = this; var phpcfg = self.phpcfg; if (phpcfg.files_dir) { MootoolsFileManager.AssetLoader.loadScriptOnce('MootoolsFileManager.FileManager.js', 'MootoolsFileManager'); this.editor.config.registerButton({ id : "linkfile", tooltip : Xinha._lc("Insert File Link",'ExtendedFileManager'), image : Xinha.getPluginDir('ExtendedFileManager') + '/img/ed_linkfile.gif', textMode : false, action : function(editor) { MootoolsFileManager.AssetLoader.whenReady(function() { self.OpenFileManager(); }); } }); this.editor.config.addToolbarElement("linkfile", "createlink", 1); }; if(phpcfg.images_dir) { MootoolsFileManager.AssetLoader.loadScriptOnce('MootoolsFileManager.ImageManager.js', 'MootoolsFileManager'); // Override our Editors insert image button action. self.editor._insertImage = function() { MootoolsFileManager.AssetLoader.whenReady(function() { self.OpenImageManager(); }); } } }; /** Helper method to scale (an image typically) to a new constraint. * * @param origdim object { width: 123,height: 456 } The original dimensions. * @param newdim object { width: 456, height: 123 } The new (maximum) dimensions. * @param flexside 'width'|'height' (optional) the side which can be "flexible" * Defaults to the "short" side. * @return { width: 789, height: 987 } The scaled dimensions which should be used. */ MootoolsFileManager.prototype.ScaleImage = function( origdim, newdim, flexside ) { if(!origdim.height || !origdim.width) return newdim; // No old size, stays new. if(!newdim.height && !newdim.width) return origdim; // No new size, stays the same. if(!flexside) { if(origdim.width > origdim.height) { flexside = 'height'; // Landscape image, allow the height to flex. } else { flexside = 'width'; // Portrait image, allow the width to flex } } var knownside = null; switch(flexside) { case 'height': knownside = 'width'; break; case 'width' : knownside = 'height'; break; } // If we DON'T know the known side, we need to flip it. if(!newdim[knownside]) { var t = knownside; knownside = flexside; flexside = t; } var ratio = 0; switch(flexside) { case 'width': ratio = origdim.width / origdim.height; break; case 'height': ratio = origdim.height / origdim.width; break; } var rdim = {}; rdim[knownside] = newdim[knownside]; rdim[flexside] = Math.floor(newdim[knownside] * ratio); if(isNaN(rdim[knownside])) rdim[knownside] = null; if(isNaN(rdim[flexside])) rdim[flexside] = null; return rdim; } /** Take a multi-part CSS size specification (eg sizes for 4 borders) and * shrink it into one if possible. */ MootoolsFileManager.prototype.shortSize = function(cssSize) { if(/ /.test(cssSize)) { var sizes = cssSize.split(' '); var useFirstSize = true; for(var i = 1; i < sizes.length; i++) { if(sizes[0] != sizes[i]) { useFirstSize = false; break; } } if(useFirstSize) cssSize = sizes[0]; } return cssSize; }; /** Take a colour in rgb(a,b) format and convert to HEX * handles multiple colours in same string as well. */ MootoolsFileManager.prototype.convertToHex = function(color) { if (typeof color == "string" && /, /.test.color) color = color.replace(/, /, ','); // rgb(a, b) => rgb(a,b) if (typeof color == "string" && / /.test.color) { // multiple values var colors = color.split(' '); var colorstring = ''; for (var i = 0; i < colors.length; i++) { colorstring += Xinha._colorToRgb(colors[i]); if (i + 1 < colors.length) colorstring += " "; } return colorstring; } return Xinha._colorToRgb(color); }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/MootoolsFileManager.js
JavaScript
art
7,487
/** = Mootools File Manager = == File Manager == The functions in this file extend the MootoolsFileManager plugin with support for managing files (inserting a link to a file). This file is loaded automatically. * @author $Author$ * @version $Id$ * @package MootoolsFileManager */ // Open a "files" mode of the plugin to allow to select a file to // create a link to. MootoolsFileManager.prototype.OpenFileManager = function(link) { var editor = this.editor; var outparam = null; var self = this; if (typeof link == "undefined") { link = this.editor.getParentElement(); if (link) { if (/^img$/i.test(link.tagName)) link = link.parentNode; if (!/^a$/i.test(link.tagName)) link = null; } } // If the link wasn't provided, and no link is currently in focus, // make one from the selection. if (!link) { var sel = editor.getSelection(); var range = editor.createRange(sel); var compare = 0; if (Xinha.is_ie) { if ( sel.type == "Control" ) { compare = range.length; } else { compare = range.compareEndPoints("StartToEnd", range); } } else { compare = range.compareBoundaryPoints(range.START_TO_END, range); } if (compare == 0) { alert(Xinha._lc("You must select some text before making a new link.", 'MootoolsFileManager')); return; } outparam = { f_href : '', f_title : '', f_target : '', f_type: '', baseHref: editor.config.baseHref }; } else { outparam = { f_href : Xinha.is_ie ? link.href : link.getAttribute("href"), f_title : link.title, f_target : link.target, f_type : link.type ? link.type : '', baseHref: editor.config.baseHref }; } this.current_link = link; this.current_attributes = outparam; if(!this.FileManagerWidget) { this.FileManagerWidget = new FileManager({ url: this.editor.config.MootoolsFileManager.backend +'__function=file-manager&', assetBasePath: Xinha.getPluginDir('MootoolsFileManager')+'/mootools-filemanager/Assets', language: _editor_lang, selectable: true, uploadAuthData: this.editor.config.MootoolsFileManager.backend_data, onComplete: function(path, file) { self.FileManagerReturn(path,file); }, onHide: function() { if(this.swf && this.swf.box) this.swf.box.style.display = 'none'; }, onShow: function() { if(this.swf && this.swf.box) this.swf.box.style.display = ''; }, onDetails: function(details) { this.info.adopt(self.FileManagerAttributes(details)); return true; }, onHidePreview: function() { $(self.FileManagerAttributes().table).dispose(); return true; } }); } this.FileManagerWidget.show(); }; // Take the values from the file selection and make it (or update) a link MootoolsFileManager.prototype.FileManagerReturn = function(path, file) { var editor = this.editor; var a = this.current_link; var param = this.FileManagerAttributes(); param.f_href = path; if (!a) { try { editor._doc.execCommand("createlink", false, param.f_href); a = editor.getParentElement(); var sel = editor.getSelection(); var range = editor.createRange(sel); if (!Xinha.is_ie) { a = range.startContainer; if (!/^a$/i.test(a.tagName)) { a = a.nextSibling; if (a == null) { a = range.startContainer.parentNode; } } } } catch(e) {} } else { var href = param.f_href.trim(); editor.selectNodeContents(a); if (href == "") { editor._doc.execCommand("unlink", false, null); editor.updateToolbar(); return false; } else { a.href = href; } } if (!(a && /^a$/i.test(a.tagName))) { return false; } a.type = param.f_type.trim(); a.target = param.f_target.trim(); a.title = param.f_title.trim(); editor.selectNodeContents(a); editor.updateToolbar(); }; /** Return a DOM fragment which has all the fields needed to set the * attributes for a link given a structure of initial values. * * OR return a structure of values taken from the currently table. */ MootoolsFileManager.prototype.FileManagerAttributes = function (details) { var self = this; self._LastFileDetails = details; function f(name) { var e = self._FileManagerAttributesTable.getElementsByTagName('input'); for(var i = 0; i < e.length; i++) { if(e[i].name == name) return e[i]; } var e = self._FileManagerAttributesTable.getElementsByTagName('select'); for(var i = 0; i < e.length; i++) { if(e[i].name == name) return e[i]; } return null; } function s(name, value) { for(var i = 0; i < f(name).options.length; i++) { if(f(name).options[i].value == value) { // f(name).options[i].selected = true; f(name).selectedIndex = i; return true; } } return false; } if(!this._FileManagerAttributesTable) { this._FileManagerAttributesTable = (function() { var div = document.createElement('div'); var h2 = document.createElement('h2'); h2.appendChild(document.createTextNode('Link Attributes')); div.appendChild(h2); var table = document.createElement('table'); div.appendChild(table); table.className = 'filemanager-extended-options'; var tbody = table.appendChild(document.createElement('tbody')); { // Title var tr = tbody.appendChild(document.createElement('tr')); var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Title:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); td.colSpan = 6; input.name = 'f_title'; input.type = 'text'; th.className = td.className = 'filemanager-f_title'; } { // Content Type var tr = tbody.appendChild(document.createElement('tr')); var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Type:')); var td = tr.appendChild(document.createElement('td')); var input = td.appendChild(document.createElement('input')); td.colSpan = 6; input.name = 'f_type'; input.type = 'text'; th.className = td.className = 'filemanager-f_type'; } { // Target var tr = tbody.appendChild(document.createElement('tr')); { // Target var th = tr.appendChild(document.createElement('th')); var label = th.appendChild(document.createTextNode('Open In:')); var td = tr.appendChild(document.createElement('td')); td.colSpan = 2; var input = td.appendChild(document.createElement('select')); input.name = 'f_target'; input.options[0] = new Option(''); input.options[1] = new Option('New Window', '_blank'); input.options[2] = new Option('Top Frame', '_top'); input.options[3] = new Option('Other Frame:', ''); Xinha._addEvent(input, 'change', function() { if(f('f_target').selectedIndex == 3) { f('f_otherTarget').style.visibility = 'visible'; } else { f('f_otherTarget').style.visibility = 'hidden'; } }); var input = td.appendChild(document.createElement('input')); input.name = 'f_otherTarget'; input.size = 7; input.type = 'text'; input.style.visibility = 'hidden'; th.className = td.className = 'filemanager-f_target'; } } return div; })(); } if(this.current_attributes) { f('f_title').value = this.current_attributes.f_title; f('f_type').value = this.current_attributes.f_type; if(this.current_attributes.f_target) { if(!s('f_target', this.current_attributes.f_target)) { f('f_target').selectedIndex = 3; f('f_otherTarget').value = this.current_attributes.f_target; } else { f('f_otherTarget').value = ''; } } this.current_attributes = null; } // If no details were supplied, we return the current ones if(!details) { var details = { f_title: f('f_title').value, f_type: f('f_type').value, f_target: f('f_target').selectedIndex < 3 ? f('f_target').options[f('f_target').selectedIndex].value : f('f_otherTarget').value, table: this._FileManagerAttributesTable } return details; } // If details were supplied, we set the appropriate ones. if(details.mime) f('f_type').value = details.mime; f('f_target').style.visibility = ''; // Ensure that the select hasn't been hidden by an overlay and not put back if(f('f_target').selectedIndex == 3) { f('f_otherTarget').style.visibility = 'visible'; } else { f('f_otherTarget').style.visibility = 'hidden'; } return this._FileManagerAttributesTable; };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/MootoolsFileManager/MootoolsFileManager.FileManager.js
JavaScript
art
10,213
// Dynamic CSS (className) plugin for HTMLArea // Sponsored by http://www.systemconcept.de // Implementation by Holger Hees // // (c) systemconcept.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). function DynamicCSS(editor, args) { this.editor = editor; var cfg = editor.config; var self = this; /*var cssArray=null; var cssLength=0;*/ var lastTag=null; var lastClass=null; var css_class = { id : "DynamicCSS-class", tooltip : this._lc("Choose stylesheet"), options : {"":""}, action : function(editor) { self.onSelect(editor, this); }, refresh : function(editor) { self.updateValue(editor, this); } }; cfg.registerDropdown(css_class); cfg.addToolbarElement(["T[CSS]", "DynamicCSS-class", "separator"] , "formatblock", -1); } DynamicCSS.parseStyleSheet=function(editor){ iframe = editor._iframe.contentWindow.document; cssArray=DynamicCSS.cssArray; if(!cssArray) cssArray=new Array(); for(i=0;i<iframe.styleSheets.length;i++) { if(iframe.styleSheets[i].title == "XinhaInternalCSS") continue; // Mozilla if(Xinha.is_gecko){ try{ cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].cssRules,cssArray); } catch(e){ //alert(e); } } // IE else { try{ if(iframe.styleSheets[i].rules){ cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].rules,cssArray); } // @import StyleSheets (IE) if(iframe.styleSheets[i].imports){ for(j=0;j<iframe.styleSheets[i].imports.length;j++){ cssArray=DynamicCSS.applyCSSRule(iframe.styleSheets[i].imports[j].rules,cssArray); } } } catch(e){ //alert(e); } } } DynamicCSS.cssArray=cssArray; }; DynamicCSS.applyCSSRule=function(cssRules,cssArray){ for(rule in cssRules){ if(typeof cssRules[rule] == 'function') continue; // StyleRule if(cssRules[rule].selectorText){ if(cssRules[rule].selectorText.search(/:+/)==-1){ // split equal Styles (Mozilla-specific) e.q. head, body {border:0px} // for ie not relevant. returns allways one element cssElements = cssRules[rule].selectorText.split(","); for(k=0;k<cssElements.length;k++){ cssElement = cssElements[k].split("."); tagName=cssElement[0].toLowerCase().trim(); className=cssElement[1]; if(!tagName) tagName='all'; if(!cssArray[tagName]) cssArray[tagName]=new Array(); if(className){ if(tagName=='all') cssName=className; else cssName='<'+className+'>'; } else{ className='none'; if(tagName=='all') cssName=Xinha._lc("Default", 'DynamicCSS'); else cssName='<'+Xinha._lc("Default", 'DynamicCSS')+'>'; } cssArray[tagName][className]=cssName; DynamicCSS.cssLength++; } } } // ImportRule (Mozilla) else if(cssRules[rule].styleSheet){ cssArray=DynamicCSS.applyCSSRule(cssRules[rule].styleSheet.cssRules,cssArray); } } return cssArray; }; DynamicCSS._pluginInfo = { name : "DynamicCSS", version : "1.5.2", developer : "Holger Hees", developer_url : "http://www.systemconcept.de/", c_owner : "Holger Hees", sponsor : "System Concept GmbH", sponsor_url : "http://www.systemconcept.de/", license : "htmlArea" }; DynamicCSS.prototype._lc = function(string) { return Xinha._lc(string, 'DynamicCSS'); }; DynamicCSS.prototype.onSelect = function(editor, obj) { var tbobj = editor._toolbarObjects[obj.id]; var index = tbobj.element.selectedIndex; var className = tbobj.element.value; var parent = editor.getParentElement(); if(className!='none'){ parent.className=className; DynamicCSS.lastClass=className; } else{ if(Xinha.is_gecko) parent.removeAttribute('class'); else parent.removeAttribute('className'); } editor.updateToolbar(); }; /*DynamicCSS.prototype.onMode = function(mode) { if(mode=='wysiwyg'){ // reparse possible changed css files DynamicCSS.cssArray=null; this.updateValue(this.editor,this.editor.config.customSelects["DynamicCSS-class"]); } }*/ DynamicCSS.prototype.reparseTimer = function(editor, obj, instance) { // new attempt of rescan stylesheets in 1,2,4 and 8 second (e.g. for external css-files with longer initialisation) if(DynamicCSS.parseCount<9){ setTimeout(function () { DynamicCSS.cssLength=0; DynamicCSS.parseStyleSheet(editor); if(DynamicCSS.cssOldLength!=DynamicCSS.cssLength){ DynamicCSS.cssOldLength=DynamicCSS.cssLength; DynamicCSS.lastClass=null; instance.updateValue(editor, obj); } instance.reparseTimer(editor, obj, instance); },DynamicCSS.parseCount*1000); DynamicCSS.parseCount=DynamicCSS.parseCount*2; } }; DynamicCSS.prototype.updateValue = function(editor, obj) { cssArray=DynamicCSS.cssArray; // initial style init if(!cssArray){ DynamicCSS.cssLength=0; DynamicCSS.parseStyleSheet(editor); cssArray=DynamicCSS.cssArray; DynamicCSS.cssOldLength=DynamicCSS.cssLength; DynamicCSS.parseCount=1; this.reparseTimer(editor,obj,this); } var parent = editor.getParentElement(); var tagName = parent.tagName.toLowerCase(); var className = parent.className; if(this.lastTag!=tagName || this.lastClass!=className){ this.lastTag=tagName; this.lastClass=className; var select = editor._toolbarObjects[obj.id].element; while(select.length>0){ select.options[select.length-1] = null; } select.options[0]=new Option(this._lc("Default"),'none'); if(cssArray){ // style class only allowed if parent tag is not body or editor is in fullpage mode if(tagName!='body' || editor.config.fullPage){ if(cssArray[tagName]){ for(cssClass in cssArray[tagName]){ if(typeof cssArray[tagName][cssClass] != 'string') continue; if(cssClass=='none') select.options[0]=new Option(cssArray[tagName][cssClass],cssClass); else select.options[select.length]=new Option(cssArray[tagName][cssClass],cssClass); } } if(cssArray['all']){ for(cssClass in cssArray['all']){ if(typeof cssArray['all'][cssClass] != 'string') continue; select.options[select.length]=new Option(cssArray['all'][cssClass],cssClass); } } } else if(cssArray[tagName] && cssArray[tagName]['none']) select.options[0]=new Option(cssArray[tagName]['none'],'none'); } select.selectedIndex = 0; if (typeof className != "undefined" && /\S/.test(className)) { var options = select.options; for (var i = options.length; --i >= 0;) { var option = options[i]; if (className == option.value) { select.selectedIndex = i; break; } } if(select.selectedIndex == 0){ select.options[select.length]=new Option(this._lc("Undefined"),className); select.selectedIndex=select.length-1; } } if(select.length>1) select.disabled=false; else select.disabled=true; } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/DynamicCSS.js
JavaScript
art
8,647
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Sponsored by http://www.systemconcept.de // Author: Holger Hees, <hhees@systemconcept.de> // (c) systemconcept.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Default": "Default", "Undefined": "Ungedefinieerd", "Choose stylesheet": "Kies stylesheet" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/nl.js
JavaScript
art
389
// I18N constants // LANG: "de", ENCODING: UTF-8 // Sponsored by http://www.systemconcept.de // Author: Holger Hees, <hhees@systemconcept.de> // (c) systemconcept.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Default": "Standard", "Undefined": "Nicht definiert", "Choose stylesheet": "Wählen Sie einen StyleSheet aus" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/de.js
JavaScript
art
408
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Default": "Défaut", "Undefined": "Non défini", "Choose stylesheet": "Choisir feuille de style" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/fr.js
JavaScript
art
157
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Default": "なし", "Undefined": "未定義", "Choose stylesheet": "スタイルシートの選択" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/ja.js
JavaScript
art
160
// I18N constants // LANG: "nb", ENCODING: UTF-8 // translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com { "Default": "Standard", "Undefined": "Udefinert", "Choose stylesheet": "Velg stilsett" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/nb.js
JavaScript
art
220
// I18N constants // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // Last revision: 05 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Choose stylesheet": "Escolher estilo", "Default": "Padrão", "Undefined": "Indefinido" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/DynamicCSS/lang/pt_br.js
JavaScript
art
586
function InsertAnchor(editor) { this.editor = editor; var cfg = editor.config; var self = this; this.placeholderImg = '<img class="IA_placeholder" src="'+Xinha.getPluginDir("InsertAnchor")+'/img/placeholder.gif" />'; // register the toolbar buttons provided by this plugin cfg.registerButton({ id : "insert-anchor", tooltip : this._lc("Insert Anchor"), image : editor.imgURL("insert-anchor.gif", "InsertAnchor"), textMode : false, action : function() { self.show(); } }); cfg.addToolbarElement("insert-anchor", "createlink", 1); } InsertAnchor._pluginInfo = { name : "InsertAnchor", origin : "version: 1.0, by Andre Rabold, MR Printware GmbH, http://www.mr-printware.de", version : "2.0", developer : "Udo Schmal", developer_url : "http://www.schaffrath-neuemedien.de", c_owner : "Udo Schmal", sponsor : "L.N.Schaffrath NeueMedien", sponsor_url : "http://www.schaffrath-neuemedien.de", license : "htmlArea" }; InsertAnchor.prototype._lc = function(string) { return Xinha._lc(string, 'InsertAnchor'); }; InsertAnchor.prototype.onGenerate = function() { this.editor.addEditorStylesheet(Xinha.getPluginDir("InsertAnchor") + '/insert-anchor.css'); }; InsertAnchor.prototype.inwardHtml = function(html) { html= html.replace(/(<a[^>]*class="anchor"[^>]*>)/g,"$1"+this.placeholderImg); return html; } InsertAnchor.prototype.outwardHtml = function(html) { html= html.replace(/(<img[^>]*class="?IA_placeholder"?[^>]*>)/ig,""); return html; } InsertAnchor.prototype.onGenerateOnce = function() { this._prepareDialog(); }; InsertAnchor.prototype._prepareDialog = function() { var self = this; var editor = this.editor; if(!this.html) { Xinha._getback(Xinha.getPluginDir("InsertAnchor") + '/dialog.html', function(getback) { self.html = getback; self._prepareDialog(); }); return; } // Now we have everything we need, so we can build the dialog. this.dialog = new Xinha.Dialog(editor, this.html, 'InsertAnchor',{width:400}); this.dialog.getElementById('ok').onclick = function() {self.apply();} this.dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; this.ready = true; }; InsertAnchor.prototype.show = function() { if(!this.ready) // if the user is too fast clicking the, we have to make them wait { var self = this; window.setTimeout(function() {self.show();},100); return; } var editor = this.editor; this.selectedHTML = editor.getSelectedHTML(); var sel = editor.getSelection(); var range = editor.createRange(sel); this.a = editor.activeElement(sel); if(!(this.a != null && this.a.tagName.toLowerCase() == 'a')) { this.a = editor._getFirstAncestor(sel, 'a'); } if (this.a != null && this.a.tagName.toLowerCase() == 'a') { inputs = { name : this.a.id }; } else { inputs = { name : '' }; } this.dialog.show(inputs); this.dialog.getElementById("name").focus(); }; InsertAnchor.prototype.apply = function () { var editor = this.editor; var param = this.dialog.hide(); var anchor = param['name']; var a = this.a; var self = this; if (anchor == "" || anchor == null) { if (a) { var child = self.outwardHtml(a.innerHTML); a.parentNode.removeChild(a); editor.insertHTML(child); } return; } try { var doc = editor._doc; if (!a) { a = doc.createElement("a"); a.id = anchor; a.name = anchor; a.title = anchor; a.className = "anchor"; a.innerHTML = self.placeholderImg; var html = editor.getSelectedHTML(); if (html) a.innerHTML += html; if (Xinha.is_ie) { range.pasteHTML(a.outerHTML); } else { editor.insertNodeAtSelection(a); } } else { a.id = anchor; a.name = anchor; a.title = anchor; a.className = "anchor"; } } catch (e) { } }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/InsertAnchor.js
JavaScript
art
4,227
a.anchor { width: 18px; height: 18px; background-image: url(img/insert-anchor.gif); background-repeat: no-repeat; background-position: left top; border: 1px dotted blue; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/insert-anchor.css
CSS
art
184
<h1 id="[h1]"><l10n>Insert Anchor</l10n></h1> <div style="margin: 10px;"> <table border="0" style="width: 100%;"> <tr> <td class="label"><l10n>Anchor name</l10n></td> <td><input type="text" id="[name]" name="[name]" style="width: 80%" /></td> </tr> </table> </div> <div class="buttons"> <input type="button" id="[ok]" value="_(OK)" /> <input type="button" id="[cancel]" value="_(Cancel)" /> </div>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/dialog.html
HTML
art
422
// I18N constants // LANG: "de", ENCODING: UTF-8 // translated: Raimund Meyer xinha@ray-of-light.org { "Insert Anchor": "Anker invoegen", "Anchor name": "Naam (ID)", "Delete": "Verwijderen" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/nl.js
JavaScript
art
199
// I18N constants // LANG: "de", ENCODING: UTF-8 // translated: Raimund Meyer xinha@ray-of-light.org { "Insert Anchor": "Anker einfügen", "Anchor name": "Name (ID)", "Delete": "Löschen" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/de.js
JavaScript
art
197
// I18N constants // LANG: "pl", ENCODING: UTF-8 // translated: Krzysztof Kotowicz koto@webworkers.pl { "Insert Anchor": "Wstaw kotwicę", "Anchor name": "Nazwa kotwicy", "Delete": "Usuń" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/pl.js
JavaScript
art
198
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Insert Anchor": "Insérer une ancre", "Anchor name": "Nom de l'ancre", "Delete": "Supprimer" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/fr.js
JavaScript
art
153
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Insert Anchor": "アンカーの挿入", "Anchor name": "アンカーの名前", "Delete": "削除" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/ja.js
JavaScript
art
160
// I18N constants // LANG: "nb", ENCODING: UTF-8 // translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com { "Insert Anchor": "Sett inn anker", "Anchor name": "Ankernavn (ID)" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/nb.js
JavaScript
art
199
// I18N constants // // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // // Last revision: 06 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Anchor name": "Nome da âncora", "Cancel": "Cancelar", "Delete": "Deletar", "Insert Anchor": "Inserir Âncora", "OK": "OK" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/lang/pt_br.js
JavaScript
art
633
<html> <head> <title>Insert Anchor</title> <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" /> <script type="text/javascript" src="../../../popups/popup.js"></script> <script type="text/javascript"> window.resizeTo(400, 150); function Init() { __dlg_translate("InsertAnchor"); __dlg_init(); var param = window.dialogArguments; if (param) { document.getElementById("name").value = param["name"]; } document.getElementById("name").focus(); } function onOK() { // pass data back to the calling window var param = new Object(); param["name"] = document.getElementById("name").value; __dlg_close(param); return false; } function onDelete() { // pass data back to the calling window var param = new Object(); param["name"] = ""; __dlg_close(param); return false; } function onCancel() { __dlg_close(null); return false; } </script> </head> <body class="dialog" onload="Init()"> <div class="title">Insert Anchor</div> <form> <table border="0" style="width: 100%;"> <tr> <td class="label">Anchor name</td> <td><input type="text" id="name" style="width: 100%" /></td> </tr> </table> <div id="buttons"> <button type="submit" name="ok" onclick="return onOK();">OK</button> <button type="button" name="delete" onclick="return onDelete();">Delete</button> <button type="button" name="cancel" onclick="return onCancel();">Cancel</button> </div> </form> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertAnchor/popups/insert_anchor.html
HTML
art
1,451
// Plugin for htmlArea to insert keywords, when a type of // keyword is selected from a dropdown list // By Adam Wright, for The University of Western Australia // // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). function InsertWords(editor, params) { this.editor = editor; var cfg = editor.config; var self = this; if(params[0] && params[0].combos) { //if arguments where passed with registerPlugin use these var combos = params[0].combos; } else if (cfg.InsertWords && cfg.InsertWords.combos) { //if combos is found in config use these var combos = cfg.InsertWords.combos; } else { //no combos found var combos = []; } // register the toolbar with the keywords dropdown var first = true; var toolbar = []; for (var i = combos.length; --i >= 0;) { var combo = combos[i]; var id = "IW-id" + i; var iw_class = { id : id, options : combo.options, action : function (editor) { self.onSelect(editor, this, combo.context); }, refresh : function (editor) { }, context : combo.context }; cfg.registerDropdown(iw_class); if (combo.label) toolbar.push("T[" + combo.label + "]"); toolbar.push(id); toolbar.push(first ? "separator" : "space"); } cfg.addToolbarElement(toolbar, "linebreak", 1); } InsertWords._pluginInfo = { name : "InsertWords", version : "1.0", developer : "Adam Wright", developer_url : "http://blog.hipikat.org/", sponsor : "The University of Western Australia", sponsor_url : "http://www.uwa.edu.au/", license : "htmlArea" }; InsertWords.prototype.onSelect = function(editor, obj, context) { // Get the toolbar object element var elem = editor._toolbarObjects[obj.id].element; // Insert the keyword value blindly at the selection editor.insertHTML(elem.value); // Reset the dropdown to it's label elem.selectedIndex = 0; };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/InsertWords/InsertWords.js
JavaScript
art
1,991
/*---------------------------------------*\ Quick Tag Editor Plugin for HTMLArea-3.0 ----------------------------------------- author: Cau guanabara e-mail: caugb@ibest.com.br \*---------------------------------------*/ function QuickTag(editor) { var cfg = editor.config; var self = this; cfg.registerButton({ id : "quickeditor", tooltip : this._lc("Quick Tag Editor"), image : editor.imgURL("ed_quicktag.gif", "QuickTag"), textMode : false, action : function(editor) { self.buttonPress(editor); } }); cfg.addToolbarElement("quickeditor", "htmlmode", 1); } QuickTag.prototype.buttonPress = function(editor) { var self = this; var sel = editor.getSelectedHTML().replace(/(<[^>]*>|&nbsp;|\n|\r)/g,""); var param = new Object(); param.editor = editor; if(/\w/.test(sel)) editor._popupDialog("plugin://QuickTag/quicktag", function(p) { self.setTag(editor, p); }, param); else alert(this._lc('You have to select some text')); }; QuickTag.prototype.setTag = function(editor, param) { editor.surroundHTML(param.tagopen,param.tagclose); }; QuickTag._pluginInfo = { name : "QuickTag", version : "1.0 - beta", developer : "Cau Guanabara", developer_url : "mailto:caugb@ibest.com.br", c_owner : "Cau Guanabara", sponsor : "Independent production", sponsor_url : "http://www.netflash.com.br/gb/HA3-rc1/examples/quick-tag.html", license : "htmlArea" }; QuickTag.prototype._lc = function(string) { return Xinha._lc(string, 'QuickTag'); };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/QuickTag.js
JavaScript
art
1,607
/* TAG Library for QuickTag Plugin ------------------------------- allTags = All tags that appears in the first dropdown ('TAGS') {'caption': 'value'} tagLib = The tags with options (just to check if current TAG have options) {'[TAG]': true} subTagLib = Complements for some tags that needs it (TABLE) {'[TAG]': {'op': 'after tag open', 'cl': 'before tag close'}} opTag_all = Common attributes to all TAGS {'caption': 'value'} opAtt_all = Options for the common attributes {'attribute': {'caption': 'value'}} opTag_[TAG] = Attributes for [TAG] {'caption': 'value'} opAtt_[TAG] = Options for the [TAG] attributes {'attribute': {'caption': 'value'}} */ var allTags = { 'a': 'a', 'a (full)': 'a href="" target=""', 'address': 'address', 'b': 'b', 'big': 'big', 'blockquote': 'blockquote', 'code': 'code', 'div': 'div', 'em': 'em', 'fieldset': 'fieldset', 'font': 'font', 'font (full)': 'font face="" size="" color=""', 'h1': 'h1', 'h2': 'h2', 'h3': 'h3', 'h4': 'h4', 'h5': 'h5', 'h6': 'h6', 'i': 'i', 'legend': 'legend', 'li': 'li', 'ol': 'ol', 'ul': 'ul', 'p': 'p', 'pre': 'pre', 'small': 'small', 'span': 'span', 'strong': 'strong', 'sub': 'sub', 'sup': 'sup', 'table': 'table' }; // tags with options var tagLib = { 'a': true, 'div': true, 'font': true, 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 'p': true, 'table': true }; // tags that needs some complement var subTagLib = {'table': {'op': '<tbody><tr><td>', 'cl': '</td></tr></tbody>'} }; var opTag_a = { 'href': 'href="', 'name': 'name="', 'target': 'target="' }; var opAtt_a = { 'href': {'http://': 'http://', 'https://': 'https://', 'ftp://': 'ftp://', 'mailto:': 'mailto:', '#': '#"'}, 'target': {'_top': '_top"', '_self': '_self"', '_parent': '_parent"', '_blank': '_blank"'} }; var opTag_font = { 'face': 'face="', 'size': 'size="', 'color': 'color="' }; var opAtt_font = { 'face': {'Verdana': 'Verdana"', 'Arial': 'Arial"', 'Tahoma': 'Tahoma"', 'Courier New': 'Courier New"', 'Times New Roman': 'Times New Roman"'}, 'size': {'1': '1"','2': '2"','3': '3"','4': '4"','5': '5"','6': '6"', '+1': '+1"','+2': '+2"','+3': '+3"','+4': '+4"','+5': '+5"','+6': '+6"', '-1': '-1"','-2': '-2"','-3': '-3"','-4': '-4"','-5': '-5"','-6': '-6"'} }; var opTag_div = { 'align': 'align="' }; var opAtt_div = { 'align': {'center': 'center"', 'left': 'left"', 'right': 'right"', 'justify': 'justify"'} }; var opTag_h = { 'align': 'align="' }; var opAtt_h = { 'align': {'center': 'center"', 'left': 'left"', 'right': 'right"', 'justify': 'justify"'} }; var opTag_p = { 'align': 'align="' }; var opAtt_p = { 'align': {'center': 'center"', 'left': 'left"', 'right': 'right"', 'justify': 'justify"'} }; var opTag_table = { 'align': 'align="', 'width': 'width="', 'height': 'height="', 'cellpadding': 'cellpadding="', 'cellspacing': 'cellspacing="', 'background': 'background="', 'bgcolor': 'bgcolor="', 'border': 'border="', 'bordercolor': 'bordercolor="', 'bordercolorlight': 'bordercolorlight="', 'bordercolordark': 'bordercolordark="' }; var opAtt_table = { 'align': {'center': 'center"', 'left': 'left"', 'right': 'right"'} }; // for all tags var opTag_all = { 'class': 'class="', 'dir': 'dir="', 'id': 'id="', 'lang': 'lang="', 'onFocus': 'onFocus="', 'onBlur': 'onBlur="', 'onClick': 'onClick="', 'onDblClick': 'onDblClick="', 'onMouseDown': 'onMouseDown="', 'onMouseUp': 'onMouseUp="', 'onMouseOver': 'onMouseOver="', 'onMouseMove': 'onMouseMove="', 'onMouseOut': 'onMouseOut="', 'onKeyPress': 'onKeyPress="', 'onKeyDown': 'onKeyDown="', 'onKeyUp': 'onKeyUp="', 'style': 'style="', 'title': 'title="' }; var opAtt_all = { 'class': {}, 'dir': {'rtl': 'rtl"','ltr': 'ltr"'}, 'lang': {'Afrikaans ': 'af"', 'Albanian ': 'sq"', 'Arabic ': 'ar"', 'Basque ': 'eu"', 'Breton ': 'br"', 'Bulgarian ': 'bg"', 'Belarusian ': 'be"', 'Catalan ': 'ca"', 'Chinese ': 'zh"', 'Croatian ': 'hr"', 'Czech ': 'cs"', 'Danish ': 'da"', 'Dutch ': 'nl"', 'English ': 'en"', 'Estonian ': 'et"', 'Faeroese ': 'fo"', 'Farsi ': 'fa"', 'Finnish ': 'fi"', 'French ': 'fr"', 'Gaelic ': 'gd"', 'German ': 'de"', 'Greek ': 'el"', 'Hebrew ': 'he"', 'Hindi ': 'hi"', 'Hungarian ': 'hu"', 'Icelandic ': 'is"', 'Indonesian ': 'id"', 'Italian ': 'it"', 'Japanese ': 'ja"', 'Korean ': 'ko"', 'Latvian ': 'lv"', 'Lithuanian ': 'lt"', 'Macedonian ': 'mk"', 'Malaysian ': 'ms"', 'Maltese ': 'mt"', 'Norwegian ': 'no"', 'Polish ': 'pl"', 'Portuguese ': 'pt"', 'Rhaeto-Romanic ': 'rm"', 'Romanian ': 'ro"', 'Russian ': 'ru"', 'Sami ': 'sz"', 'Serbian ': 'sr"', 'Setswana ': 'tn"', 'Slovak ': 'sk"', 'Slovenian ': 'sl"', 'Spanish ': 'es"', 'Sutu ': 'sx"', 'Swedish ': 'sv"', 'Thai ': 'th"', 'Tsonga ': 'ts"', 'Turkish ': 'tr"', 'Ukrainian ': 'uk"', 'Urdu ': 'ur"', 'Vietnamese ': 'vi"', 'Xhosa ': 'xh"', 'Yiddish ': 'yi"', 'Zulu': 'zu"'}, 'style': {'azimuth': 'azimuth: ', 'background': 'background: ', 'background-attachment': 'background-attachment: ', 'background-color': 'background-color: ', 'background-image': 'background-image: ', 'background-position': 'background-position: ', 'background-repeat': 'background-repeat: ', 'border': 'border: ', 'border-bottom': 'border-bottom: ', 'border-left': 'border-left: ', 'border-right': 'border-right: ', 'border-top': 'border-top: ', 'border-bottom-color': 'border-bottom-color: ', 'border-left-color': 'border-left-color: ', 'border-right-color': 'border-right-color: ', 'border-top-color': 'border-top-color: ', 'border-bottom-style': 'border-bottom-style: ', 'border-left-style': 'border-left-style: ', 'border-right-style': 'border-right-style: ', 'border-top-style': 'border-top-style: ', 'border-bottom-width': 'border-bottom-width: ', 'border-left-width': 'border-left-width: ', 'border-right-width': 'border-right-width: ', 'border-top-width': 'border-top-width: ', 'border-collapse': 'border-collapse: ', 'border-color': 'border-color: ', 'border-style': 'border-style: ', 'border-width': 'border-width: ', 'bottom': 'bottom: ', 'caption-side': 'caption-side: ', 'cell-spacing': 'cell-spacing: ', 'clear': 'clear: ', 'clip': 'clip: ', 'color': 'color: ', 'column-span': 'column-span: ', 'content': 'content: ', 'cue': 'cue: ', 'cue-after': 'cue-after: ', 'cue-before': 'cue-before: ', 'cursor': 'cursor: ', 'direction': 'direction: ', 'display': 'display: ', 'elevation': 'elevation: ', 'filter': 'filter: ', 'float': 'float: ', 'font-family': 'font-family: ', 'font-size': 'font-size: ', 'font-size-adjust': 'font-size-adjust: ', 'font-style': 'font-style: ', 'font-variant': 'font-variant: ', 'font-weight': 'font-weight: ', 'height': 'height: ', '!important': '!important: ', 'left': 'left: ', 'letter-spacing': 'letter-spacing: ', 'line-height': 'line-height: ', 'list-style': 'list-style: ', 'list-style-image': 'list-style-image: ', 'list-style-position': 'list-style-position: ', 'list-style-type': 'list-style-type: ', 'margin': 'margin: ', 'margin-bottom': 'margin-bottom: ', 'margin-left': 'margin-left: ', 'margin-right': 'margin-right: ', 'margin-top': 'margin-top: ', 'marks': 'marks: ', 'max-height': 'max-height: ', 'min-height': 'min-height: ', 'max-width': 'max-width: ', 'min-width': 'min-width: ', 'orphans': 'orphans: ', 'overflow': 'overflow: ', 'padding': 'padding: ', 'padding-bottom': 'padding-bottom: ', 'padding-left': 'padding-left: ', 'padding-right': 'padding-right: ', 'padding-top': 'padding-top: ', 'page-break-after': 'page-break-after: ', 'page-break-before': 'page-break-before: ', 'pause': 'pause: ', 'pause-after': 'pause-after: ', 'pause-before': 'pause-before: ', 'pitch': 'pitch: ', 'pitch-range': 'pitch-range: ', 'play-during': 'play-during: ', 'position': 'position: ', 'richness': 'richness: ', 'right': 'right: ', 'row-span': 'row-span: ', 'size': 'size: ', 'speak': 'speak: ', 'speak-date': 'speak-date: ', 'speak-header': 'speak-header: ', 'speak-numeral': 'speak-numeral: ', 'speak-punctuation': 'speak-punctuation: ', 'speak-time': 'speak-time: ', 'speech-rate': 'speech-rate: ', 'stress': 'stress: ', 'table-layout': 'table-layout: ', 'text-align': 'text-align: ', 'text-decoration': 'text-decoration: ', 'text-indent': 'text-indent: ', 'text-shadow': 'text-shadow: ', 'text-transform': 'text-transform: ', 'top': 'top: ', 'vertical-align': 'vertical-align: ', 'visibility': 'visibility: ', 'voice-family': 'voice-family: ', 'volume': 'volume: ', 'white-space': 'white-space: ', 'widows': 'widows: ', 'width': 'width: ', 'word-spacing': 'word-spacing: ', 'z-index': 'z-index: ' } }; // add the common items to all objects for(var i in tagLib) { i = i.replace(/^h[1-6]$/,"h"); // h1 .. h6 for(var j in opTag_all) eval('opTag_'+i+'["'+j+'"] = opTag_all["'+j+'"];'); for(var j in opAtt_all) eval('opAtt_'+i+'["'+j+'"] = opAtt_all["'+j+'"];'); }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/tag-lib.js
JavaScript
art
10,999
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Author: Maarten Molenschot, maarten@nrgmm.nl { "Quick Tag Editor": "Quick Tag Editor", "Enter the TAG you want to insert": "Voer de Tag naam in", "You have to select some text": "Selecteer tekst", "There are some unclosed quote": "Er zijn niet gesloten quotes", "This attribute already exists in the TAG": "Dit attribuut bestaat al in de tag", "No CSS class avaiable": "Geen CSS class beschikbaar", "OPTIONS": "OPTIES", "ATTRIBUTES": "ATTRIBUTEN", "TAGs": "TAGs", "Colors": "Kleuren", "Ok": "Ok", "Cancel": "Annuleren" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/nl.js
JavaScript
art
614
// I18N constants // LANG: "de", ENCODING: UTF-8 { "Quick Tag Editor": "Quick TAG Editor", "Enter the TAG you want to insert": "Enter the TAG you want to insert", "You have to select some text": "You have to select some text", "There are some unclosed quote": "There are some unclosed quote", "This attribute already exists in the TAG": "This attribute already exists in the TAG", "No CSS class avaiable": "No CSS classes avaiable", "OPTIONS": "OPTIONS", "ATTRIBUTES": "ATTRIBUTES", "TAGs": "TAGs", "Colors": "Colors", "Ok": "Ok", "Cancel": "Cancel" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/de.js
JavaScript
art
578
// I18N constants // LANG: "pl", ENCODING: UTF-8 // translated: Krzysztof Kotowicz, http://www.eskot.krakow.pl/portfolio/, koto@webworkers.pl { "Quick Tag Editor": "Edytor Quick Tag", "Enter the TAG you want to insert": "Podaj TAG, który chcesz wstawić", "You have to select some text": "Musisz zaznaczyć tekst.", "There are some unclosed quote": "Są jakieś niezamknięte cudzysłowia", "This attribute already exists in the TAG": "TAG posiada już ten atrybut", "No CSS class avaiable": "Brak dostępnych klas CSS", "OPTIONS": "OPCJE", "ATTRIBUTES": "ATRYBUTY", "TAGs": "TAGi", "Colors": "Kolory", "Ok": "Ok", "Cancel": "Anuluj" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/pl.js
JavaScript
art
663
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Quick Tag Editor": "Editeur rapide de balise", "Enter the TAG you want to insert": "Entrez la balise que vous voulez insérer", "You have to select some text": "Vous devez sélectionner du texte", "There are some unclosed quote": "Il y a des apostrophes mal fermées", "This attribute already exists in the TAG": "Cet attribute existe déjà sur cette balise", "No CSS class avaiable": "Pas de classe CSS accessible", "OPTIONS": "OPTIONS", "ATTRIBUTES": "ATTRIBUTS", "TAGs": "Balises", "Colors": "Couleurs", "Ok": "OK", "Cancel": "Annuler" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/fr.js
JavaScript
art
619
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Quick Tag Editor": "クイックタグエディタ", "Enter the TAG you want to insert": "挿入したいタグを入力", "You have to select some text": "テキストを選択しなければなりません", "There are some unclosed quote": "閉じていない引用符があります", "This attribute already exists in the TAG": "タグにはすでに同じ属性があります", "No CSS class avaiable": "CSSクラスがありません", "OPTIONS": "選択肢", "ATTRIBUTES": "属性", "TAGs": "タグ", "Colors": "色", "Ok": "OK", "Cancel": "中止" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/ja.js
JavaScript
art
636
// I18N constants // LANG: "nb", ENCODING: UTF-8 // translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com { "Quick Tag Editor": "Kjapp TAGG-Editor", "Enter the TAG you want to insert": "Skriv inn taggen du vil ønsker å sette inn", "You have to select some text": "Du må velge noe tekst", "There are some unclosed quote": "Det mangler et hermetegn", "This attribute already exists in the TAG": "Denne attributten eksisterer allerede i taggen", "No CSS class avaiable": "Ingen CSS klasse tilgjengelig", "OPTIONS": "EGENSKAPER", "ATTRIBUTES": "ATTRIBUTTER", "TAGs": "TAGGer", "Colors": "Farger", "Ok": "OK", "Cancel": "Avbryt" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/nb.js
JavaScript
art
672
// I18N constants // // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // // Last revision: 06 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt) { "Quick Tag Editor": "Editor Rápido", "Enter the TAG you want to insert": "Entre com a TAG que deseja inserir", "You have to select some text": "É preciso selecionar algum texto", "No CSS class avaiable": "Não há classes CSS disponível", "There are some unclosed quote": "Há uma ou mais aspas sem fechamento", "This attribute already exists in the TAG": "Esse atributo já existe na TAG", "OPTIONS": "OPÇÕES", "ATTRIBUTES": "ATRIBUTOS", "TAGs": "TAGs", "Colors": "Cores", "Ok": "Ok", "Cancel": "Cancelar" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/lang/pt_br.js
JavaScript
art
1,035
<html> <head> <title>Quick Tag Editor</title> <script type="text/javascript" src="../tag-lib.js"></script> <script type="text/javascript" src="../../../popups/popup.js"></script> <script type="text/javascript"> window.resizeTo(400, 180); var QuickTag = window.opener.QuickTag; var curTag = 'none'; var curTagOpt = false; var CSSEdit = false; var editor = null; function Init() { __dlg_translate("QuickTag"); __dlg_init(); var param = window.dialogArguments; editor = param['editor']; var selectext = param['selectedText']; // sem uso... createDropdown("tags"); var to = document.getElementById('tagopen'); if (document.all) to.attachEvent("onkeypress", function(e) { choice_dropdown(e) }); else to.addEventListener("keypress", function(e) { choice_dropdown(e) }, true); to.focus(); document.getElementById('bt_colors').style.display = 'none'; document.body.onkeypress = __dlg_key_press; } function onCancel() { __dlg_close(null); return false; } function quoteTest(val) { var er = /^\w+\s*(\w+=\"[^\"]*\"\s*|\w+=\'[^\']*\'\s*)*$/; return er.test(val); } function onOK() { var el = document.getElementById('tagopen'); if(!el.value) { alert(HTMLArea._lc("Enter the TAG you want to insert", "QuickTag")); el.focus(); return false; } if(!quoteTest(el.value)) { alert(HTMLArea._lc("There are some unclosed quote", "QuickTag")); el.focus(); el.select(); return false; } var param = {}; var cleanTO = document.getElementById('tagopen').value.replace(/(<|>)/g,""); param.tagopen = "<"+cleanTO+">"; param.tagclose = param.tagopen.replace(/^<(\w+) ?.*>/,"</$1>"); var subtag = subTagLib[curTag]; if(typeof subtag == 'object') { param.tagopen = param.tagopen+subtag.op; param.tagclose = subtag.cl+param.tagclose; } __dlg_close(param); return false; } function __dlg_key_press(ev) { ev || (ev = window.event); switch(ev.keyCode) { case 13: document.getElementById('bt_ok').click(); break; case 27: __dlg_close(); return false; } return true; } function selchange() { var toadd = document.getElementById('selectag').value; var oldval = document.getElementById('tagopen').value; var text = (oldval+toadd).replace(/^\s*(.+)\s*$/,"$1"); var atrib = /(\w+)=\"$/.test(toadd) ? toadd.replace(/(\w+)=\"$/, "$1") : null; var showcolors = (/color\: ?$/.test(toadd)) ? true : false; var noCSSclasses = false; var obj = null; curTag = text.replace(/(^\w+) ?.*$/, "$1"); curTagOpt = (tagLib[curTag] == true); if(atrib) { var atrer = eval('/'+atrib+'=/ig'); if(atrer.test(oldval) && !(/[^=]\"$/.test(toadd))) { alert(HTMLArea._lc("This attribute already exists in the TAG", "QuickTag")); return false; } switch(atrib) { case 'style': CSSEdit = true; break; case 'class': if(captureClasses() == 0) noCSSclasses = true; break; case 'color': case 'bgcolor': case 'bordercolor': case 'bordercolorlight': case 'bordercolordark': showcolors = true; break; } if(curTagOpt == true) obj = eval('opAtt_'+curTag+'["'+atrib+'"]'); else obj = opAtt_all[atrib]; } else if(!CSSEdit && (/(^\w+$|\"$)/.test(toadd))) { obj = 'all'; if(curTagOpt == true) obj = curTag; toadd += ' '; } if(CSSEdit && quoteTest(text)) CSSEdit = false; if(showcolors) document.getElementById('bt_colors').style.display = ''; if(obj) createDropdown(obj); else if(!CSSEdit) document.getElementById('showselect').style.visibility = 'hidden'; if(noCSSclasses) { document.getElementById('showselect').innerHTML = HTMLArea._lc("No CSS class avaiable", "QuickTag"); document.getElementById('showselect').style.visibility = 'visible'; } addchanges(); function addchanges() { document.getElementById('tagopen').focus(); document.getElementById('tagopen').value += toadd; } } function captureClasses() { var cont = 0; // If there is no '<HTML>' in the HTMLArea content, when using // styleSheets[..].rule, IE generates an error. // In this case, we lost the classes in external CSS files. // If FullPage is loaded, there is no problem. if(!(/<\s*html\s*>/i.test(editor.getHTML())) && document.all) { var styles = editor._doc.getElementsByTagName("style"); for(var i in styles) { var cont = styles[i].innerHTML; if(typeof cont != 'undefined') { var cls = cont.match(/\.\w+/ig,""); for(j in cls) if(/^\.\w+$/.test(cls[j])) { var classname = cls[j].replace(/\./,"")+'"'; opAtt_all['class'][cls[j]] = classname; cont++; } } } return cont; } var styleSheet = null; var styles = editor._doc.styleSheets; for (var i = 0; i < styles.length; i++) { styleSheet = styles[i]; if(document.all) var _rules = styleSheet.rules; else var _rules = styleSheet.cssRules; for (var j = 0; j < _rules.length; j++) { rule = _rules[j]; if(/^\.\w+$/.test(rule.selectorText)) { var classname = rule.selectorText.replace(/\./,"")+'"'; opAtt_all['class'][rule.selectorText] = classname; cont++; } } } return cont; } function choice_dropdown(e) { if (document.all) Key = e.keyCode; else Key = e.charCode; if(Key != 32) return; var text = document.getElementById('tagopen').value.replace(/^\s*([^\s]+)\s*$/,"$1"); if(CSSEdit && quoteTest(text)) CSSEdit = false; if(CSSEdit) return; if(curTag == 'none') { curTag = text.replace(/(^\w+) ?.*$/, "$1"); curTagOpt = tagLib[curTag]; } if(!/\w/.test(text)) { document.getElementById('tagopen').value = ''; createDropdown("tags"); return; } var att = 'all'; if(curTagOpt == true) att = curTag; createDropdown(att); } function createDropdown(type) { var _div = document.getElementById('showselect'); while(_div.hasChildNodes()) _div.removeChild(_div.firstChild); _div.style.visibility = 'visible'; var _sel = document.createElement("select"); _sel.id = "selectag"; _sel.onchange = function() { selchange(); }; if(typeof type == 'object') { var obj = type; forObj(HTMLArea._lc("OPTIONS", "QuickTag")); _div.appendChild(_sel); return; } if(type == 'tags') { var obj = allTags; forObj(HTMLArea._lc("TAGs", "QuickTag")); _div.appendChild(_sel); return; } type = type.replace(/^h[1-6]$/,"h"); var topt = eval('opTag_'+type); if(typeof topt == 'object') var obj = topt; else return; forObj(HTMLArea._lc("ATTRIBUTES", "QuickTag")); _div.appendChild(_sel); function forObj(first) { if(first) { var _op = document.createElement("option"); _op.appendChild(document.createTextNode(first)); _sel.appendChild(_op); } for(i in obj) { var opt = document.createElement("option"); opt.appendChild(document.createTextNode(i)); opt.value = obj[i]; _sel.appendChild(opt); } } } function colors() { var colloc = window.location.toString().replace(/plugins.+$/,"") + "popups/select_color.html"; window.open(colloc, 'colors', "toolbar=no,location=no,directories=no," + "status=no,menubar=no,scrollbars=no,resizable=no,width=240,height=182"); } // simulation of Dialog._return - select_color.html needs it. var Dialog = new Object(); Dialog._return = function (val) { if(val != null) { if(CSSEdit) val += '; '; else val += '"'; document.getElementById('tagopen').focus(); document.getElementById('tagopen').value += "#"+val; document.getElementById('bt_colors').style.display = 'none'; } }; </script> <style type="text/css"> html, body { background: ButtonFace; color: ButtonText; font: 11px Tahoma,Verdana,sans-serif; margin: 0px; padding: 0px; border-width: 0px; } body { padding: 5px; } table { font: 11px Tahoma,Verdana,sans-serif; } select, input, button { font: 11px Tahoma,Verdana,sans-serif; } button { width: 70px; } .space { padding: 2px; } .title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px; } .buttons { border-top: 1px solid #999; padding: 5px; text-align: right; height: 20px; } form { padding: 0px; margin: 0px; } </style> </head> <body class="dialog" onload="Init()"> <form action="" method="get"> <div class="title" style="width: 360px">Quick Tag Editor</div> <div style="text-align: center;"> <table border="0" width="370"> <tbody> <tr> <td colspan="2" style="text-align: center;" style="padding: 3px; background-color: #e9e9e9;"> <strong style="font-size: 14px">&lt;</strong> <input id="tagopen" type="text" style="background-color: #e9e9e9; width: 327px; border-width: 0px;"> <strong style="font-size: 14px">&gt;</strong> </td> </tr> </tbody> </table> </div> <div class="space"></div> <div class="buttons"> <button type="button" id="bt_colors" onclick="colors();">Colors</button> <button type="button" id="bt_ok" onclick="return onOK();">Ok</button> <button type="button" onclick="return onCancel();">Cancel</button> </div> <div id="showselect" style="position:absolute; left:7px; top:75px; width:150px; z-index:100; visibility: visible; height: 13px; color: red;"> </div> </form> </body> </html>
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/QuickTag/popups/quicktag.html
HTML
art
9,429
/** CSS Picker Plugin by Justin Rovang * * For full documentation, please see * http://bitbucket.org/rovangju/xinha_csspicker/wiki/Home * * SAMPLE CONFIG: * * You can configure the appearance of the item/style list using the following CSS classes: * .CSSPickerOption (Normal state) * .CSSPickerOptionOver (Mouse-over state, typically border change) * .CSSPickerOptionActive (Indicator for active classes under the selection/carat) * * Keys are CSS Class names * wrapper: tag to wrap selected text with * name: friendly name to display in panel with that class style applied to it. * * Sample config: * CSSPicker.cssList = { * 'xinhaDashedBox' : { 'wrapper':'div', 'name':'Breakout box' } * 'xinhaMiniHeadline' : { 'wrapper':'div', 'name':'Sub-headline' } * } * */ function CSSPicker(editor, args) { this.editor = editor; var CSSPicker = this; } CSSPicker._pluginInfo = { name : "CSSPicker", version : "2008-12-01", author : "Justin Rovang" } CSSPicker.prototype.onGenerateOnce = function() { var editor = this.editor; var CSSPicker = this; editor._cssPicker = editor.addPanel("right"); this.main = document.createElement("div"); editor._cssPicker.style.backgroundColor='#dee5f8'; editor._cssPicker.appendChild(this.main); Xinha.freeLater(this,"main"); editor.showPanel(editor._cssPicker); } CSSPicker.prototype.onUpdateToolbar = function() { if(this.editor._cssPicker) { if(this._timeoutID) window.clearTimeout(this._timeoutID); var e = this.editor; this._timeoutID = window.setTimeout(function() { e._gen(); }, 250); //1000 = 1sec / 500=.5sec / 250=.25sec } } Xinha.prototype.listStyles = function(s) { var editor = this; var mySel = this.getSelection(); var myRange; if(Xinha.is_ie) { myRange = this.saveSelection();//mySel; mySel = this.createRange(mySel).text; } var d = document.createElement("div"); d.className='CSSPickerOption'; /* If our carat is within an active class, highlight it */ var toggleState = editor.getStyleInfo(s); if(toggleState) Xinha._addClass(d, 'CSSPickerOptionActive'); d.align='center'; d.innerHTML='<div class="'+s+'">'+CSSPicker.cssList[s].name+'</div>'; d.onclick = function() { editor.wrapStyle(s, mySel, myRange, CSSPicker.cssList[s].wrapper); return false; }; Xinha._addEvent(d, 'mouseover', function(ev) { Xinha._addClass(d, 'CSSPickerOptionOver'); }); Xinha._addEvent(d, 'mouseout', function(ev) { Xinha._removeClass(d, 'CSSPickerOptionOver'); }); return d; } Xinha.prototype._gen = function() { this.plugins.CSSPicker.instance.main.innerHTML=''; for(var s in CSSPicker.cssList) { this.plugins.CSSPicker.instance.main.appendChild(this.listStyles(s)); } return true; } /* (string) s: style name (string) sel: selection text (object) myRange: selection object (string) sWrapper: wrapper tag (e.g.: div, span) */ Xinha.prototype.wrapStyle = function(s, sel, myRange, sWrapper) { if(!sWrapper) sWrapper="div"; sWrapper=sWrapper.toLowerCase(); /* The reason for these next lines is that we want the user to be able to place * their cursor below the new div element. Otherwise they can't which makes * placing anything after a div wrapper difficult/almost impossible. */ var divBreak=''; if(sWrapper=="div") divBreak='<br/>'; var editor=this; this.focusEditor(); if(Xinha.is_ie) this.restoreSelection(myRange); /* * First - Get parent elements and see if the style is already applied. */ var toggleState = editor.getStyleInfo(s); if(!toggleState) { /* Create a new wrapper when: * 1. Selected text has no 'snug' wrapper around it already. * 2. If it does have a 'snug' wrapper, only append to the className if it's of the same type (span or div) */ if(sel == '') sel = '&nbsp;'; //We insert this if the selection is empty, making it easier for carat placement via click this.insertHTML("<"+sWrapper+" class='"+s+"'>"+sel+"</"+sWrapper+">"+divBreak); /* Modify the 'snug' wrapper if the above conditions are not met for a new element: */ } else { /* 1. If the current ancestor has -just- this classname. It should be removed. * 2. If it has more than one class, it should be removed from the list of the parents */ Xinha._removeClass(toggleState, s); } return true; } Xinha.prototype.getStyleInfo = function(sClassToProbe) { var editor = this; var aList = this.getAllAncestors(); var a,s; if(aList) aList.pop(); //We don't want the body element to show up in this list. if(aList.length > 0) { for(var o in aList){ a = aList[o]; /* Instead of break down and rebuild the array for this search, we're going * to do some string trickery... * // NOTE: THIS MAY BE PRONE TO PARTIAL MATCHES. SOLUTION IS TO ADD A SPACE PREPEND */ if(a.className) { s = a.className.trim()+' '; if(s.toLowerCase().match(sClassToProbe.toLowerCase()+' ')) { return a; } } } } return false; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CSSPicker/CSSPicker.js
JavaScript
art
4,934
/** * Add an empty css_style to Config object's prototype * the format is { '.className' : 'Description' } */ Xinha.Config.prototype.css_style = { }; /** * This method loads an external stylesheet and uses it in the stylist * * @param string URL to the stylesheet * @param hash Alternate descriptive names for your classes * { '.fooclass': 'Foo Description' } * @param bool If set true then @import rules in the stylesheet are skipped, * otherwise they will be incorporated if possible. */ Xinha.Config.prototype.stylistLoadStylesheet = function(url, altnames, skip_imports) { if(!altnames) altnames = { }; var newStyles = Xinha.ripStylesFromCSSFile(url, skip_imports); for(var i in newStyles) { if(altnames[i]) { this.css_style[i] = altnames[i]; } else { this.css_style[i] = newStyles[i]; } } for(var x = 0; x < this.pageStyleSheets.length; x++) { if(this.pageStyleSheets[x] == url) return; } this.pageStyleSheets[this.pageStyleSheets.length] = url; }; /** * This method takes raw style definitions and uses them in the stylist * * @param string CSS * * @param hash Alternate descriptive names for your classes * { '.fooclass': 'Foo Description' } * * @param bool If set true then @import rules in the stylesheet are skipped, * otherwise they will be incorporated if possible. * * @param string If skip_imports is false, this string should contain * the "URL" of the stylesheet these styles came from (doesn't matter * if it exists or not), it is used when resolving relative URLs etc. * If not provided, it defaults to Xinha.css in the Xinha root. */ Xinha.Config.prototype.stylistLoadStyles = function(styles, altnames, skip_imports, imports_relative_to) { if(!altnames) altnames = { }; var newStyles = Xinha.ripStylesFromCSSString(styles, skip_imports); for(var i in newStyles) { if(altnames[i]) { this.css_style[i] = altnames[i]; } else { this.css_style[i] = newStyles[i]; } } this.pageStyle += styles; }; /** * Fill the stylist panel with styles that may be applied to the current selection. Styles * are supplied in the css_style property of the Xinha.Config object, which is in the format * { '.className' : 'Description' } * classes that are defined on a specific tag (eg 'a.email_link') are only shown in the panel * when an element of that type is selected. * classes that are defined with selectors/psuedoclasses (eg 'a.email_link:hover') are never * shown (if you have an 'a.email_link' without the pseudoclass it will be shown of course) * multiple classes (eg 'a.email_link.staff_member') are shown as a single class, and applied * to the element as multiple classes (class="email_link staff_member") * you may click a class name in the stylist panel to add it, and click again to remove it * you may add multiple classes to any element * spans will be added where no single _and_entire_ element is selected */ Xinha.prototype._fillStylist = function() { if(!this.plugins.Stylist.instance.dialog) return false; var main = this.plugins.Stylist.instance.dialog.main; main.innerHTML = ''; var may_apply = true; var sel = this._getSelection(); // What is applied // var applied = this._getAncestorsClassNames(this._getSelection()); // Get an active element var active_elem = this._activeElement(sel); for(var x in this.config.css_style) { var tag = null; var className = x.trim(); var applicable = true; var apply_to = active_elem; if(applicable && /[^a-zA-Z0-9_.-]/.test(className)) { applicable = false; // Only basic classes are accepted, no selectors, etc.. presumed // that if you have a.foo:visited you'll also have a.foo // alert('complex'); } if(className.indexOf('.') < 0) { // No class name, just redefines a tag applicable = false; } if(applicable && (className.indexOf('.') > 0)) { // requires specific html tag tag = className.substring(0, className.indexOf('.')).toLowerCase(); className = className.substring(className.indexOf('.'), className.length); // To apply we must have an ancestor tag that is the right type if(active_elem != null && active_elem.tagName.toLowerCase() == tag) { applicable = true; apply_to = active_elem; } else { if(this._getFirstAncestor(this._getSelection(), [tag]) != null) { applicable = true; apply_to = this._getFirstAncestor(this._getSelection(), [tag]); } else { // alert (this._getFirstAncestor(this._getSelection(), tag)); // If we don't have an ancestor, but it's a div/span/p/hx stle, we can make one if(( tag == 'div' || tag == 'span' || tag == 'p' || (tag.substr(0,1) == 'h' && tag.length == 2 && tag != 'hr'))) { if(!this._selectionEmpty(this._getSelection())) { applicable = true; apply_to = 'new'; } else { // See if we can get a paragraph or header that can be converted apply_to = this._getFirstAncestor(sel, ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7']); if(apply_to != null) { applicable = true; } else { applicable = false; } } } else { applicable = false; } } } } if(applicable) { // Remove the first . className = className.substring(className.indexOf('.'), className.length); // Replace any futher ones with spaces (for multiple class definitions) className = className.replace('.', ' '); if(apply_to == null) { if(this._selectionEmpty(this._getSelection())) { // Get the previous element and apply to that apply_to = this._getFirstAncestor(this._getSelection(), null); } else { apply_to = 'new'; tag = 'span'; } } } var applied = (this._ancestorsWithClasses(sel, tag, className).length > 0 ? true : false); var applied_to = this._ancestorsWithClasses(sel, tag, className); if(applicable) { var anch = document.createElement('a'); anch.onfocus = function () { this.blur() } // prevent dotted line around link that causes horizontal scrollbar anch._stylist_className = className.trim(); anch._stylist_applied = applied; anch._stylist_appliedTo = applied_to; anch._stylist_applyTo = apply_to; anch._stylist_applyTag = tag; anch.innerHTML = this.config.css_style[x]; anch.href = 'javascript:void(0)'; var editor = this; anch.onclick = function() { if(this._stylist_applied == true) { editor._stylistRemoveClasses(this._stylist_className, this._stylist_appliedTo); } else { editor._stylistAddClasses(this._stylist_applyTo, this._stylist_applyTag, this._stylist_className); } return false; } anch.style.display = 'block'; anch.style.paddingLeft = '3px'; anch.style.paddingTop = '1px'; anch.style.paddingBottom = '1px'; anch.style.textDecoration = 'none'; if(applied) { anch.style.background = 'Highlight'; anch.style.color = 'HighlightText'; } anch.style.position = 'relative'; main.appendChild(anch); } } }; /** * Add the given classes (space seperated list) to the currently selected element * (will add a span if none selected) */ Xinha.prototype._stylistAddClasses = function(el, tag, classes) { if(el == 'new') { this.insertHTML('<' + tag + ' class="' + classes + '">' + this.getSelectedHTML() + '</' + tag + '>'); } else { if(tag != null && el.tagName.toLowerCase() != tag) { // Have to change the tag! var new_el = this.switchElementTag(el, tag); if(typeof el._stylist_usedToBe != 'undefined') { new_el._stylist_usedToBe = el._stylist_usedToBe; new_el._stylist_usedToBe[new_el._stylist_usedToBe.length] = {'tagName' : el.tagName, 'className' : el.getAttribute('class')}; } else { new_el._stylist_usedToBe = [{'tagName' : el.tagName, 'className' : el.getAttribute('class')}]; } Xinha.addClasses(new_el, classes); } else { Xinha._addClasses(el, classes); } } this.focusEditor(); this.updateToolbar(); }; /** * Remove the given classes (space seperated list) from the given elements (array of elements) */ Xinha.prototype._stylistRemoveClasses = function(classes, from) { for(var x = 0; x < from.length; x++) { this._stylistRemoveClassesFull(from[x], classes); } this.focusEditor(); this.updateToolbar(); }; Xinha.prototype._stylistRemoveClassesFull = function(el, classes) { if(el != null) { var thiers = el.className.trim().split(' '); var new_thiers = [ ]; var ours = classes.split(' '); for(var x = 0; x < thiers.length; x++) { var exists = false; for(var i = 0; exists == false && i < ours.length; i++) { if(ours[i] == thiers[x]) { exists = true; } } if(exists == false) { new_thiers[new_thiers.length] = thiers[x]; } } if(new_thiers.length == 0 && el._stylist_usedToBe && el._stylist_usedToBe.length > 0 && el._stylist_usedToBe[el._stylist_usedToBe.length - 1].className != null) { // Revert back to what we were IF the classes are identical var last_el = el._stylist_usedToBe[el._stylist_usedToBe.length - 1]; var last_classes = Xinha.arrayFilter(last_el.className.trim().split(' '), function(c) { if (c == null || c.trim() == '') { return false;} return true; }); if( (new_thiers.length == 0) || ( Xinha.arrayContainsArray(new_thiers, last_classes) && Xinha.arrayContainsArray(last_classes, new_thiers) ) ) { el = this.switchElementTag(el, last_el.tagName); new_thiers = last_classes; } else { // We can't rely on the remembered tags any more el._stylist_usedToBe = [ ]; } } if( new_thiers.length > 0 || el.tagName.toLowerCase() != 'span' || (el.id && el.id != '') ) { el.className = new_thiers.join(' ').trim(); } else { // Must be a span with no classes and no id, so we can splice it out var prnt = el.parentNode; var tmp; while (el.hasChildNodes()) { if (el.firstChild.nodeType == 1) { // if el.firstChild is an element, we've got to recurse to make sure classes are // removed from it and and any of its children. this._stylistRemoveClassesFull(el.firstChild, classes); } tmp = el.removeChild(el.firstChild); prnt.insertBefore(tmp, el); } prnt.removeChild(el); } } }; /** * Change the tag of an element */ Xinha.prototype.switchElementTag = function(el, tag) { var prnt = el.parentNode; var new_el = this._doc.createElement(tag); if(Xinha.is_ie || el.hasAttribute('id')) new_el.setAttribute('id', el.getAttribute('id')); if(Xinha.is_ie || el.hasAttribute('style')) new_el.setAttribute('style', el.getAttribute('style')); var childs = el.childNodes; for(var x = 0; x < childs.length; x++) { new_el.appendChild(childs[x].cloneNode(true)); } prnt.insertBefore(new_el, el); new_el._stylist_usedToBe = [el.tagName]; prnt.removeChild(el); this.selectNodeContents(new_el); return new_el; }; Xinha.prototype._getAncestorsClassNames = function(sel) { // Scan upwards to find a block level element that we can change or apply to var prnt = this._activeElement(sel); if(prnt == null) { prnt = (Xinha.is_ie ? this._createRange(sel).parentElement() : this._createRange(sel).commonAncestorContainer); } var classNames = [ ]; while(prnt) { if(prnt.nodeType == 1) { var classes = prnt.className.trim().split(' '); for(var x = 0; x < classes.length; x++) { classNames[classNames.length] = classes[x]; } if(prnt.tagName.toLowerCase() == 'body') break; if(prnt.tagName.toLowerCase() == 'table' ) break; } prnt = prnt.parentNode; } return classNames; }; Xinha.prototype._ancestorsWithClasses = function(sel, tag, classes) { var ancestors = [ ]; var prnt = this._activeElement(sel); if(prnt == null) { try { prnt = (Xinha.is_ie ? this._createRange(sel).parentElement() : this._createRange(sel).commonAncestorContainer); } catch(e) { return ancestors; } } var search_classes = classes.trim().split(' '); while(prnt) { if(prnt.nodeType == 1 && prnt.className) { if(tag == null || prnt.tagName.toLowerCase() == tag) { var classes = prnt.className.trim().split(' '); var found_all = true; for(var i = 0; i < search_classes.length; i++) { var found_class = false; for(var x = 0; x < classes.length; x++) { if(search_classes[i] == classes[x]) { found_class = true; break; } } if(!found_class) { found_all = false; break; } } if(found_all) ancestors[ancestors.length] = prnt; } if(prnt.tagName.toLowerCase() == 'body') break; if(prnt.tagName.toLowerCase() == 'table' ) break; } prnt = prnt.parentNode; } return ancestors; }; Xinha.ripStylesFromCSSFile = function(URL, skip_imports) { var css = Xinha._geturlcontent(URL); return Xinha.ripStylesFromCSSString(css, skip_imports, URL); }; Xinha.ripStylesFromCSSString = function(css, skip_imports, imports_relative_to) { if(!skip_imports) { if(!imports_relative_to) { imports_relative_to = _editor_url + 'Xinha.css' } var seen = { }; function resolve_imports(css, url) { seen[url] = true; // protects against infinite recursion var RE_atimport = '@import\\s*(url\\()?["\'](.*)["\'].*'; var imports = css.match(new RegExp(RE_atimport,'ig')); var m, file, re = new RegExp(RE_atimport,'i'); if (imports) { var path = url.replace(/\?.*$/,'').split("/"); path.pop(); path = path.join('/'); for (var i=0;i<imports.length;i++) { m = imports[i].match(re); file = m[2]; if (!file.match(/^([^:]+\:)?\//)) { file = Xinha._resolveRelativeUrl(path,file); } if(seen[file]) continue; css += resolve_imports(Xinha._geturlcontent(file), file); } } return css; } css = resolve_imports(css, imports_relative_to); } // We are only interested in the selectors, the rules are not important // so we'll drop out all coments and rules var RE_comment = /\/\*(.|\r|\n)*?\*\//g; var RE_rule = /\{(.|\r|\n)*?\}/g; css = css.replace(RE_comment, ''); css = css.replace(RE_rule, ','); // And split on commas css = css.split(','); // And add those into our structure var selectors = { }; for(var x = 0; x < css.length; x++) { if(css[x].trim()) { selectors[css[x].trim()] = css[x].trim(); } } return selectors; }; // Make our right side panel and insert appropriatly function Stylist(editor, args) { this.editor = editor; var stylist = this; } Stylist._pluginInfo = { name : "Stylist", version : "1.0", developer: "James Sleeman", developer_url: "http://www.gogo.co.nz/", c_owner : "Gogo Internet Services", license : "HTMLArea", sponsor : "Gogo Internet Services", sponsor_url : "http://www.gogo.co.nz/" }; Stylist.prototype.onGenerateOnce = function() { var cfg = this.editor.config; if(typeof cfg.css_style != 'undefined' && Xinha.objectProperties(cfg.css_style).length != 0) { this._prepareDialog(); } }; Stylist.prototype._prepareDialog = function() { var editor = this.editor; var stylist = this; var html = '<h1><l10n>Styles</l10n></h1>'; this.dialog = new Xinha.Dialog(editor, html, 'Stylist',{width:200},{modal:false,closable:false}); Xinha._addClass( this.dialog.rootElem, 'Stylist' ); this.dialog.attachToPanel('right'); this.dialog.show(); var dialog = this.dialog; var main = this.dialog.main; var caption = this.dialog.captionBar; main.style.overflow = "auto"; main.style.height = this.editor._framework.ed_cell.offsetHeight - caption.offsetHeight + 'px'; editor.notifyOn('modechange', function(e,args) { if (!dialog.attached) { return; } switch(args.mode) { case 'text': { dialog.hide(); break; } case 'wysiwyg': { dialog.show(); break; } } } ); editor.notifyOn('panel_change', function(e,args) { if (!dialog.attached) { return; } switch (args.action) { case 'show': var newHeight = main.offsetHeight - args.panel.offsetHeight; main.style.height = ((newHeight > 0) ? main.offsetHeight - args.panel.offsetHeight : 0) + 'px'; dialog.rootElem.style.height = caption.offsetHeight + "px"; editor.sizeEditor(); break; case 'hide': stylist.resize(); break; } } ); editor.notifyOn('before_resize', function() { if (!dialog.attached) { return; } dialog.rootElem.style.height = caption.offsetHeight + "px"; } ); editor.notifyOn('resize', function() { if (!dialog.attached) { return; } stylist.resize(); } ); } Stylist.prototype.resize = function() { var editor = this.editor; var rootElem = this.dialog.rootElem; if (rootElem.style.display == 'none') return; var panelContainer = rootElem.parentNode; var newSize = panelContainer.offsetHeight; for (var i=0; i < panelContainer.childNodes.length;++i) { if (panelContainer.childNodes[i] == rootElem || !panelContainer.childNodes[i].offsetHeight) { continue; } newSize -= panelContainer.childNodes[i].offsetHeight; } rootElem.style.height = newSize-5 + 'px'; this.dialog.main.style.height = newSize - this.dialog.captionBar.offsetHeight -5 + 'px'; } Stylist.prototype.onUpdateToolbar = function() { if(this.dialog) { if(this._timeoutID) { window.clearTimeout(this._timeoutID); } var e = this.editor; this._timeoutID = window.setTimeout(function() { e._fillStylist(); }, 250); } };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/Stylist.js
JavaScript
art
19,174
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Author: Maarten Molenschot, maarten@nrgmm.nl { "Styles": "Style" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/nl.js
JavaScript
art
128
// I18N constants // LANG: "de", ENCODING: UTF-8 // Author: Mihai Bazon, http://dynarch.com/mishoo { "Styles": "Stile" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/de.js
JavaScript
art
124
// I18N constants // LANG: "pl", ENCODING: UTF-8 // translated: Krzysztof Kotowicz koto@webworkers.pl { "Styles": "Style" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/pl.js
JavaScript
art
127
// I18N constants // LANG: "ru", ENCODING: UTF-8 { "Styles": "Стили" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/ru.js
JavaScript
art
78
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Styles": "Styles" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/fr.js
JavaScript
art
74
// I18N constants // LANG: "ja", ENCODING: UTF-8 { "Styles": "スタイル" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/ja.js
JavaScript
art
80
// I18N constants // LANG: "nb", ENCODING: UTF-8 // translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com { "Styles": "Stiler" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/nb.js
JavaScript
art
149
// I18N constants // // LANG: "pt_br", ENCODING: UTF-8 // Portuguese Brazilian Translation // // Author: Marcio Barbosa, <marcio@mpg.com.br> // MSN: tomarshall@msn.com - ICQ: 69419933 // Site: http://www.mpg.com.br // // Last revision: 06 september 2007 // Please don´t remove this information // If you modify any source, please insert a comment with your name and e-mail // // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Styles": "Estilos" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/Stylist/lang/pt_br.js
JavaScript
art
522
.CharacterMap { background-color:white; } .CharacterMap a.entity { font-size:12px; width:18px; display:block; float:left; padding:2px; text-decoration:none; color:#000; text-align:center; } .CharacterMap a.light { background-color:#ffffff; } .CharacterMap a.dark { background-color:#f7f8fd; } .CharacterMap a.entity:hover { background-color:#ffd760; color:#000; } .popup td.character { font-family:Verdana,Arial,Helvetica,sans-serif; font-size:14px; font-weight:bold; text-align:center; background:#fff; padding:4px; } .popup td.character-hilite { background:#ffd760; } .popup form { text-align:center; } .popup table { cursor:pointer; background-color:#ADAD9C; border:1px inset; }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/CharacterMap.css
CSS
art
775
// Character Map plugin for Xinha // Original Author - Bernhard Pfeifer novocaine@gmx.net Xinha.loadStyle( 'CharacterMap.css', 'CharacterMap' ); function CharacterMap( editor ) { this.editor = editor; var cfg = editor.config; var self = this; cfg.registerButton( { id : 'insertcharacter', tooltip : Xinha._lc( 'Insert special character', 'CharacterMap' ), image : editor.imgURL('images/tango/16x16/apps/accessories-character-map.png'), textMode : false, action : function() { self.show(); } } ); cfg.addToolbarElement('insertcharacter', 'createlink', -1); } // configuration mode : panel or popup Xinha.Config.prototype.CharacterMap = { 'mode': 'popup' // configuration mode : panel or popup }; CharacterMap._pluginInfo = { name : "CharacterMap", version : "2.0", developer : "Laurent Vilday", developer_url : "http://www.mokhet.com/", c_owner : "Xinha community", sponsor : "", sponsor_url : "", license : "HTMLArea" }; CharacterMap._isActive = false; CharacterMap.prototype.addEntity = function ( entite, pos ) { var editor = this.editor; var self = this; var a = document.createElement( 'a' ); Xinha._addClass( a, 'entity' ); a.innerHTML = entite; a.href = 'javascript:void(0)'; Xinha._addClass(a, (pos%2)? 'light':'dark'); a.onclick = function() { if (Xinha.is_ie) editor.focusEditor(); editor.insertHTML( entite ); //self._isActive = false; //editor.hidePanel( editor._CharacterMap ); return false; }; this.dialog.main.appendChild( a ); a = null; }; CharacterMap.prototype.onGenerateOnce = function() { this._prepareDialog(); }; CharacterMap.prototype._prepareDialog = function() { var self = this; var editor = this.editor; var html = '<h1><l10n>Insert special character</l10n></h1>'; // Now we have everything we need, so we can build the dialog. this.dialog = new Xinha.Dialog(editor, html, 'CharacterMap',{width:300},{modal:false}); Xinha._addClass( this.dialog.rootElem, 'CharacterMap' ); if (editor.config.CharacterMap && editor.config.CharacterMap.mode == 'panel') this.dialog.attachToPanel('right'); var entites = [ '&Yuml;', '&scaron;', '&#064;', '&quot;', '&iexcl;', '&cent;', '&pound;', '&curren;', '&yen;', '&brvbar;', '&sect;', '&uml;', '&copy;', '&ordf;', '&laquo;', '&not;', '&macr;', '&deg;', '&plusmn;', '&sup2;', '&sup3;', '&acute;', '&micro;', '&para;', '&middot;', '&cedil;', '&sup1;', '&ordm;', '&raquo;', '&frac14;', '&frac12;', '&frac34;', '&iquest;', '&times;', '&Oslash;', '&divide;', '&oslash;', '&fnof;', '&circ;', '&tilde;', '&ndash;', '&mdash;', '&lsquo;', '&rsquo;', '&sbquo;', '&ldquo;', '&rdquo;', '&bdquo;', '&dagger;', '&Dagger;', '&bull;', '&hellip;', '&permil;', '&lsaquo;', '&rsaquo;', '&euro;', '&trade;', '&Agrave;', '&Aacute;', '&Acirc;', '&Atilde;', '&Auml;', '&Aring;', '&AElig;', '&Ccedil;', '&Egrave;', '&Eacute;', '&Ecirc;', '&Euml;', '&Igrave;', '&Iacute;', '&Icirc;', '&Iuml;', '&ETH;', '&Ntilde;', '&Ograve;', '&Oacute;', '&Ocirc;', '&Otilde;', '&Ouml;', '&reg;', '&times;', '&Ugrave;', '&Uacute;', '&Ucirc;', '&Uuml;', '&Yacute;', '&THORN;', '&szlig;', '&agrave;', '&aacute;', '&acirc;', '&atilde;', '&auml;', '&aring;', '&aelig;', '&ccedil;', '&egrave;', '&eacute;', '&ecirc;', '&euml;', '&igrave;', '&iacute;', '&icirc;', '&iuml;', '&eth;', '&ntilde;', '&ograve;', '&oacute;', '&ocirc;', '&otilde;', '&ouml;', '&divide;', '&oslash;', '&ugrave;', '&uacute;', '&ucirc;', '&uuml;', '&yacute;', '&thorn;', '&yuml;', '&OElig;', '&oelig;', '&Scaron;' ]; for ( var i=0; i<entites.length; i++ ) { this.addEntity( entites[i], i ); } this.ready = true; //this.hide(); }; CharacterMap.prototype.show = function() { if(!this.ready) // if the user is too fast clicking the, we have to make them wait { var self = this; window.setTimeout(function() {self.show();},100); return; } this.dialog.toggle(); }; CharacterMap.prototype.hide = function() { this.dialog.hide(); };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/CharacterMap.js
JavaScript
art
4,040
// I18N constants // LANG: "nl", ENCODING: UTF-8 // Sponsored by http://www.systemconcept.de // Author: Holger Hees, <hhees@systemconcept.de> // (c) systemconcept.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Insert special character": "Speciaal character invoegen", "Cancel": "Annuleer" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/nl.js
JavaScript
art
375
// I18N constants // LANG: "it", ENCODING: UTF-8 { "Insert special character": "Inserisca il carattere speciale", "Cancel": "Annullamento" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/it.js
JavaScript
art
146
// I18N constants // LANG: "de", ENCODING: UTF-8 // Sponsored by http://www.systemconcept.de // Author: Holger Hees, <hhees@systemconcept.de> // (c) systemconcept.de 2004 // Distributed under the same terms as HTMLArea itself. // This notice MUST stay intact for use (see license.txt). { "Insert special character": "Sonderzeichen einfügen", "Cancel": "Abbrechen" }
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/de.js
JavaScript
art
371
// I18N constants // LANG: "ru", ENCODING: UTF-8 // Author: Andrei Blagorazumov, a@fnr.ru { "Insert special character": "Вставить специальный символ", "Cancel": "Отменить" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/ru.js
JavaScript
art
220
// I18N constants // LANG: "sv" (Swedish), ENCODING: UTF-8 // translated: Erik Dalén <dalen@jpl.se> { "Insert special character": "Infoga tecken", "Cancel": "Avbryt" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/sv.js
JavaScript
art
174
// I18N constants // LANG: "fr", ENCODING: UTF-8 { "Insert special character": "Insérer un caractère spécial", "Cancel": "Annuler" };
zzh-simple-hr
ZJs/webapp/html-editor/XinHa/plugins/CharacterMap/lang/fr.js
JavaScript
art
140