code
stringlengths
1
2.08M
language
stringclasses
1 value
//////////////////////////////////////////////////// // spellChecker.js // // spellChecker object // // This file is sourced on web pages that have a textarea object to evaluate // for spelling. It includes the implementation for the spellCheckObject. // //////////////////////////////////////////////////// // constructor function spellChecker( textObject ) { // public properties - configurable // this.popUpUrl = '/speller/spellchecker.html'; // by FredCK this.popUpUrl = 'fck_spellerpages/spellerpages/spellchecker.html'; // by FredCK this.popUpName = 'spellchecker'; // this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes"; // by FredCK this.popUpProps = null ; // by FredCK // this.spellCheckScript = '/speller/server-scripts/spellchecker.php'; // by FredCK //this.spellCheckScript = '/cgi-bin/spellchecker.pl'; // values used to keep track of what happened to a word this.replWordFlag = "R"; // single replace this.ignrWordFlag = "I"; // single ignore this.replAllFlag = "RA"; // replace all occurances this.ignrAllFlag = "IA"; // ignore all occurances this.fromReplAll = "~RA"; // an occurance of a "replace all" word this.fromIgnrAll = "~IA"; // an occurance of a "ignore all" word // properties set at run time this.wordFlags = new Array(); this.currentTextIndex = 0; this.currentWordIndex = 0; this.spellCheckerWin = null; this.controlWin = null; this.wordWin = null; this.textArea = textObject; // deprecated this.textInputs = arguments; // private methods this._spellcheck = _spellcheck; this._getSuggestions = _getSuggestions; this._setAsIgnored = _setAsIgnored; this._getTotalReplaced = _getTotalReplaced; this._setWordText = _setWordText; this._getFormInputs = _getFormInputs; // public methods this.openChecker = openChecker; this.startCheck = startCheck; this.checkTextBoxes = checkTextBoxes; this.checkTextAreas = checkTextAreas; this.spellCheckAll = spellCheckAll; this.ignoreWord = ignoreWord; this.ignoreAll = ignoreAll; this.replaceWord = replaceWord; this.replaceAll = replaceAll; this.terminateSpell = terminateSpell; this.undo = undo; // set the current window's "speller" property to the instance of this class. // this object can now be referenced by child windows/frames. window.speller = this; } // call this method to check all text boxes (and only text boxes) in the HTML document function checkTextBoxes() { this.textInputs = this._getFormInputs( "^text$" ); this.openChecker(); } // call this method to check all textareas (and only textareas ) in the HTML document function checkTextAreas() { this.textInputs = this._getFormInputs( "^textarea$" ); this.openChecker(); } // call this method to check all text boxes and textareas in the HTML document function spellCheckAll() { this.textInputs = this._getFormInputs( "^text(area)?$" ); this.openChecker(); } // call this method to check text boxe(s) and/or textarea(s) that were passed in to the // object's constructor or to the textInputs property function openChecker() { this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps ); if( !this.spellCheckerWin.opener ) { this.spellCheckerWin.opener = window; } } function startCheck( wordWindowObj, controlWindowObj ) { // set properties from args this.wordWin = wordWindowObj; this.controlWin = controlWindowObj; // reset properties this.wordWin.resetForm(); this.controlWin.resetForm(); this.currentTextIndex = 0; this.currentWordIndex = 0; // initialize the flags to an array - one element for each text input this.wordFlags = new Array( this.wordWin.textInputs.length ); // each element will be an array that keeps track of each word in the text for( var i=0; i<this.wordFlags.length; i++ ) { this.wordFlags[i] = []; } // start this._spellcheck(); return true; } function ignoreWord() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } if( !this.wordWin.getTextVal( ti, wi )) { alert( 'Error: "Not in dictionary" text is missing.' ); return false; } // set as ignored if( this._setAsIgnored( ti, wi, this.ignrWordFlag )) { this.currentWordIndex++; this._spellcheck(); } return true; } function ignoreAll() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } // get the word that is currently being evaluated. var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); if( !s_word_to_repl ) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } // set this word as an "ignore all" word. this._setAsIgnored( ti, wi, this.ignrAllFlag ); // loop through all the words after this word for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == ti && j > wi ) || i > ti ) { // future word: set as "from ignore all" if // 1) do not already have a flag and // 2) have the same value as current word if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) { this._setAsIgnored( i, j, this.fromIgnrAll ); } } } } // finally, move on this.currentWordIndex++; this._spellcheck(); return true; } function replaceWord() { var wi = this.currentWordIndex; var ti = this.currentTextIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } if( !this.wordWin.getTextVal( ti, wi )) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } if( !this.controlWin.replacementText ) { return false ; } var txt = this.controlWin.replacementText; if( txt.value ) { var newspell = new String( txt.value ); if( this._setWordText( ti, wi, newspell, this.replWordFlag )) { this.currentWordIndex++; this._spellcheck(); } } return true; } function replaceAll() { var ti = this.currentTextIndex; var wi = this.currentWordIndex; if( !this.wordWin ) { alert( 'Error: Word frame not available.' ); return false; } var s_word_to_repl = this.wordWin.getTextVal( ti, wi ); if( !s_word_to_repl ) { alert( 'Error: "Not in dictionary" text is missing' ); return false; } var txt = this.controlWin.replacementText; if( !txt.value ) return false; var newspell = new String( txt.value ); // set this word as a "replace all" word. this._setWordText( ti, wi, newspell, this.replAllFlag ); // loop through all the words after this word for( var i = ti; i < this.wordWin.textInputs.length; i++ ) { for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == ti && j > wi ) || i > ti ) { // future word: set word text to s_word_to_repl if // 1) do not already have a flag and // 2) have the same value as s_word_to_repl if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) { this._setWordText( i, j, newspell, this.fromReplAll ); } } } } // finally, move on this.currentWordIndex++; this._spellcheck(); return true; } function terminateSpell() { // called when we have reached the end of the spell checking. var msg = ""; // by FredCK var numrepl = this._getTotalReplaced(); if( numrepl == 0 ) { // see if there were no misspellings to begin with if( !this.wordWin ) { msg = ""; } else { if( this.wordWin.totalMisspellings() ) { // msg += "No words changed."; // by FredCK msg += FCKLang.DlgSpellNoChanges ; // by FredCK } else { // msg += "No misspellings found."; // by FredCK msg += FCKLang.DlgSpellNoMispell ; // by FredCK } } } else if( numrepl == 1 ) { // msg += "One word changed."; // by FredCK msg += FCKLang.DlgSpellOneChange ; // by FredCK } else { // msg += numrepl + " words changed."; // by FredCK msg += FCKLang.DlgSpellManyChanges.replace( /%1/g, numrepl ) ; } if( msg ) { // msg += "\n"; // by FredCK alert( msg ); } if( numrepl > 0 ) { // update the text field(s) on the opener window for( var i = 0; i < this.textInputs.length; i++ ) { // this.textArea.value = this.wordWin.text; if( this.wordWin ) { if( this.wordWin.textInputs[i] ) { this.textInputs[i].value = this.wordWin.textInputs[i]; } } } } // return back to the calling window // this.spellCheckerWin.close(); // by FredCK if ( typeof( this.OnFinished ) == 'function' ) // by FredCK this.OnFinished(numrepl) ; // by FredCK return true; } function undo() { // skip if this is the first word! var ti = this.currentTextIndex; var wi = this.currentWordIndex; if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) { this.wordWin.removeFocus( ti, wi ); // go back to the last word index that was acted upon do { // if the current word index is zero then reset the seed if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) { this.currentTextIndex--; this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1; if( this.currentWordIndex < 0 ) this.currentWordIndex = 0; } else { if( this.currentWordIndex > 0 ) { this.currentWordIndex--; } } } while ( this.wordWin.totalWords( this.currentTextIndex ) == 0 || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll ); var text_idx = this.currentTextIndex; var idx = this.currentWordIndex; var preReplSpell = this.wordWin.originalSpellings[text_idx][idx]; // if we got back to the first word then set the Undo button back to disabled if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) { this.controlWin.disableUndo(); } var i, j, origSpell ; // examine what happened to this current word. switch( this.wordFlags[text_idx][idx] ) { // replace all: go through this and all the future occurances of the word // and revert them all to the original spelling and clear their flags case this.replAllFlag : for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == text_idx && j >= idx ) || i > text_idx ) { origSpell = this.wordWin.originalSpellings[i][j]; if( origSpell == preReplSpell ) { this._setWordText ( i, j, origSpell, undefined ); } } } } break; // ignore all: go through all the future occurances of the word // and clear their flags case this.ignrAllFlag : for( i = text_idx; i < this.wordWin.textInputs.length; i++ ) { for( j = 0; j < this.wordWin.totalWords( i ); j++ ) { if(( i == text_idx && j >= idx ) || i > text_idx ) { origSpell = this.wordWin.originalSpellings[i][j]; if( origSpell == preReplSpell ) { this.wordFlags[i][j] = undefined; } } } } break; // replace: revert the word to its original spelling case this.replWordFlag : this._setWordText ( text_idx, idx, preReplSpell, undefined ); break; } // For all four cases, clear the wordFlag of this word. re-start the process this.wordFlags[text_idx][idx] = undefined; this._spellcheck(); } } function _spellcheck() { var ww = this.wordWin; // check if this is the last word in the current text element if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) { this.currentTextIndex++; this.currentWordIndex = 0; // keep going if we're not yet past the last text element if( this.currentTextIndex < this.wordWin.textInputs.length ) { this._spellcheck(); return; } else { this.terminateSpell(); return; } } // if this is after the first one make sure the Undo button is enabled if( this.currentWordIndex > 0 ) { this.controlWin.enableUndo(); } // skip the current word if it has already been worked on if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) { // increment the global current word index and move on. this.currentWordIndex++; this._spellcheck(); } else { var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex ); if( evalText ) { this.controlWin.evaluatedText.value = evalText; ww.setFocus( this.currentTextIndex, this.currentWordIndex ); this._getSuggestions( this.currentTextIndex, this.currentWordIndex ); } } } function _getSuggestions( text_num, word_num ) { this.controlWin.clearSuggestions(); // add suggestion in list for each suggested word. // get the array of suggested words out of the // three-dimensional array containing all suggestions. var a_suggests = this.wordWin.suggestions[text_num][word_num]; if( a_suggests ) { // got an array of suggestions. for( var ii = 0; ii < a_suggests.length; ii++ ) { this.controlWin.addSuggestion( a_suggests[ii] ); } } this.controlWin.selectDefaultSuggestion(); } function _setAsIgnored( text_num, word_num, flag ) { // set the UI this.wordWin.removeFocus( text_num, word_num ); // do the bookkeeping this.wordFlags[text_num][word_num] = flag; return true; } function _getTotalReplaced() { var i_replaced = 0; for( var i = 0; i < this.wordFlags.length; i++ ) { for( var j = 0; j < this.wordFlags[i].length; j++ ) { if(( this.wordFlags[i][j] == this.replWordFlag ) || ( this.wordFlags[i][j] == this.replAllFlag ) || ( this.wordFlags[i][j] == this.fromReplAll )) { i_replaced++; } } } return i_replaced; } function _setWordText( text_num, word_num, newText, flag ) { // set the UI and form inputs this.wordWin.setText( text_num, word_num, newText ); // keep track of what happened to this word: this.wordFlags[text_num][word_num] = flag; return true; } function _getFormInputs( inputPattern ) { var inputs = new Array(); for( var i = 0; i < document.forms.length; i++ ) { for( var j = 0; j < document.forms[i].elements.length; j++ ) { if( document.forms[i].elements[j].type.match( inputPattern )) { inputs[inputs.length] = document.forms[i].elements[j]; } } } return inputs; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Useful functions used by almost all dialog window pages. * Dialogs should link to this file as the very first script on the page. */ // Automatically detect the correct document.domain (#123). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.parent.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; // Attention: FCKConfig must be available in the page. function GetCommonDialogCss( prefix ) { // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see _dev/css_compression.txt). return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}' ; } // Gets a element by its Id. Used for shorter coding. function GetE( elementId ) { return document.getElementById( elementId ) ; } function ShowE( element, isVisible ) { if ( typeof( element ) == 'string' ) element = GetE( element ) ; element.style.display = isVisible ? '' : 'none' ; } function SetAttribute( element, attName, attValue ) { if ( attValue == null || attValue.length == 0 ) element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive else element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive } function GetAttribute( element, attName, valueIfNull ) { var oAtt = element.attributes[attName] ; if ( oAtt == null || !oAtt.specified ) return valueIfNull ? valueIfNull : '' ; var oValue = element.getAttribute( attName, 2 ) ; if ( oValue == null ) oValue = oAtt.nodeValue ; return ( oValue == null ? valueIfNull : oValue ) ; } function SelectField( elementId ) { var element = GetE( elementId ) ; element.focus() ; // element.select may not be available for some fields (like <select>). if ( element.select ) element.select() ; } // Functions used by text fields to accept numbers only. var IsDigit = ( function() { var KeyIdentifierMap = { End : 35, Home : 36, Left : 37, Right : 39, 'U+00007F' : 46 // Delete } ; return function ( e ) { if ( !e ) e = event ; var iCode = ( e.keyCode || e.charCode ) ; if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) ) iCode = KeyIdentifierMap[ e.keyIdentifier ] ; return ( ( iCode >= 48 && iCode <= 57 ) // Numbers || (iCode >= 35 && iCode <= 40) // Arrows, Home, End || iCode == 8 // Backspace || iCode == 46 // Delete || iCode == 9 // Tab ) ; } } )() ; String.prototype.Trim = function() { return this.replace( /(^\s*)|(\s*$)/g, '' ) ; } String.prototype.StartsWith = function( value ) { return ( this.substr( 0, value.length ) == value ) ; } String.prototype.Remove = function( start, length ) { var s = '' ; if ( start > 0 ) s = this.substring( 0, start ) ; if ( start + length < this.length ) s += this.substring( start + length , this.length ) ; return s ; } String.prototype.ReplaceAll = function( searchArray, replaceArray ) { var replaced = this ; for ( var i = 0 ; i < searchArray.length ; i++ ) { replaced = replaced.replace( searchArray[i], replaceArray[i] ) ; } return replaced ; } function OpenFileBrowser( url, width, height ) { // oEditor must be defined. var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ; var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ; var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ; sOptions += ",width=" + width ; sOptions += ",height=" + height ; sOptions += ",left=" + iLeft ; sOptions += ",top=" + iTop ; window.open( url, 'FCKBrowseWindow', sOptions ) ; } /** Utility function to create/update an element with a name attribute in IE, so it behaves properly when moved around It also allows to change the name or other special attributes in an existing node oEditor : instance of FCKeditor where the element will be created oOriginal : current element being edited or null if it has to be created nodeName : string with the name of the element to create oAttributes : Hash object with the attributes that must be set at creation time in IE Those attributes will be set also after the element has been created for any other browser to avoid redudant code */ function CreateNamedElement( oEditor, oOriginal, nodeName, oAttributes ) { var oNewNode ; // IE doesn't allow easily to change properties of an existing object, // so remove the old and force the creation of a new one. var oldNode = null ; if ( oOriginal && oEditor.FCKBrowserInfo.IsIE ) { // Force the creation only if some of the special attributes have changed: var bChanged = false; for( var attName in oAttributes ) bChanged |= ( oOriginal.getAttribute( attName, 2) != oAttributes[attName] ) ; if ( bChanged ) { oldNode = oOriginal ; oOriginal = null ; } } // If the node existed (and it's not IE), then we just have to update its attributes if ( oOriginal ) { oNewNode = oOriginal ; } else { // #676, IE doesn't play nice with the name or type attribute if ( oEditor.FCKBrowserInfo.IsIE ) { var sbHTML = [] ; sbHTML.push( '<' + nodeName ) ; for( var prop in oAttributes ) { sbHTML.push( ' ' + prop + '="' + oAttributes[prop] + '"' ) ; } sbHTML.push( '>' ) ; if ( !oEditor.FCKListsLib.EmptyElements[nodeName.toLowerCase()] ) sbHTML.push( '</' + nodeName + '>' ) ; oNewNode = oEditor.FCK.EditorDocument.createElement( sbHTML.join('') ) ; // Check if we are just changing the properties of an existing node: copy its properties if ( oldNode ) { CopyAttributes( oldNode, oNewNode, oAttributes ) ; oEditor.FCKDomTools.MoveChildren( oldNode, oNewNode ) ; oldNode.parentNode.removeChild( oldNode ) ; oldNode = null ; if ( oEditor.FCK.Selection.SelectionData ) { // Trick to refresh the selection object and avoid error in // fckdialog.html Selection.EnsureSelection var oSel = oEditor.FCK.EditorDocument.selection ; oEditor.FCK.Selection.SelectionData = oSel.createRange() ; // Now oSel.type will be 'None' reflecting the real situation } } oNewNode = oEditor.FCK.InsertElement( oNewNode ) ; // FCK.Selection.SelectionData is broken by now since we've // deleted the previously selected element. So we need to reassign it. if ( oEditor.FCK.Selection.SelectionData ) { var range = oEditor.FCK.EditorDocument.body.createControlRange() ; range.add( oNewNode ) ; oEditor.FCK.Selection.SelectionData = range ; } } else { oNewNode = oEditor.FCK.InsertElement( nodeName ) ; } } // Set the basic attributes for( var attName in oAttributes ) oNewNode.setAttribute( attName, oAttributes[attName], 0 ) ; // 0 : Case Insensitive return oNewNode ; } // Copy all the attributes from one node to the other, kinda like a clone // But oSkipAttributes is an object with the attributes that must NOT be copied function CopyAttributes( oSource, oDest, oSkipAttributes ) { var aAttributes = oSource.attributes ; for ( var n = 0 ; n < aAttributes.length ; n++ ) { var oAttribute = aAttributes[n] ; if ( oAttribute.specified ) { var sAttName = oAttribute.nodeName ; // We can set the type only once, so do it with the proper value, not copying it. if ( sAttName in oSkipAttributes ) continue ; var sAttValue = oSource.getAttribute( sAttName, 2 ) ; if ( sAttValue == null ) sAttValue = oAttribute.nodeValue ; oDest.setAttribute( sAttName, sAttValue, 0 ) ; // 0 : Case Insensitive } } // The style: if ( oSource.style.cssText !== '' ) oDest.style.cssText = oSource.style.cssText ; } /** * Replaces a tag with another one, keeping its contents: * for example TD --> TH, and TH --> TD. * input: the original node, and the new tag name * http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode */ function RenameNode( oNode , newTag ) { // TODO: if the browser natively supports document.renameNode call it. // does any browser currently support it in order to test? // Only rename element nodes. if ( oNode.nodeType != 1 ) return null ; // If it's already correct exit here. if ( oNode.nodeName == newTag ) return oNode ; var oDoc = oNode.ownerDocument ; // Create the new node var newNode = oDoc.createElement( newTag ) ; // Copy all attributes CopyAttributes( oNode, newNode, {} ) ; // Move children to the new node FCKDomTools.MoveChildren( oNode, newNode ) ; // Finally replace the node and return the new one oNode.parentNode.replaceChild( newNode, oNode ) ; return newNode ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Image dialog window (see fck_image.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKDebug = oEditor.FCKDebug ; var FCKTools = oEditor.FCKTools ; var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; if ( FCKConfig.ImageUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.ImageDlgHideAdvanced ) dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divLink' , ( tabCode == 'Link' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected image (if available). var oImage = dialog.Selection.GetSelectedElement() ; if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) oImage = null ; // Get the active link. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; var oImageOriginal ; function UpdateOriginal( resetSize ) { if ( !eImgPreview ) return ; if ( GetE('txtUrl').value.length == 0 ) { oImageOriginal = null ; return ; } oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; if ( resetSize ) { oImageOriginal.onload = function() { this.onload = null ; ResetSizes() ; } } oImageOriginal.src = eImgPreview.src ; } var bPreviewInitialized ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; UpdateOriginal() ; // Set the actual uploader URL. if ( FCKConfig.ImageUpload ) GetE('frmUpload').action = FCKConfig.ImageUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oImage ) return ; var sUrl = oImage.getAttribute( '_fcksavedurl' ) ; if ( sUrl == null ) sUrl = GetAttribute( oImage, 'src', '' ) ; GetE('txtUrl').value = sUrl ; GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; var iWidth, iHeight ; var regexSize = /^\s*(\d+)px\s*$/i ; if ( oImage.style.width ) { var aMatchW = oImage.style.width.match( regexSize ) ; if ( aMatchW ) { iWidth = aMatchW[1] ; oImage.style.width = '' ; SetAttribute( oImage, 'width' , iWidth ) ; } } if ( oImage.style.height ) { var aMatchH = oImage.style.height.match( regexSize ) ; if ( aMatchH ) { iHeight = aMatchH[1] ; oImage.style.height = '' ; SetAttribute( oImage, 'height', iHeight ) ; } } GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; // Get Advances Attributes GetE('txtAttId').value = oImage.id ; GetE('cmbAttLangDir').value = oImage.dir ; GetE('txtAttLangCode').value = oImage.lang ; GetE('txtAttTitle').value = oImage.title ; GetE('txtLongDesc').value = oImage.longDesc ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oImage.className || '' ; GetE('txtAttStyle').value = oImage.style.cssText ; } else { GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; } if ( oLink ) { var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ; if ( sLinkUrl == null ) sLinkUrl = oLink.getAttribute('href',2) ; GetE('txtLnkUrl').value = sLinkUrl ; GetE('cmbLnkTarget').value = oLink.target ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( FCKLang.DlgImgAlertUrl ) ; return false ; } var bHasImage = ( oImage != null ) ; if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) { if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) oImage = null ; } else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) { if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) oImage = null ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !bHasImage ) { if ( bImageButton ) { oImage = FCK.EditorDocument.createElement( 'input' ) ; oImage.type = 'image' ; oImage = FCK.InsertElement( oImage ) ; } else oImage = FCK.InsertElement( 'img' ) ; } UpdateImage( oImage ) ; var sLnkUrl = GetE('txtLnkUrl').value.Trim() ; if ( sLnkUrl.length == 0 ) { if ( oLink ) FCK.ExecuteNamedCommand( 'Unlink' ) ; } else { if ( oLink ) // Modifying an existent link. oLink.href = sLnkUrl ; else // Creating a new link. { if ( !bHasImage ) oEditor.FCKSelection.SelectNode( oImage ) ; oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ; if ( !bHasImage ) { oEditor.FCKSelection.SelectNode( oLink ) ; oEditor.FCKSelection.Collapse( false ) ; } } SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; } return true ; } function UpdateImage( e, skipId ) { e.src = GetE('txtUrl').value ; SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; SetAttribute( e, "alt" , GetE('txtAlt').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; SetAttribute( e, "border", GetE('txtBorder').value ) ; SetAttribute( e, "align" , GetE('cmbAlign').value ) ; // Advances Attributes if ( ! skipId ) SetAttribute( e, 'id', GetE('txtAttId').value ) ; SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { e.className = GetE('txtAttClasses').value ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var eImgPreview ; var eImgPreviewLink ; function SetPreviewElements( imageElement, linkElement ) { eImgPreview = imageElement ; eImgPreviewLink = linkElement ; UpdatePreview() ; UpdateOriginal() ; bPreviewInitialized = true ; } function UpdatePreview() { if ( !eImgPreview || !eImgPreviewLink ) return ; if ( GetE('txtUrl').value.length == 0 ) eImgPreviewLink.style.display = 'none' ; else { UpdateImage( eImgPreview, true ) ; if ( GetE('txtLnkUrl').value.Trim().length > 0 ) eImgPreviewLink.href = 'javascript:void(null);' ; else SetAttribute( eImgPreviewLink, 'href', '' ) ; eImgPreviewLink.style.display = '' ; } } var bLockRatio = true ; function SwitchLock( lockButton ) { bLockRatio = !bLockRatio ; lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; if ( bLockRatio ) { if ( GetE('txtWidth').value.length > 0 ) OnSizeChanged( 'Width', GetE('txtWidth').value ) ; else OnSizeChanged( 'Height', GetE('txtHeight').value ) ; } } // Fired when the width or height input texts change function OnSizeChanged( dimension, value ) { // Verifies if the aspect ration has to be maintained if ( oImageOriginal && bLockRatio ) { var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; if ( value.length == 0 || isNaN( value ) ) { e.value = '' ; return ; } if ( dimension == 'Width' ) value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; else value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; if ( !isNaN( value ) ) e.value = value ; } UpdatePreview() ; } // Fired when the Reset Size button is clicked function ResetSizes() { if ( ! oImageOriginal ) return ; if ( oEditor.FCKBrowserInfo.IsGecko && !oImageOriginal.complete ) { setTimeout( ResetSizes, 50 ) ; return ; } GetE('txtWidth').value = oImageOriginal.width ; GetE('txtHeight').value = oImageOriginal.height ; UpdatePreview() ; } function BrowseServer() { OpenServerBrowser( 'Image', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ; } function LnkBrowseServer() { OpenServerBrowser( 'Link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function OpenServerBrowser( type, url, width, height ) { sActualBrowser = type ; OpenFileBrowser( url, width, height ) ; } var sActualBrowser ; function SetUrl( url, width, height, alt ) { if ( sActualBrowser == 'Link' ) { GetE('txtLnkUrl').value = url ; UpdatePreview() ; } else { GetE('txtUrl').value = url ; GetE('txtWidth').value = width ? width : '' ; GetE('txtHeight').value = height ? height : '' ; if ( alt ) GetE('txtAlt').value = alt; UpdatePreview() ; UpdateOriginal( true ) ; } dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } sActualBrowser = '' ; SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Flash dialog window (see fck_flash.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; if ( FCKConfig.FlashUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.FlashDlgHideAdvanced ) dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected flash embed (if available). var oFakeImage = dialog.Selection.GetSelectedElement() ; var oEmbed ; if ( oFakeImage ) { if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') ) oEmbed = FCK.GetRealElement( oFakeImage ) ; else oFakeImage = null ; } window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ; // Set the actual uploader URL. if ( FCKConfig.FlashUpload ) GetE('frmUpload').action = FCKConfig.FlashUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oEmbed ) return ; GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; // Get Advances Attributes GetE('txtAttId').value = oEmbed.id ; GetE('chkAutoPlay').checked = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ; GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; GetE('txtAttTitle').value = oEmbed.title ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ; GetE('txtAttStyle').value = oEmbed.style.cssText ; } else { GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( oEditor.FCKLang.DlgAlertUrl ) ; return false ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !oEmbed ) { oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; oFakeImage = null ; } UpdateEmbed( oEmbed ) ; if ( !oFakeImage ) { oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; oFakeImage = FCK.InsertElement( oFakeImage ) ; } oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ; return true ; } function UpdateEmbed( e ) { SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; // Advances Attributes SetAttribute( e, 'id' , GetE('txtAttId').value ) ; SetAttribute( e, 'scale', GetE('cmbScale').value ) ; SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { SetAttribute( e, 'className', GetE('txtAttClasses').value ) ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class', GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var ePreview ; function SetPreviewElement( previewEl ) { ePreview = previewEl ; if ( GetE('txtUrl').value.length > 0 ) UpdatePreview() ; } function UpdatePreview() { if ( !ePreview ) return ; while ( ePreview.firstChild ) ePreview.removeChild( ePreview.firstChild ) ; if ( GetE('txtUrl').value.length == 0 ) ePreview.innerHTML = '&nbsp;' ; else { var oDoc = ePreview.ownerDocument || ePreview.document ; var e = oDoc.createElement( 'EMBED' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; SetAttribute( e, 'width', '100%' ) ; SetAttribute( e, 'height', '100%' ) ; ePreview.appendChild( e ) ; } } // <embed id="ePreview" src="fck_flash/claims.swf" width="100%" height="100%" style="visibility:hidden" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> function BrowseServer() { OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ; } function SetUrl( url, width, height ) { GetE('txtUrl').value = url ; if ( width ) GetE('txtWidth').value = width ; if ( height ) GetE('txtHeight').value = height ; UpdatePreview() ; dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Plugin to insert "Placeholders" in the editor. */ // Register the related command. FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 160 ) ) ; // Create the "Plaholder" toolbar button. var oPlaceholderItem = new FCKToolbarButton( 'Placeholder', FCKLang.PlaceholderBtn ) ; oPlaceholderItem.IconPath = FCKPlugins.Items['placeholder'].Path + 'placeholder.gif' ; FCKToolbarItems.RegisterItem( 'Placeholder', oPlaceholderItem ) ; // The object used for all Placeholder operations. var FCKPlaceholders = new Object() ; // Add a new placeholder at the actual selection. FCKPlaceholders.Add = function( name ) { var oSpan = FCK.InsertElement( 'span' ) ; this.SetupSpan( oSpan, name ) ; } FCKPlaceholders.SetupSpan = function( span, name ) { span.innerHTML = '[[ ' + name + ' ]]' ; span.style.backgroundColor = '#ffff00' ; span.style.color = '#000000' ; if ( FCKBrowserInfo.IsGecko ) span.style.cursor = 'default' ; span._fckplaceholder = name ; span.contentEditable = false ; // To avoid it to be resized. span.onresizestart = function() { FCK.EditorWindow.event.returnValue = false ; return false ; } } // On Gecko we must do this trick so the user select all the SPAN when clicking on it. FCKPlaceholders._SetupClickListener = function() { FCKPlaceholders._ClickListener = function( e ) { if ( e.target.tagName == 'SPAN' && e.target._fckplaceholder ) FCKSelection.SelectNode( e.target ) ; } FCK.EditorDocument.addEventListener( 'click', FCKPlaceholders._ClickListener, true ) ; } // Open the Placeholder dialog on double click. FCKPlaceholders.OnDoubleClick = function( span ) { if ( span.tagName == 'SPAN' && span._fckplaceholder ) FCKCommands.GetCommand( 'Placeholder' ).Execute() ; } FCK.RegisterDoubleClickHandler( FCKPlaceholders.OnDoubleClick, 'SPAN' ) ; // Check if a Placholder name is already in use. FCKPlaceholders.Exist = function( name ) { var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' ) ; for ( var i = 0 ; i < aSpans.length ; i++ ) { if ( aSpans[i]._fckplaceholder == name ) return true ; } return false ; } if ( FCKBrowserInfo.IsIE ) { FCKPlaceholders.Redraw = function() { if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) return ; var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ; if ( !aPlaholders ) return ; var oRange = FCK.EditorDocument.body.createTextRange() ; for ( var i = 0 ; i < aPlaholders.length ; i++ ) { if ( oRange.findText( aPlaholders[i] ) ) { var sName = aPlaholders[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ; oRange.pasteHTML( '<span style="color: #000000; background-color: #ffff00" contenteditable="false" _fckplaceholder="' + sName + '">' + aPlaholders[i] + '</span>' ) ; } } } } else { FCKPlaceholders.Redraw = function() { if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) return ; var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKPlaceholders._AcceptNode, true ) ; var aNodes = new Array() ; while ( ( oNode = oInteractor.nextNode() ) ) { aNodes[ aNodes.length ] = oNode ; } for ( var n = 0 ; n < aNodes.length ; n++ ) { var aPieces = aNodes[n].nodeValue.split( /(\[\[[^\[\]]+\]\])/g ) ; for ( var i = 0 ; i < aPieces.length ; i++ ) { if ( aPieces[i].length > 0 ) { if ( aPieces[i].indexOf( '[[' ) == 0 ) { var sName = aPieces[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ; var oSpan = FCK.EditorDocument.createElement( 'span' ) ; FCKPlaceholders.SetupSpan( oSpan, sName ) ; aNodes[n].parentNode.insertBefore( oSpan, aNodes[n] ) ; } else aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ; } } aNodes[n].parentNode.removeChild( aNodes[n] ) ; } FCKPlaceholders._SetupClickListener() ; } FCKPlaceholders._AcceptNode = function( node ) { if ( /\[\[[^\[\]]+\]\]/.test( node.nodeValue ) ) return NodeFilter.FILTER_ACCEPT ; else return NodeFilter.FILTER_SKIP ; } } FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKPlaceholders.Redraw ) ; // We must process the SPAN tags to replace then with the real resulting value of the placeholder. FCKXHtml.TagProcessors['span'] = function( node, htmlNode ) { if ( htmlNode._fckplaceholder ) node = FCKXHtml.XML.createTextNode( '[[' + htmlNode._fckplaceholder + ']]' ) ; else FCKXHtml._AppendChildNodes( node, htmlNode, false ) ; return node ; }
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder Italian language file. */ FCKLang.PlaceholderBtn = 'Aggiungi/Modifica Placeholder' ; FCKLang.PlaceholderDlgTitle = 'Proprietà del Placeholder' ; FCKLang.PlaceholderDlgName = 'Nome del Placeholder' ; FCKLang.PlaceholderErrNoName = 'Digitare il nome del placeholder' ; FCKLang.PlaceholderErrNameInUse = 'Il nome inserito è già in uso' ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder German language file. */ FCKLang.PlaceholderBtn = 'Einfügen/editieren Platzhalter' ; FCKLang.PlaceholderDlgTitle = 'Platzhalter Eigenschaften' ; FCKLang.PlaceholderDlgName = 'Platzhalter Name' ; FCKLang.PlaceholderErrNoName = 'Bitte den Namen des Platzhalters schreiben' ; FCKLang.PlaceholderErrNameInUse = 'Der angegebene Namen ist schon in Gebrauch' ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder Polish language file. */ FCKLang.PlaceholderBtn = 'Wstaw/Edytuj nagłówek' ; FCKLang.PlaceholderDlgTitle = 'Właśności nagłówka' ; FCKLang.PlaceholderDlgName = 'Nazwa nagłówka' ; FCKLang.PlaceholderErrNoName = 'Proszę wprowadzić nazwę nagłówka' ; FCKLang.PlaceholderErrNameInUse = 'Podana nazwa jest już w użyciu' ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placeholder French language file. */ FCKLang.PlaceholderBtn = "Insérer/Modifier l'Espace réservé" ; FCKLang.PlaceholderDlgTitle = "Propriétés de l'Espace réservé" ; FCKLang.PlaceholderDlgName = "Nom de l'Espace réservé" ; FCKLang.PlaceholderErrNoName = "Veuillez saisir le nom de l'Espace réservé" ; FCKLang.PlaceholderErrNameInUse = "Ce nom est déjà utilisé" ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder English language file. */ FCKLang.PlaceholderBtn = 'Insert/Edit Placeholder' ; FCKLang.PlaceholderDlgTitle = 'Placeholder Properties' ; FCKLang.PlaceholderDlgName = 'Placeholder Name' ; FCKLang.PlaceholderErrNoName = 'Please type the placeholder name' ; FCKLang.PlaceholderErrNameInUse = 'The specified name is already in use' ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Placholder Spanish language file. */ FCKLang.PlaceholderBtn = 'Insertar/Editar contenedor' ; FCKLang.PlaceholderDlgTitle = 'Propiedades del contenedor ' ; FCKLang.PlaceholderDlgName = 'Nombre de contenedor' ; FCKLang.PlaceholderErrNoName = 'Por favor escriba el nombre de contenedor' ; FCKLang.PlaceholderErrNameInUse = 'El nombre especificado ya esta en uso' ;
JavaScript
var FCKDragTableHandler = { "_DragState" : 0, "_LeftCell" : null, "_RightCell" : null, "_MouseMoveMode" : 0, // 0 - find candidate cells for resizing, 1 - drag to resize "_ResizeBar" : null, "_OriginalX" : null, "_MinimumX" : null, "_MaximumX" : null, "_LastX" : null, "_TableMap" : null, "_doc" : document, "_IsInsideNode" : function( w, domNode, pos ) { var myCoords = FCKTools.GetWindowPosition( w, domNode ) ; var xMin = myCoords.x ; var yMin = myCoords.y ; var xMax = parseInt( xMin, 10 ) + parseInt( domNode.offsetWidth, 10 ) ; var yMax = parseInt( yMin, 10 ) + parseInt( domNode.offsetHeight, 10 ) ; if ( pos.x >= xMin && pos.x <= xMax && pos.y >= yMin && pos.y <= yMax ) return true; return false; }, "_GetBorderCells" : function( w, tableNode, tableMap, mouse ) { // Enumerate all the cells in the table. var cells = [] ; for ( var i = 0 ; i < tableNode.rows.length ; i++ ) { var r = tableNode.rows[i] ; for ( var j = 0 ; j < r.cells.length ; j++ ) cells.push( r.cells[j] ) ; } if ( cells.length < 1 ) return null ; // Get the cells whose right or left border is nearest to the mouse cursor's x coordinate. var minRxDist = null ; var lxDist = null ; var minYDist = null ; var rbCell = null ; var lbCell = null ; for ( var i = 0 ; i < cells.length ; i++ ) { var pos = FCKTools.GetWindowPosition( w, cells[i] ) ; var rightX = pos.x + parseInt( cells[i].clientWidth, 10 ) ; var rxDist = mouse.x - rightX ; var yDist = mouse.y - ( pos.y + ( cells[i].clientHeight / 2 ) ) ; if ( minRxDist == null || ( Math.abs( rxDist ) <= Math.abs( minRxDist ) && ( minYDist == null || Math.abs( yDist ) <= Math.abs( minYDist ) ) ) ) { minRxDist = rxDist ; minYDist = yDist ; rbCell = cells[i] ; } } /* var rowNode = FCKTools.GetElementAscensor( rbCell, "tr" ) ; var cellIndex = rbCell.cellIndex + 1 ; if ( cellIndex >= rowNode.cells.length ) return null ; lbCell = rowNode.cells.item( cellIndex ) ; */ var rowIdx = rbCell.parentNode.rowIndex ; var colIdx = FCKTableHandler._GetCellIndexSpan( tableMap, rowIdx, rbCell ) ; var colSpan = isNaN( rbCell.colSpan ) ? 1 : rbCell.colSpan ; lbCell = tableMap[rowIdx][colIdx + colSpan] ; if ( ! lbCell ) return null ; // Abort if too far from the border. lxDist = mouse.x - FCKTools.GetWindowPosition( w, lbCell ).x ; if ( lxDist < 0 && minRxDist < 0 && minRxDist < -2 ) return null ; if ( lxDist > 0 && minRxDist > 0 && lxDist > 3 ) return null ; return { "leftCell" : rbCell, "rightCell" : lbCell } ; }, "_GetResizeBarPosition" : function() { var row = FCKTools.GetElementAscensor( this._RightCell, "tr" ) ; return FCKTableHandler._GetCellIndexSpan( this._TableMap, row.rowIndex, this._RightCell ) ; }, "_ResizeBarMouseDownListener" : function( evt ) { if ( FCKDragTableHandler._LeftCell ) FCKDragTableHandler._MouseMoveMode = 1 ; if ( FCKBrowserInfo.IsIE ) FCKDragTableHandler._ResizeBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 50 ; else FCKDragTableHandler._ResizeBar.style.opacity = 0.5 ; FCKDragTableHandler._OriginalX = evt.clientX ; // Calculate maximum and minimum x-coordinate delta. var borderIndex = FCKDragTableHandler._GetResizeBarPosition() ; var offset = FCKDragTableHandler._GetIframeOffset(); var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" ); var minX = null ; var maxX = null ; for ( var r = 0 ; r < FCKDragTableHandler._TableMap.length ; r++ ) { var leftCell = FCKDragTableHandler._TableMap[r][borderIndex - 1] ; var rightCell = FCKDragTableHandler._TableMap[r][borderIndex] ; var leftPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, leftCell ) ; var rightPosition = FCKTools.GetWindowPosition( FCK.EditorWindow, rightCell ) ; var leftPadding = FCKDragTableHandler._GetCellPadding( table, leftCell ) ; var rightPadding = FCKDragTableHandler._GetCellPadding( table, rightCell ) ; if ( minX == null || leftPosition.x + leftPadding > minX ) minX = leftPosition.x + leftPadding ; if ( maxX == null || rightPosition.x + rightCell.clientWidth - rightPadding < maxX ) maxX = rightPosition.x + rightCell.clientWidth - rightPadding ; } FCKDragTableHandler._MinimumX = minX + offset.x ; FCKDragTableHandler._MaximumX = maxX + offset.x ; FCKDragTableHandler._LastX = null ; if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false; }, "_ResizeBarMouseUpListener" : function( evt ) { FCKDragTableHandler._MouseMoveMode = 0 ; FCKDragTableHandler._HideResizeBar() ; if ( FCKDragTableHandler._LastX == null ) return ; // Calculate the delta value. var deltaX = FCKDragTableHandler._LastX - FCKDragTableHandler._OriginalX ; // Then, build an array of current column width values. // This algorithm can be very slow if the cells have insane colSpan values. (e.g. colSpan=1000). var table = FCKTools.GetElementAscensor( FCKDragTableHandler._LeftCell, "table" ) ; var colArray = [] ; var tableMap = FCKDragTableHandler._TableMap ; for ( var i = 0 ; i < tableMap.length ; i++ ) { for ( var j = 0 ; j < tableMap[i].length ; j++ ) { var cell = tableMap[i][j] ; var width = FCKDragTableHandler._GetCellWidth( table, cell ) ; var colSpan = isNaN( cell.colSpan) ? 1 : cell.colSpan ; if ( colArray.length <= j ) colArray.push( { width : width / colSpan, colSpan : colSpan } ) ; else { var guessItem = colArray[j] ; if ( guessItem.colSpan > colSpan ) { guessItem.width = width / colSpan ; guessItem.colSpan = colSpan ; } } } } // Find out the equivalent column index of the two cells selected for resizing. colIndex = FCKDragTableHandler._GetResizeBarPosition() ; // Note that colIndex must be at least 1 here, so it's safe to subtract 1 from it. colIndex-- ; // Modify the widths in the colArray according to the mouse coordinate delta value. colArray[colIndex].width += deltaX ; colArray[colIndex + 1].width -= deltaX ; // Clear all cell widths, delete all <col> elements from the table. for ( var r = 0 ; r < table.rows.length ; r++ ) { var row = table.rows.item( r ) ; for ( var c = 0 ; c < row.cells.length ; c++ ) { var cell = row.cells.item( c ) ; cell.width = "" ; cell.style.width = "" ; } } var colElements = table.getElementsByTagName( "col" ) ; for ( var i = colElements.length - 1 ; i >= 0 ; i-- ) colElements[i].parentNode.removeChild( colElements[i] ) ; // Set new cell widths. var processedCells = [] ; for ( var i = 0 ; i < tableMap.length ; i++ ) { for ( var j = 0 ; j < tableMap[i].length ; j++ ) { var cell = tableMap[i][j] ; if ( cell._Processed ) continue ; if ( tableMap[i][j-1] != cell ) cell.width = colArray[j].width ; else cell.width = parseInt( cell.width, 10 ) + parseInt( colArray[j].width, 10 ) ; if ( tableMap[i][j+1] != cell ) { processedCells.push( cell ) ; cell._Processed = true ; } } } for ( var i = 0 ; i < processedCells.length ; i++ ) { if ( FCKBrowserInfo.IsIE ) processedCells[i].removeAttribute( '_Processed' ) ; else delete processedCells[i]._Processed ; } FCKDragTableHandler._LastX = null ; }, "_ResizeBarMouseMoveListener" : function( evt ) { if ( FCKDragTableHandler._MouseMoveMode == 0 ) return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ; else return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ; }, // Calculate the padding of a table cell. // It returns the value of paddingLeft + paddingRight of a table cell. // This function is used, in part, to calculate the width parameter that should be used for setting cell widths. // The equation in question is clientWidth = paddingLeft + paddingRight + width. // So that width = clientWidth - paddingLeft - paddingRight. // The return value of this function must be pixel accurate acorss all supported browsers, so be careful if you need to modify it. "_GetCellPadding" : function( table, cell ) { var attrGuess = parseInt( table.cellPadding, 10 ) * 2 ; var cssGuess = null ; if ( typeof( window.getComputedStyle ) == "function" ) { var styleObj = window.getComputedStyle( cell, null ) ; cssGuess = parseInt( styleObj.getPropertyValue( "padding-left" ), 10 ) + parseInt( styleObj.getPropertyValue( "padding-right" ), 10 ) ; } else cssGuess = parseInt( cell.currentStyle.paddingLeft, 10 ) + parseInt (cell.currentStyle.paddingRight, 10 ) ; var cssRuntime = cell.style.padding ; if ( isFinite( cssRuntime ) ) cssGuess = parseInt( cssRuntime, 10 ) * 2 ; else { cssRuntime = cell.style.paddingLeft ; if ( isFinite( cssRuntime ) ) cssGuess = parseInt( cssRuntime, 10 ) ; cssRuntime = cell.style.paddingRight ; if ( isFinite( cssRuntime ) ) cssGuess += parseInt( cssRuntime, 10 ) ; } attrGuess = parseInt( attrGuess, 10 ) ; cssGuess = parseInt( cssGuess, 10 ) ; if ( isNaN( attrGuess ) ) attrGuess = 0 ; if ( isNaN( cssGuess ) ) cssGuess = 0 ; return Math.max( attrGuess, cssGuess ) ; }, // Calculate the real width of the table cell. // The real width of the table cell is the pixel width that you can set to the width attribute of the table cell and after // that, the table cell should be of exactly the same width as before. // The real width of a table cell can be calculated as: // width = clientWidth - paddingLeft - paddingRight. "_GetCellWidth" : function( table, cell ) { var clientWidth = cell.clientWidth ; if ( isNaN( clientWidth ) ) clientWidth = 0 ; return clientWidth - this._GetCellPadding( table, cell ) ; }, "MouseMoveListener" : function( FCK, evt ) { if ( FCKDragTableHandler._MouseMoveMode == 0 ) return FCKDragTableHandler._MouseFindHandler( FCK, evt ) ; else return FCKDragTableHandler._MouseDragHandler( FCK, evt ) ; }, "_MouseFindHandler" : function( FCK, evt ) { if ( FCK.MouseDownFlag ) return ; var node = evt.srcElement || evt.target ; try { if ( ! node || node.nodeType != 1 ) { this._HideResizeBar() ; return ; } } catch ( e ) { this._HideResizeBar() ; return ; } // Since this function might be called from the editing area iframe or the outer fckeditor iframe, // the mouse point coordinates from evt.clientX/Y can have different reference points. // We need to resolve the mouse pointer position relative to the editing area iframe. var mouseX = evt.clientX ; var mouseY = evt.clientY ; if ( FCKTools.GetElementDocument( node ) == document ) { var offset = this._GetIframeOffset() ; mouseX -= offset.x ; mouseY -= offset.y ; } if ( this._ResizeBar && this._LeftCell ) { var leftPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._LeftCell ) ; var rightPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._RightCell ) ; var rxDist = mouseX - ( leftPos.x + this._LeftCell.clientWidth ) ; var lxDist = mouseX - rightPos.x ; var inRangeFlag = false ; if ( lxDist >= 0 && rxDist <= 0 ) inRangeFlag = true ; else if ( rxDist > 0 && lxDist <= 3 ) inRangeFlag = true ; else if ( lxDist < 0 && rxDist >= -2 ) inRangeFlag = true ; if ( inRangeFlag ) { this._ShowResizeBar( FCK.EditorWindow, FCKTools.GetElementAscensor( this._LeftCell, "table" ), { "x" : mouseX, "y" : mouseY } ) ; return ; } } var tagName = node.tagName.toLowerCase() ; if ( tagName != "table" && tagName != "td" && tagName != "th" ) { if ( this._LeftCell ) this._LeftCell = this._RightCell = this._TableMap = null ; this._HideResizeBar() ; return ; } node = FCKTools.GetElementAscensor( node, "table" ) ; var tableMap = FCKTableHandler._CreateTableMap( node ) ; var cellTuple = this._GetBorderCells( FCK.EditorWindow, node, tableMap, { "x" : mouseX, "y" : mouseY } ) ; if ( cellTuple == null ) { if ( this._LeftCell ) this._LeftCell = this._RightCell = this._TableMap = null ; this._HideResizeBar() ; } else { this._LeftCell = cellTuple["leftCell"] ; this._RightCell = cellTuple["rightCell"] ; this._TableMap = tableMap ; this._ShowResizeBar( FCK.EditorWindow, FCKTools.GetElementAscensor( this._LeftCell, "table" ), { "x" : mouseX, "y" : mouseY } ) ; } }, "_MouseDragHandler" : function( FCK, evt ) { var mouse = { "x" : evt.clientX, "y" : evt.clientY } ; // Convert mouse coordinates in reference to the outer iframe. var node = evt.srcElement || evt.target ; if ( FCKTools.GetElementDocument( node ) == FCK.EditorDocument ) { var offset = this._GetIframeOffset() ; mouse.x += offset.x ; mouse.y += offset.y ; } // Calculate the mouse position delta and see if we've gone out of range. if ( mouse.x >= this._MaximumX - 5 ) mouse.x = this._MaximumX - 5 ; if ( mouse.x <= this._MinimumX + 5 ) mouse.x = this._MinimumX + 5 ; var docX = mouse.x + FCKTools.GetScrollPosition( window ).X ; this._ResizeBar.style.left = ( docX - this._ResizeBar.offsetWidth / 2 ) + "px" ; this._LastX = mouse.x ; }, "_ShowResizeBar" : function( w, table, mouse ) { if ( this._ResizeBar == null ) { this._ResizeBar = this._doc.createElement( "div" ) ; var paddingBar = this._ResizeBar ; var paddingStyles = { 'position' : 'absolute', 'cursor' : 'e-resize' } ; if ( FCKBrowserInfo.IsIE ) paddingStyles.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=10,enabled=true)" ; else paddingStyles.opacity = 0.10 ; FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ; this._avoidStyles( paddingBar ); paddingBar.setAttribute('_fcktemp', true); this._doc.body.appendChild( paddingBar ) ; FCKTools.AddEventListener( paddingBar, "mousemove", this._ResizeBarMouseMoveListener ) ; FCKTools.AddEventListener( paddingBar, "mousedown", this._ResizeBarMouseDownListener ) ; FCKTools.AddEventListener( document, "mouseup", this._ResizeBarMouseUpListener ) ; FCKTools.AddEventListener( FCK.EditorDocument, "mouseup", this._ResizeBarMouseUpListener ) ; // IE doesn't let the tranparent part of the padding block to receive mouse events unless there's something inside. // So we need to create a spacer image to fill the block up. var filler = this._doc.createElement( "img" ) ; filler.setAttribute('_fcktemp', true); filler.border = 0 ; filler.src = FCKConfig.BasePath + "images/spacer.gif" ; filler.style.position = "absolute" ; paddingBar.appendChild( filler ) ; // Disable drag and drop, and selection for the filler image. var disabledListener = function( evt ) { if ( evt.preventDefault ) evt.preventDefault() ; else evt.returnValue = false ; } FCKTools.AddEventListener( filler, "dragstart", disabledListener ) ; FCKTools.AddEventListener( filler, "selectstart", disabledListener ) ; } var paddingBar = this._ResizeBar ; var offset = this._GetIframeOffset() ; var tablePos = this._GetTablePosition( w, table ) ; var barHeight = table.offsetHeight ; var barTop = offset.y + tablePos.y ; // Do not let the resize bar intrude into the toolbar area. if ( tablePos.y < 0 ) { barHeight += tablePos.y ; barTop -= tablePos.y ; } var bw = parseInt( table.border, 10 ) ; if ( isNaN( bw ) ) bw = 0 ; var cs = parseInt( table.cellSpacing, 10 ) ; if ( isNaN( cs ) ) cs = 0 ; var barWidth = Math.max( bw+100, cs+100 ) ; var paddingStyles = { 'top' : barTop + 'px', 'height' : barHeight + 'px', 'width' : barWidth + 'px', 'left' : ( offset.x + mouse.x + FCKTools.GetScrollPosition( w ).X - barWidth / 2 ) + 'px' } ; if ( FCKBrowserInfo.IsIE ) paddingBar.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 10 ; else paddingStyles.opacity = 0.1 ; FCKDomTools.SetElementStyles( paddingBar, paddingStyles ) ; var filler = paddingBar.getElementsByTagName( "img" )[0] ; FCKDomTools.SetElementStyles( filler, { width : paddingBar.offsetWidth + 'px', height : barHeight + 'px' } ) ; barWidth = Math.max( bw, cs, 3 ) ; var visibleBar = null ; if ( paddingBar.getElementsByTagName( "div" ).length < 1 ) { visibleBar = this._doc.createElement( "div" ) ; this._avoidStyles( visibleBar ); visibleBar.setAttribute('_fcktemp', true); paddingBar.appendChild( visibleBar ) ; } else visibleBar = paddingBar.getElementsByTagName( "div" )[0] ; FCKDomTools.SetElementStyles( visibleBar, { position : 'absolute', backgroundColor : 'blue', width : barWidth + 'px', height : barHeight + 'px', left : '50px', top : '0px' } ) ; }, "_HideResizeBar" : function() { if ( this._ResizeBar ) // IE bug: display : none does not hide the resize bar for some reason. // so set the position to somewhere invisible. FCKDomTools.SetElementStyles( this._ResizeBar, { top : '-100000px', left : '-100000px' } ) ; }, "_GetIframeOffset" : function () { return FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; }, "_GetTablePosition" : function ( w, table ) { return FCKTools.GetWindowPosition( w, table ) ; }, "_avoidStyles" : function( element ) { FCKDomTools.SetElementStyles( element, { padding : '0', backgroundImage : 'none', border : '0' } ) ; }, "Reset" : function() { FCKDragTableHandler._LeftCell = FCKDragTableHandler._RightCell = FCKDragTableHandler._TableMap = null ; } }; FCK.Events.AttachEvent( "OnMouseMove", FCKDragTableHandler.MouseMoveListener ) ; FCK.Events.AttachEvent( "OnAfterSetHTML", FCKDragTableHandler.Reset ) ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Plugin: automatically resizes the editor until a configurable maximun * height (FCKConfig.AutoGrowMax), based on its contents. */ var FCKAutoGrow = { MIN_HEIGHT : window.frameElement.offsetHeight, Check : function() { var delta = FCKAutoGrow.GetHeightDelta() ; if ( delta != 0 ) { var newHeight = window.frameElement.offsetHeight + delta ; newHeight = FCKAutoGrow.GetEffectiveHeight( newHeight ) ; if ( newHeight != window.frameElement.height ) { window.frameElement.style.height = newHeight + "px" ; // Gecko browsers use an onresize handler to update the innermost // IFRAME's height. If the document is modified before the onresize // is triggered, the plugin will miscalculate the new height. Thus, // forcibly trigger onresize. #1336 if ( typeof window.onresize == 'function' ) { window.onresize() ; } } } }, CheckEditorStatus : function( sender, status ) { if ( status == FCK_STATUS_COMPLETE ) FCKAutoGrow.Check() ; }, GetEffectiveHeight : function( height ) { if ( height < FCKAutoGrow.MIN_HEIGHT ) height = FCKAutoGrow.MIN_HEIGHT; else { var max = FCKConfig.AutoGrowMax; if ( max && max > 0 && height > max ) height = max; } return height; }, GetHeightDelta : function() { var oInnerDoc = FCK.EditorDocument ; var iFrameHeight ; var iInnerHeight ; if ( FCKBrowserInfo.IsIE ) { iFrameHeight = FCK.EditorWindow.frameElement.offsetHeight ; iInnerHeight = oInnerDoc.body.scrollHeight ; } else { iFrameHeight = FCK.EditorWindow.innerHeight ; iInnerHeight = oInnerDoc.body.offsetHeight + ( parseInt( FCKDomTools.GetCurrentElementStyle( oInnerDoc.body, 'margin-top' ), 10 ) || 0 ) + ( parseInt( FCKDomTools.GetCurrentElementStyle( oInnerDoc.body, 'margin-bottom' ), 10 ) || 0 ) ; } return iInnerHeight - iFrameHeight ; }, SetListeners : function() { if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) return ; FCK.EditorWindow.attachEvent( 'onscroll', FCKAutoGrow.Check ) ; FCK.EditorDocument.attachEvent( 'onkeyup', FCKAutoGrow.Check ) ; } }; FCK.AttachToOnSelectionChange( FCKAutoGrow.Check ) ; if ( FCKBrowserInfo.IsIE ) FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKAutoGrow.SetListeners ) ; FCK.Events.AttachEvent( 'OnStatusChange', FCKAutoGrow.CheckEditorStatus ) ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is a sample implementation for a custom Data Processor for basic BBCode. */ FCK.DataProcessor = { /* * Returns a string representing the HTML format of "data". The returned * value will be loaded in the editor. * The HTML must be from <html> to </html>, eventually including * the DOCTYPE. * @param {String} data The data to be converted in the * DataProcessor specific format. */ ConvertToHtml : function( data ) { // Convert < and > to their HTML entities. data = data.replace( /</g, '&lt;' ) ; data = data.replace( />/g, '&gt;' ) ; // Convert line breaks to <br>. data = data.replace( /(?:\r\n|\n|\r)/g, '<br>' ) ; // [url] data = data.replace( /\[url\](.+?)\[\/url]/gi, '<a href="$1">$1</a>' ) ; data = data.replace( /\[url\=([^\]]+)](.+?)\[\/url]/gi, '<a href="$1">$2</a>' ) ; // [b] data = data.replace( /\[b\](.+?)\[\/b]/gi, '<b>$1</b>' ) ; // [i] data = data.replace( /\[i\](.+?)\[\/i]/gi, '<i>$1</i>' ) ; // [u] data = data.replace( /\[u\](.+?)\[\/u]/gi, '<u>$1</u>' ) ; return '<html><head><title></title></head><body>' + data + '</body></html>' ; }, /* * Converts a DOM (sub-)tree to a string in the data format. * @param {Object} rootNode The node that contains the DOM tree to be * converted to the data format. * @param {Boolean} excludeRoot Indicates that the root node must not * be included in the conversion, only its children. * @param {Boolean} format Indicates that the data must be formatted * for human reading. Not all Data Processors may provide it. */ ConvertToDataFormat : function( rootNode, excludeRoot, ignoreIfEmptyParagraph, format ) { var data = rootNode.innerHTML ; // Convert <br> to line breaks. data = data.replace( /<br(?=[ \/>]).*?>/gi, '\r\n') ; // [url] data = data.replace( /<a .*?href=(["'])(.+?)\1.*?>(.+?)<\/a>/gi, '[url=$2]$3[/url]') ; // [b] data = data.replace( /<(?:b|strong)>/gi, '[b]') ; data = data.replace( /<\/(?:b|strong)>/gi, '[/b]') ; // [i] data = data.replace( /<(?:i|em)>/gi, '[i]') ; data = data.replace( /<\/(?:i|em)>/gi, '[/i]') ; // [u] data = data.replace( /<u>/gi, '[u]') ; data = data.replace( /<\/u>/gi, '[/u]') ; // Remove remaining tags. data = data.replace( /<[^>]+>/g, '') ; return data ; }, /* * Makes any necessary changes to a piece of HTML for insertion in the * editor selection position. * @param {String} html The HTML to be fixed. */ FixHtml : function( html ) { return html ; } } ; // This Data Processor doesn't support <p>, so let's use <br>. FCKConfig.EnterMode = 'br' ; // To avoid pasting invalid markup (which is discarded in any case), let's // force pasting to plain text. FCKConfig.ForcePasteAsPlainText = true ; // Rename the "Source" buttom to "BBCode". FCKToolbarItems.RegisterItem( 'Source', new FCKToolbarButton( 'Source', 'BBCode', null, FCK_TOOLBARITEM_ICONTEXT, true, true, 1 ) ) ; // Let's enforce the toolbar to the limits of this Data Processor. A custom // toolbar set may be defined in the configuration file with more or less entries. FCKConfig.ToolbarSets["Default"] = [ ['Source'], ['Bold','Italic','Underline','-','Link'], ['About'] ] ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Sample custom configuration settings used by the BBCode plugin. It simply * loads the plugin. All the rest is done by the plugin itself. */ // Add the BBCode plugin. FCKConfig.Plugins.Add( 'bbcode' ) ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This plugin register the required Toolbar items to be able to insert the * table commands in the toolbar. */ FCKToolbarItems.RegisterItem( 'TableInsertRowAfter' , new FCKToolbarButton( 'TableInsertRowAfter' , FCKLang.InsertRowAfter, null, null, null, true, 62 ) ) ; FCKToolbarItems.RegisterItem( 'TableDeleteRows' , new FCKToolbarButton( 'TableDeleteRows' , FCKLang.DeleteRows, null, null, null, true, 63 ) ) ; FCKToolbarItems.RegisterItem( 'TableInsertColumnAfter' , new FCKToolbarButton( 'TableInsertColumnAfter' , FCKLang.InsertColumnAfter, null, null, null, true, 64 ) ) ; FCKToolbarItems.RegisterItem( 'TableDeleteColumns' , new FCKToolbarButton( 'TableDeleteColumns', FCKLang.DeleteColumns, null, null, null, true, 65 ) ) ; FCKToolbarItems.RegisterItem( 'TableInsertCellAfter' , new FCKToolbarButton( 'TableInsertCellAfter' , FCKLang.InsertCellAfter, null, null, null, true, 58 ) ) ; FCKToolbarItems.RegisterItem( 'TableDeleteCells' , new FCKToolbarButton( 'TableDeleteCells' , FCKLang.DeleteCells, null, null, null, true, 59 ) ) ; FCKToolbarItems.RegisterItem( 'TableMergeCells' , new FCKToolbarButton( 'TableMergeCells' , FCKLang.MergeCells, null, null, null, true, 60 ) ) ; FCKToolbarItems.RegisterItem( 'TableHorizontalSplitCell' , new FCKToolbarButton( 'TableHorizontalSplitCell' , FCKLang.SplitCell, null, null, null, true, 61 ) ) ; FCKToolbarItems.RegisterItem( 'TableCellProp' , new FCKToolbarButton( 'TableCellProp' , FCKLang.CellProperties, null, null, null, true, 57 ) ) ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This plugin register Toolbar items for the combos modifying the style to * not show the box. */ FCKToolbarItems.RegisterItem( 'SourceSimple' , new FCKToolbarButton( 'Source', FCKLang.Source, null, FCK_TOOLBARITEM_ONLYICON, true, true, 1 ) ) ; FCKToolbarItems.RegisterItem( 'StyleSimple' , new FCKToolbarStyleCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ; FCKToolbarItems.RegisterItem( 'FontNameSimple' , new FCKToolbarFontsCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ; FCKToolbarItems.RegisterItem( 'FontSizeSimple' , new FCKToolbarFontSizeCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ; FCKToolbarItems.RegisterItem( 'FontFormatSimple', new FCKToolbarFontFormatCombo( null, FCK_TOOLBARITEM_ONLYTEXT ) ) ;
JavaScript
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Editor configuration settings. * * Follow this link for more information: * http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options */ FCKConfig.CustomConfigurationsPath = '' ; FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; FCKConfig.EditorAreaStyles = '' ; FCKConfig.ToolbarComboPreviewCSS = '' ; FCKConfig.DocType = '' ; FCKConfig.BaseHref = '' ; FCKConfig.FullPage = false ; // The following option determines whether the "Show Blocks" feature is enabled or not at startup. FCKConfig.StartupShowBlocks = false ; FCKConfig.Debug = false ; FCKConfig.AllowQueryStringDebug = true ; FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; FCKConfig.SkinEditorCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.SkinDialogCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ; FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; // FCKConfig.Plugins.Add( 'autogrow' ) ; // FCKConfig.Plugins.Add( 'dragresizetable' ); FCKConfig.AutoGrowMax = 400 ; // FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%> // FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code // FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control> FCKConfig.AutoDetectLanguage = true ; FCKConfig.DefaultLanguage = 'en' ; FCKConfig.ContentLangDirection = 'ltr' ; FCKConfig.ProcessHTMLEntities = true ; FCKConfig.IncludeLatinEntities = true ; FCKConfig.IncludeGreekEntities = true ; FCKConfig.ProcessNumericEntities = false ; FCKConfig.AdditionalNumericEntities = '' ; // Single Quote: "'" FCKConfig.FillEmptyBlocks = true ; FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ; FCKConfig.FormatIndentator = ' ' ; FCKConfig.EMailProtection = 'encode' ; // none | encode | function FCKConfig.EMailProtectionFunction = 'mt(NAME,DOMAIN,SUBJECT,BODY)' ; FCKConfig.StartupFocus = false ; FCKConfig.ForcePasteAsPlainText = false ; FCKConfig.AutoDetectPasteFromWord = true ; // IE only. FCKConfig.ShowDropDialog = true ; FCKConfig.ForceSimpleAmpersand = false ; FCKConfig.TabSpaces = 0 ; FCKConfig.ShowBorders = true ; FCKConfig.SourcePopup = false ; FCKConfig.ToolbarStartExpanded = true ; FCKConfig.ToolbarCanCollapse = true ; FCKConfig.IgnoreEmptyParagraphValue = true ; FCKConfig.FloatingPanelsZIndex = 10000 ; FCKConfig.HtmlEncodeOutput = false ; FCKConfig.TemplateReplaceAll = true ; FCKConfig.TemplateReplaceCheckbox = true ; FCKConfig.ToolbarLocation = 'In' ; FCKConfig.ToolbarSets["Default"] = [ ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'], '/', ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'], '/', ['Style','FontFormat','FontName','FontSize'], ['TextColor','BGColor'], ['FitWindow','ShowBlocks','-','About'] // No comma for the last row. ] ; FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; FCKConfig.EnterMode = 'p' ; // p | div | br FCKConfig.ShiftEnterMode = 'br' ; // p | div | br FCKConfig.Keystrokes = [ [ CTRL + 65 /*A*/, true ], [ CTRL + 67 /*C*/, true ], [ CTRL + 70 /*F*/, true ], [ CTRL + 83 /*S*/, true ], [ CTRL + 84 /*T*/, true ], [ CTRL + 88 /*X*/, true ], [ CTRL + 86 /*V*/, 'Paste' ], [ CTRL + 45 /*INS*/, true ], [ SHIFT + 45 /*INS*/, 'Paste' ], [ CTRL + 88 /*X*/, 'Cut' ], [ SHIFT + 46 /*DEL*/, 'Cut' ], [ CTRL + 90 /*Z*/, 'Undo' ], [ CTRL + 89 /*Y*/, 'Redo' ], [ CTRL + SHIFT + 90 /*Z*/, 'Redo' ], [ CTRL + 76 /*L*/, 'Link' ], [ CTRL + 66 /*B*/, 'Bold' ], [ CTRL + 73 /*I*/, 'Italic' ], [ CTRL + 85 /*U*/, 'Underline' ], [ CTRL + SHIFT + 83 /*S*/, 'Save' ], [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ; FCKConfig.BrowserContextMenuOnCtrl = false ; FCKConfig.BrowserContextMenu = false ; FCKConfig.EnableMoreFontColors = true ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ; FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ; FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ; FCKConfig.TemplatesXmlPath = FCKConfig.EditorPath + 'fcktemplates.xml' ; FCKConfig.SpellChecker = 'WSC' ; // 'WSC' | 'SpellerPages' | 'ieSpell' FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/download.php' ; FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ; // Available extension: .php .cfm .pl FCKConfig.FirefoxSpellChecker = false ; FCKConfig.MaxUndoLevels = 15 ; FCKConfig.DisableObjectResizing = false ; FCKConfig.DisableFFTableHandles = true ; FCKConfig.LinkDlgHideTarget = false ; FCKConfig.LinkDlgHideAdvanced = false ; FCKConfig.ImageDlgHideLink = false ; FCKConfig.ImageDlgHideAdvanced = false ; FCKConfig.FlashDlgHideAdvanced = false ; FCKConfig.ProtectedTags = '' ; // This will be applied to the body element of the editor FCKConfig.BodyId = '' ; FCKConfig.BodyClass = '' ; FCKConfig.DefaultStyleLabel = '' ; FCKConfig.DefaultFontFormatLabel = '' ; FCKConfig.DefaultFontLabel = '' ; FCKConfig.DefaultFontSizeLabel = '' ; FCKConfig.DefaultLinkTarget = '' ; // The option switches between trying to keep the html structure or do the changes so the content looks like it was in Word FCKConfig.CleanWordKeepsStructure = false ; // Only inline elements are valid. FCKConfig.RemoveFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' ; // Attributes that will be removed FCKConfig.RemoveAttributes = 'class,style,lang,width,height,align,hspace,valign' ; FCKConfig.CustomStyles = { 'Red Title' : { Element : 'h3', Styles : { 'color' : 'Red' } } }; // Do not add, rename or remove styles here. Only apply definition changes. FCKConfig.CoreStyles = { // Basic Inline Styles. 'Bold' : { Element : 'strong', Overrides : 'b' }, 'Italic' : { Element : 'em', Overrides : 'i' }, 'Underline' : { Element : 'u' }, 'StrikeThrough' : { Element : 'strike' }, 'Subscript' : { Element : 'sub' }, 'Superscript' : { Element : 'sup' }, // Basic Block Styles (Font Format Combo). 'p' : { Element : 'p' }, 'div' : { Element : 'div' }, 'pre' : { Element : 'pre' }, 'address' : { Element : 'address' }, 'h1' : { Element : 'h1' }, 'h2' : { Element : 'h2' }, 'h3' : { Element : 'h3' }, 'h4' : { Element : 'h4' }, 'h5' : { Element : 'h5' }, 'h6' : { Element : 'h6' }, // Other formatting features. 'FontFace' : { Element : 'span', Styles : { 'font-family' : '#("Font")' }, Overrides : [ { Element : 'font', Attributes : { 'face' : null } } ] }, 'Size' : { Element : 'span', Styles : { 'font-size' : '#("Size","fontSize")' }, Overrides : [ { Element : 'font', Attributes : { 'size' : null } } ] }, 'Color' : { Element : 'span', Styles : { 'color' : '#("Color","color")' }, Overrides : [ { Element : 'font', Attributes : { 'color' : null } } ] }, 'BackColor' : { Element : 'span', Styles : { 'background-color' : '#("Color","color")' } }, 'SelectionHighlight' : { Element : 'span', Styles : { 'background-color' : 'navy', 'color' : 'white' } } }; // The distance of an indentation step. FCKConfig.IndentLength = 40 ; FCKConfig.IndentUnit = 'px' ; // Alternatively, FCKeditor allows the use of CSS classes for block indentation. // This overrides the IndentLength/IndentUnit settings. FCKConfig.IndentClasses = [] ; // [ Left, Center, Right, Justified ] FCKConfig.JustifyClasses = [] ; // The following value defines which File Browser connector and Quick Upload // "uploader" to use. It is valid for the default implementaion and it is here // just to make this configuration file cleaner. // It is not possible to change this value using an external file or even // inline when creating the editor instance. In that cases you must set the // values of LinkBrowserURL, ImageBrowserURL and so on. // Custom implementations should just ignore it. var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py // Don't care about the following two lines. It just calculates the correct connector // extension to use for the default File Browser (Perl uses "cgi"). var _FileBrowserExtension = _FileBrowserLanguage == 'perl' ? 'cgi' : _FileBrowserLanguage ; var _QuickUploadExtension = _QuickUploadLanguage == 'perl' ? 'cgi' : _QuickUploadLanguage ; FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ; FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Flash' ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|flv)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; FCKConfig.SmileyColumns = 8 ; FCKConfig.SmileyWindowWidth = 320 ; FCKConfig.SmileyWindowHeight = 210 ; FCKConfig.BackgroundBlockerColor = '#ffffff' ; FCKConfig.BackgroundBlockerOpacity = 0.50 ; FCKConfig.MsWebBrowserControlCompat = false ; FCKConfig.PreventSubmitHandler = false ;
JavaScript
 Telerik.Web.UI.Editor.CommandList["SaveTemplate"] = function(commandName, editor, args) { var htmlText = editor.get_html(); argument = htmlText; var myCallbackFunction = function(sender, args) { }; editor.showExternalDialog( __textEditorSaveTemplateDialog, argument, 375, 275, myCallbackFunction, null, 'Save as Template', true, Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize, false, true); };
JavaScript
(function($) { $.fn.zebratable = function(options) { var defaults = { tblClass: 'dashboardGrid', altClass: 'dashboardTableAlt' }; var options = $.extend(defaults, options); return this.each(function() { // all of our tables need common spacing - this overcomes bug // in PropertyGrid which prevents you from assigning a CssClass in ascx file $(this).addClass('dashboardGrid'); // if the table has headers then start with odd rows so we don't highlight the header $(this).find(':has(th)').find('tr:odd').addClass('dashboardTableAlt'); // if the table doesn't have headers then start highlighting even rows so the top row is highlighted $(this).find(':not(:has(th))').find('tr:even').addClass('dashboardTableAlt'); }); }; /* Delegate function allows us to use Selectors to handle events. This allows us to use event bubbling and single event handler which improves perf and makes eventhandling more dynamic. */ $.delegate = function(rules) { return function(e) { var target = jQuery(e.target); for (var selector in rules) if (target.is(selector)) { return rules[selector].apply(this, jQuery.makeArray(arguments)); } } } /* // Simple JavaScript Templating // John Resig - http://ejohn.org/ - MIT Licensed */ var _cache = {}; $.template = function template(str, data) { // Figure out if we're getting a template, or if we need to // load the template - and be sure to cache the result. var fn = !/\W/.test(str) ? _cache[str] = cache[str] || template(document.getElementById(str).innerHTML) : // Generate a reusable function that will serve as a template // generator (and which will be cached). new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + // Introduce the data as local variables using with(){} "with(obj){p.push('" + // Convert the template into pure JavaScript str .replace(/[\r\t\n]/g, " ") .split("<#").join("\t") .replace(/((^|#>)[^\t]*)'/g, "$1\r") .replace(/\t=(.*?)#>/g, "',$1,'") .split("\t").join("');") .split("#>").join("p.push('") .split("\r").join("\\'") + "');}return p.join('');"); // Provide some basic currying to the user return data ? fn(data) : fn; }; })(jQuery); jQuery(document).ready(function($) { var dlg = $.template('<div id="<#=id#>" title="<#=title#> - <#=name#>" >Empty Dialog</div>') $('#dashboardTabs div[id$="-tab"]').hide(); $('#dashboardTabs div[id$="-tab"]:first').show(); $('#tablist li:first a').addClass('active'); $('#tablist li:first a').addClass('SubHead'); $('#dashboardTabs').click($.delegate({ '.dashboardTab': function(e) { $('#tablist li a').removeClass('active'); $('#tablist li a').removeClass('SubHead'); $(e.target).addClass('active'); $(e.target).addClass('SubHead'); var currentTab = $(e.target).attr('href'); $('#dashboardTabs div[id$="-tab"]').hide(); $(currentTab).show(); return false; } })); $('#dashboardTabs div[id$="-tab"] table').zebratable(); // clean up to avoid memory leaks in certain versions of IE 6 $(window).bind('unload', function() { $('#dashboardTabs').unbind('click'); }); });
JavaScript
function toggleDropDown(eventElement) { var choices = $get('SearchChoices'); if (isDropDownVisible) { choices.style.display='none'; isDropDownVisible = false; } else { choices.style.display='block'; isDropDownVisible = true; } } function selectSearch(eventElement) { toggleDropDown(eventElement); $get('SearchIcon').style.backgroundImage=dnn.getVar(eventElement.target.id+'Url'); /* We use 'W' and 'S' to keep our code consistent with the old search skin object */ if (eventElement.target.id.indexOf("Web") > 0) { dnn.setVar('SearchIconSelected', 'W'); } else { dnn.setVar('SearchIconSelected', 'S'); } } function searchHilite(eventElement) { eventElement.target.className='searchHilite'; } function searchDefault(eventElement) { eventElement.target.className='searchDefault'; } function initSearch() { var searchIcon = $get('SearchIcon'); if (dnn.getVar('SearchIconSelected') == 'S') { searchIcon.style.backgroundImage=dnn.getVar('SearchIconSiteUrl'); } else { searchIcon.style.backgroundImage=dnn.getVar('SearchIconWebUrl'); } $addHandler(searchIcon, 'click', toggleDropDown); var siteIcon = $get('SearchIconSite'); siteIcon.style.backgroundImage=dnn.getVar('SearchIconSiteUrl'); $addHandler(siteIcon, 'click', selectSearch); $addHandler(siteIcon, 'mouseover', searchHilite); $addHandler(siteIcon, 'mouseout', searchDefault); var webIcon = $get('SearchIconWeb'); webIcon.style.backgroundImage=dnn.getVar('SearchIconWebUrl'); $addHandler(webIcon, 'click', selectSearch); $addHandler(webIcon, 'mouseover', searchHilite); $addHandler(webIcon, 'mouseout', searchDefault); /* Set the default display style to resolve DOM bug */ $get('SearchChoices').style.display='none'; } var isDropDownVisible = false; initSearch();
JavaScript
/* DotNetNuke® - http://www.dotnetnuke.com Copyright (c) 2002-2010 by DotNetNuke Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' ----------------------------------------------------------------------------- ''' <summary> ''' This script renders a simple but graphically rich tab strip. ''' ''' Ensure that ~/Resources/Shared/scripts/init.js is called from the browser before calling this script ''' This script will fail if the required AJAX libraries loaded by init.js are not present. ''' </summary> ''' <remarks> ''' </remarks> ''' <history> ''' Version 1.0.0: Feb. 28, 2007, Nik Kalyani, nik.kalyani@dotnetnuke.com ''' </history> ''' ----------------------------------------------------------------------------- */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // T A B S T R I P // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: Namespace management Type.registerNamespace("DotNetNuke.UI.WebControls.TabStrip"); // END: Namespace management //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: Strip class // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// DotNetNuke.UI.WebControls.TabStrip.Strip = function(instanceVarName, containerId, clickHandler, context, theme, resourcesFolderUrl) { DotNetNuke.UI.WebControls.TabStrip.Strip.initializeBase(this, [instanceVarName, resourcesFolderUrl, theme]); this._control = "TabStrip"; this._theme = (typeof(theme) == "undefined" ? "Platinum" : theme); this._containerId = containerId; this._clickHandler = (typeof(clickHandler) == "undefined" ? "" : clickHandler); this._context = context; // This value is passed to the clickhandler as-is so the clickhandler has some context when the event is fired this._tabCollection = []; this._styleSheetLoaded = false; } DotNetNuke.UI.WebControls.TabStrip.Strip.prototype = { getContext : function() { return(this._context); }, getContainerId : function() { return(this._containerId); }, getClickHandler : function() { return(this._clickHandler); }, setContext : function(context) { this._context = context; }, setContainerId : function(containerId) { this._containerId = containerId; }, setClickHandler : function(clickHandler) { this._clickHandler = clickHandler; }, addTab : function(tabInfo) { if (typeof(tabInfo.getLabel) != "undefined") this._tabCollection[this._tabCollection.length] = tabInfo; }, removeTab : function(index) { if ((index < this._tabCollection.length) && (index > -1)) Array.removeAt(this._tabCollection, index); }, updateTab : function(index, tabInfo) { if ((index < this._tabCollection.length) && (index > -1) && (typeof(tabInfo.getLabel) != "undefined")) this._tabCollection[index] = tabInfo; }, setTabCollection : function(tabCollection) { var tabs = []; for(var t=0; t < tabCollection.length; t++) { // The only requirement for each item in the tabCollection is that // it implement a getLabel() method. if (typeof(tabCollection[t].getLabel) != "undefined") tabs[tabs.length] = tabCollection[t]; } this._tabCollection = tabs; }, getTabCollection : function() { return(this._tabCollection); }, // BEGIN: renderTabs // Renders a list of labels with a tabbed UI and injects the rendered HTML into the [containerId] element render : function(displayTabIndex) { var container = $get(this._containerId); if (!container) return; if (!this._styleSheetLoaded) { this.addStyleSheet(); this._styleSheetLoaded = true; } var selectedTabIndex = -99; try { var tabs = this._tabCollection; var stylePrefix = this.getStylePrefix(); if (tabs.length > 0) { if ((displayTabIndex != null) && (displayTabIndex < tabs.length)) selectedTabIndex = displayTabIndex; if (selectedTabIndex == -99) { //optional: add code to check for last viewed tab cookie } if (selectedTabIndex == -99) selectedTabIndex = 0; var tabHtml = new Sys.StringBuilder("<div class=\"" + stylePrefix + "TabsContainer\">"); tabHtml.append("<ul class=\"" + stylePrefix + "Tabs\">"); for(var t = 0; t < tabs.length; t++) { tabHtml.append("<li class='" + stylePrefix); var isSelected = (t == selectedTabIndex); if (t == 0) tabHtml.append((isSelected ? "Tabs-LeftSelected" : "Tabs-LeftNormal")); else { if (selectedTabIndex == (t-1)) tabHtml.append("Tabs-RightSelectedNormal"); else tabHtml.append((isSelected ? "Tabs-RightNormalSelected" : "Tabs-RightNormalNormal")); } tabHtml.append("'></li>"); tabHtml.append("<li class='Normal " + stylePrefix + (isSelected ? "Tabs-MiddleSelected" : "Tabs-MiddleNormal") + "'"); if (typeof(this._clickHandler) != "undefined") tabHtml.append(" onClick='" + this._instanceVarName + ".render(" + t + ")'"); tabHtml.append(">" + tabs[t].getLabel() + "</li>"); if (t == (tabs.length-1)) { tabHtml.append("<li class='" + stylePrefix); tabHtml.append((isSelected ? "Tabs-RightSelected" : "Tabs-RightNormal") + "'></li>"); } } tabHtml.append("</ul></div>"); container.innerHTML = tabHtml.toString(); } else container.innerHTML = "&nbsp;"; // optional: add code to set last viewed tab cookie; } catch(e) { container.innerHTML = e.message; } try { eval(this._clickHandler + "(\"" + this._context + "\"," + selectedTabIndex + ")"); } catch(e) { container.innerHTML = e.message; } } // END: render class } DotNetNuke.UI.WebControls.TabStrip.Strip.registerClass("DotNetNuke.UI.WebControls.TabStrip.Strip", DotNetNuke.UI.WebControls.BaseControl); // END: Strip class //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: TabInfo class // // Defines the structure for a single tab // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// DotNetNuke.UI.WebControls.TabStrip.TabInfo = function(label) { this._label = label; } DotNetNuke.UI.WebControls.TabStrip.TabInfo.prototype = { getLabel : function() // this is the only required data item for the TabStrip.TabInfo interface { return(this._label); } } DotNetNuke.UI.WebControls.TabStrip.TabInfo.registerClass("DotNetNuke.UI.WebControls.TabStrip.TabInfo"); // END: TabInfo class
JavaScript
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: SampleWidget class // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: Namespace management Type.registerNamespace("YourCompany.Widgets"); // END: Namespace management YourCompany.Widgets.SampleWidget = function(widget) { YourCompany.Widgets.SampleWidget.initializeBase(this, [widget]); } YourCompany.Widgets.SampleWidget.prototype = { // BEGIN: render render: function() { var params = this._widget.childNodes; if (params != null) { var text = "Default Text"; for (var p = 0; p < params.length; p++) { try { var paramName = params[p].name.toLowerCase(); switch (paramName) { case "text": text = params[p].value; break; } } catch (e) { } } } var div = document.createElement("div"); div.setAttribute("style", "width:100px;height:100px;border:solid 4px red"); div.innerHTML = text; $addHandler(div, "click", YourCompany.Widgets.SampleWidget.clickHandler); YourCompany.Widgets.SampleWidget.callBaseMethod(this, "render", [div]); } // END: render } YourCompany.Widgets.SampleWidget.clickHandler = function(sender) { var clickedObject = sender.target; alert("The widget with ID=" + clickedObject.id + " contains text \"" + clickedObject.innerHTML + "\""); } YourCompany.Widgets.SampleWidget.inheritsFrom(DotNetNuke.UI.WebControls.Widgets.BaseWidget); YourCompany.Widgets.SampleWidget.registerClass("YourCompany.Widgets.SampleWidget", DotNetNuke.UI.WebControls.Widgets.BaseWidget); DotNetNuke.UI.WebControls.Widgets.renderWidgetType("YourCompany.Widgets.SampleWidget"); // END: SampleWidget class
JavaScript
/* DotNetNuke® - http://www.dotnetnuke.com Copyright (c) 2002-2010 by DotNetNuke Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' ----------------------------------------------------------------------------- ''' <summary> ''' This script enables client-side rotation of content. ''' ''' Ensure that ~/Resources/Shared/scripts/init.js is called from the browser before calling this script ''' This script will fail if the required AJAX libraries loaded by init.js are not present. ''' </summary> ''' <remarks> ''' Based mostly on GreyWyvern's HTML content Scroller & Marquee script ''' Portions Copyright GreyWyvern 2007 ''' Licenced for free distribution under the BSDL ''' ''' Image blending code credit: ''' http://brainerror.net/scripts/javascript/blendtrans/ ''' </remarks> ''' <history> ''' Version 1.0.0: Feb. 28, 2007, Nik Kalyani, nik.kalyani@dotnetnuke.com ''' </history> ''' ----------------------------------------------------------------------------- */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // C O N T E N T R O T A T O R // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: Namespace management Type.registerNamespace("DotNetNuke.UI.WebControls.ContentRotator"); // END: Namespace management //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // BEGIN: Rotator class // //////////////////////////////////////////////////////////////////////////////////////////////////////////////// DotNetNuke.UI.WebControls.ContentRotator.Rotator = function(instanceVarName, containerId, width, height, direction, transition, interval, theme, resourcesFolderUrl) { DotNetNuke.UI.WebControls.ContentRotator.Rotator.initializeBase(this, [instanceVarName, resourcesFolderUrl, theme, ""]); this._control = "ContentRotator"; this._theme = (typeof(theme) == "undefined" ? "Simple" : theme); this._rssProxyUrl = (typeof(rssProxyUrl) == "undefined" ? "http://pipes.yahoo.com/pipes/Aqn6j8_H2xG4_N_1JhOy0Q/run?_render=json&_callback=[CALLBACK]&feedUrl=" : rssProxyUrl); this.addStyleSheet(); this._height = (typeof(height) == "undefined" ? 200 : height); this._width = (typeof(width) == "undefined" ? 400 : width); this._direction = (typeof(direction) == "undefined" ? "left" : (direction == "left" || direction == "right" || direction == "up" || direction == "down" || direction == "blend" ? direction : "left")); this._interval = (typeof(interval) == "undefined" ? 2500 : interval); this._transition = (typeof(transition) == "undefined" ? "slide" : (transition == "slide" || transition == "snap" ? transition : "slide")); this._container = $get(containerId); this._container.className = "Normal " + this.getStylePrefix() + "Container"; this._container.style.position = "relative"; this._container.style.width = this._width + "px"; this._container.style.height = this._height + "px"; this._container.style.display = "block"; this._container.innerHTML = this.displayLoader(); this._container.style.overflow = "hidden"; this._offset = (this._direction == "up" || this._direction == "down") ? this._height : this._width; this._content = []; this._contentprev = 0; this._contentcurr = 1; this._motion = false; this._mouse = false; this._pause = false; this._archive = null; this._init = true; } DotNetNuke.UI.WebControls.ContentRotator.Rotator.prototype = { isPaused : function() { return(this._pause); }, resume : function() { if (this._pause) { this._pause = false; // Make sure container is visible this._container.style.display = "block"; } }, pause : function(hide) { if (!this._pause) { this._pause = true; if (hide) this._container.style.display = "none"; } }, getContainer : function() { return(this._container); }, addContent : function(content) { if (this._direction == "blend") { this._content[this._content.length] = content; if (this._content.length == 1) { this._container.backgroundImage = "url('" + content + "')"; var img = document.createElement("img"); img.setAttribute("style","border:0; filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0"); img.style.width = this._width + "px"; img.style.height = this._height + "px"; img.style.position = "absolute"; img.style.top = "0"; img.style.left = "0"; img.src = content; img.id = this._container.id + "_img"; this._container.appendChild(img); this._contentcurr = 0; } } else { var div = document.createElement("div"); div.style.position = "absolute"; div.style.width = this._width + "px"; div.style.height = this._height + "px"; div.style.overflow = "hidden"; div.style.left = div.style.top = "0px"; switch (this._direction) { case "up": div.style.top = this._height + "px"; break; case "down": div.style.top = -(this._height + 2) + "px"; break; case "left": div.style.left = this._width + "px"; break; case "right": div.style.left = -(this._width + 2) + "px"; break; } div.innerHTML = content; this._container.appendChild(this._content[this._content.length] = div); } }, addFeedContent : function(url, attributeToUse) { // Create a new function var counter = 0; try { while(eval(this._instanceVarName + counter)) counter++; } catch(e) { } // Dynamically create a callback function and pass to it the instance name and callback data eval(this._instanceVarName + counter + " = new Function(\"data\", \"rssRenderingHandler('" + this._instanceVarName + "', data,'" + attributeToUse + "')\")"); var newScript = document.createElement("script"); newScript.type = "text/javascript"; newScript.src = this.getRssProxyUrl(this._instanceVarName + counter) + url.urlEncode(); document.getElementsByTagName("head")[0].appendChild(newScript); }, getRssProxyUrl : function(callback) { return(this._rssProxyUrl.replace("[CALLBACK]", callback)); }, // BEGIN: scrollLoop _scrollLoop : function() { if (this._content.length == 0) { var self = this; setTimeout ( self.getInstanceVarName() + "._scrollLoop()", 50 ); return false; } if (this._pause) return false; if (!this._motion && this._mouse) return false; if (this._offset == 1) { // Content has scrolled to its destination this._contentprev = this._contentcurr; this._contentcurr = (this._contentcurr + 1 >= this._content.length) ? 0 : this._contentcurr + 1; if (this._direction == "up" || this._direction == "down") { this._content[this._contentcurr].style.top = ((this._direction == "down") ? "-" : "") + this._height + "px"; this._content[this._contentprev].style.top = "0px"; this._offset = this._height; } else { this._content[this._contentcurr].style.left = ((this._direction == "right") ? "-" : "") + this._width + "px"; this._content[this._contentprev].style.left = "0px"; this._offset = this._width; } this._motion = false; } else { if (!this._motion) { this._motion = true; var x = -1; while (true) { if (Math.abs(this._offset) - Math.pow(2, ++x) <= Math.abs(this._offset) / 2) break; } this._offset = (this._direction == "up" || this._direction == "left") ? Math.pow(2, x) : -Math.pow(2, x); } else this._offset /= 2; if (this._transition == "snap") this._offset = 1; if (this._direction == "up" || this._direction == "down") { this._content[this._contentcurr].style.top = this._offset + "px"; this._content[this._contentprev].style.top = (((this._direction == "down") ? this._height : -(this._height + 2)) + this._offset) + "px"; } else { this._content[this._contentcurr].style.left = this._offset + "px"; this._content[this._contentprev].style.left = (((this._direction == "right") ? this._width : -(this._width + 2)) + this._offset) + "px"; } var self = this; setTimeout ( self.getInstanceVarName() + "._scrollLoop()", 30 ); } }, // END: scrollLoop // BEGIN: scroll scroll : function() { // while (this._container.firstChild) // this._container.removeChild(this._container.firstChild); var self = this; this._container.onmouseover = function() { self._mouse = true; } this._container.onmouseout = function() { self._mouse = false; } if (self._direction == "blend") { setInterval ( self.getInstanceVarName() + "._blendLoop()", self._interval ); return false; } else { if (self._init) { self._init = false; self._scrollLoop(); } setInterval ( self.getInstanceVarName() + "._scrollLoop()", self._interval ); } }, // END: scroll // BEGIN: _opacity _opacity: function(id, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; //determine the direction for the blending, if start and end are the same nothing happens if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("_changeOpacity(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("_changeOpacity(" + i + ",'" + id + "')",(timer * speed)); timer++; } } }, // END: _opacity // BEGIN: _changeOpacity //change the opacity for different browsers _changeOpacity: function(opacity, id) { var object = $get(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; }, // END: changeOpacity // BEGIN: _shiftOpacity _shiftOpacity: function(id, millisec) { //if an element is invisible, make it visible, else make it ivisible if ($get(id).style.opacity == 0) { _opacity(id, 0, 100, millisec); } else { _opacity(id, 100, 0, millisec); } }, // END: _shiftOpacity // BEGIN: _blendLoop _blendLoop: function() { var self = this; if (self._content.length == 1) return false; if (self._mouse) return(false); self._contentcurr++; self._blendImage(self._contentcurr, self._interval); if (self._contentcurr == (self._content.length-1)) self._contentcurr = 0; }, // END: _blendLoop // BEGIN: _blendImage _blendImage: function(contentItem, millisec) { var speed = Math.round(millisec / 100); var timer = 0; var imageId = this._container.id + "_img"; //set the current image as background this._container.style.backgroundImage = "url(" + $get(imageId).src + ")"; //make image transparent this._changeOpacity(0, imageId); //make new image $get(imageId).src = this._content[contentItem]; //fade in image var self = this; for(i = 0; i <= 100; i++) { setTimeout(self.getInstanceVarName() + "._changeOpacity(" + i + ",'" + imageId + "')",(timer * speed)); timer++; } setTimeout(self.getInstanceVarName() + "._blendLoop()",(100 * speed)); }, // END: _blendImage // BEGIN: _currentOpacity _currentOpacity: function(id, opacEnd, millisec) { //standard opacity is 100 var currentOpac = 100; //if the element has an opacity set, get it if($get(id).style.opacity < 100) currentOpac = $get(id).style.opacity * 100; //call for the function that changes the opacity _opacity(id, currentOpac, opacEnd, millisec); } } DotNetNuke.UI.WebControls.ContentRotator.Rotator.registerClass("DotNetNuke.UI.WebControls.ContentRotator.Rotator", DotNetNuke.UI.WebControls.BaseControl); // END: Rotator class function rssRenderingHandler(instanceVarName, result, attributeToUse) { var instance = eval(instanceVarName); if (result != null) { var itemCollection = result.value["items"]; for(var item in itemCollection) { var itemData = []; if (typeof(itemCollection[item]) == "object") { var ivalues = DotNetNuke.UI.WebControls.Utility.recurseElement("", itemCollection[item]); for(var iv in ivalues) itemData[iv] = ivalues[iv]; } else itemData[item] = itemCollection[item]; if (itemData[attributeToUse]) instance.addContent(itemData[attributeToUse]) } } }
JavaScript
function loadWidgets() { if (typeof (DotNetNuke) === "undefined") Type.registerNamespace("DotNetNuke.UI.WebControls"); if (typeof (DotNetNuke.UI.WebControls.Utility) === "undefined") jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/DotNetNukeAjaxShared.js", function() { jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js"); }); else jQuery.getScript($dnn.baseResourcesUrl + "Shared/scripts/widgets.js"); } if (typeof ($dnn) === "undefined") { $dnn = new Object(); $dnn.pageScripts = document.getElementsByTagName("script"); $dnn.scriptUrl = $dnn.pageScripts[$dnn.pageScripts.length - 1].src; $dnn.hostUrl = (typeof ($dnn.hostUrl) == "undefined" ? $dnn.scriptUrl.toLowerCase().replace("resources/shared/scripts/initwidgets.js", "") : $dnn.hostUrl); if (!$dnn.hostUrl.endsWith("/")) $dnn.hostUrl += "/"; $dnn.baseDnnScriptUrl = $dnn.hostUrl + "Resources/Shared/scripts/"; $dnn.baseResourcesUrl = $dnn.hostUrl + "Resources/"; } // jQuery dependency if (typeof (Sys) === "undefined") jQuery.getScript($dnn.baseDnnScriptUrl + "MSAJAX/MicrosoftAjax.js", loadWidgets()); else loadWidgets(); if ( Sys && Sys.Application ){ Sys.Application.notifyScriptLoaded(); }
JavaScript
// The following are supported template features: // // Tokens: A token is a namespace-prefixed RSS element name surrounded by double brackets. // Tokens are substituted with the actual value found for the corresponding element // in the RSS feed item. // // For example: [[title]] will be replaced with the RSS feed item title. // // Functions: If additional processing is required for each item, it is better to call a function // that returns the templatized tokens. This is done by making the template value be a // call to a function with the tokens as parameters. When rendering an item, token values // will be replaced and then the function will be eval'd. A function is indicated by @@ // in the first two character positions of the template. // // For example: @@test("[[title]]","[[link]]") // var htmlTemplates = []; var htmlHeaders = []; // Default template htmlTemplates['default'] = '<table width=\"100%\">' + '<tr>' + '<td class=\"Head\" align=\"left\" valign=\"middle\" style=\"padding-bottom:10px\"><a href=\"[[link]]\" target=\"_new\" class=\"Head\">[[title]]</a></td>' + '</tr>' + '<tr>' + '<td align=\"left\" valign=\"top\" class=\"Normal\">' + '[[description]]' + '</td>' + '</tr>' + '</table><br /><br />'; // Marketplace template htmlTemplates['marketplace'] = '@@marketplaceItemRenderer("[[title]]","[[link]]","[[description]]","[[enclosure.url]]",[[dnnmp:isReviewed]],"[[dnnmp:overview]]","[[dnnmp:vendor]]","[[dnnmp:vendorLink]]","[[dnnmp:price]]".split(".")[0])'; // DotNetNuke template htmlTemplates['dotnetnuke'] = '<table width=\"100%\">' + '<tr>' + '<td class=\"Head\" align=\"left\" valign=\"middle\" style=\"background-color:#cc0000;padding:5px\"><a href=\"[[link]]\" target=\"_new\" class=\"Head\" style=\"color:white\">[[title]]</a></td>' + '</tr>' + '<tr>' + '<td align=\"left\" valign=\"top\" class=\"Normal\" style=\"padding-top:5px\">' + '[[description]]' + '</td>' + '</tr>' + '</table><br /><br />'; // Hosting template htmlTemplates['hosting'] = '<table width=\"100%\">' + '<tr>' + '<td class=\"Head\" align=\"left\" valign=\"middle\" style=\"padding-bottom:10px\"><a href=\"[[link]]\" target=\"_new\" class=\"Head\">[[title]]</a></td>' + '</tr>' + '<tr>' + '<td align=\"left\" valign=\"top\" class=\"Normal\">' + '[[description]]' + '</td>' + '</tr>' + '</table><br /><br />'; htmlHeaders['dotnetnuke'] = '<div style=\"padding-bottom:5px;position:relative;top:-15px\"><a href=\"http://www.dotnetnuke.com\" target=\"_new\"><img src=\"http://www.dotnetnuke.com/portals/25/SolutionsExplorer/images/DNN-small.gif\" border=\"0\"></a></div>'; htmlHeaders['marketplace'] = '<div style=\"padding-bottom:5px;position:relative;top:-25px\"><a href=\"http://marketplace.dotnetnuke.com\" target=\"_new\"><img src=\"http://www.dotnetnuke.com/portals/25/SolutionsExplorer/images/DNNMarketplace-small.gif\" border=\"0\"></a></div>'; // Used by Marketplace template function marketplacePreviewHandler(url) { var previewBrowser = $get("PreviewBrowser"); previewBrowser.contentWindow.location.replace(url); previewBrowser.style.visibility = "hidden"; var preview = $get("PreviewContainer"); preview.style.display = "block"; previewBrowser.style.visibility = "visible"; } function marketplaceItemRenderer(title, url, description, imageUrl, isReviewed, overviewUrl, vendor, vendorUrl, price) { var itemTemplate = ''; if (isReviewed) { itemTemplate += '<!-- 0: Reviewed Product -->' + // Add a comment to force reviewed products to be grouped first '<table width=\"100%\" style=\"margin-bottom:15px\">' + '<tr>' + '<td colspan=\"2\" class=\"Head\" align=\"left\" valign=\"middle\" style=\"padding:5px;background-color:#ededed\"><img src=\"http://marketplace.dotnetnuke.com/reviewprogram/logos/reviewed-tiny.gif\" align="right"><a href=\"' + url + '\" target=\"_new\" class=\"Head\">' + title + '</a> <span class=\"Normal\"><br /><small> by <a href=\"' + vendorUrl + '\" target=\"_new\" class=\"Normal\">' + vendor + '</a></small></span></td>' + '</tr>' + '<tr>' + '<td align=\"center\" valign=\"top\" class=\"Normal\" style=\"width:100px;padding-top:10px\">' + '<img src=\"' + imageUrl + '\" width=\"100\">' + '<br /><p>from $' + price + '</p>' + '<p class=\"Head\">' + '<a href=\"javascript:void(0)\" onClick=\"marketplacePreviewHandler(\'' + overviewUrl + '\')\">Info</a> | ' + '<a href=\"' + url + '\" target=\"_new\">BUY</a> <br />' + '</p>'+ '</td>' + '<td align=\"left\" valign=\"top\" class=\"Normal\" style=\"padding-left:10px;padding-top:10px\">' + description + '</td>' + '</tr>' + '</table>'; } else { itemTemplate += '<!-- 1: Non-Reviewed Product -->' + // Add a comment to force non-reviewed products to be grouped first '<table width=\"100%\" cellspacing=\"0\" style=\"margin-bottom:15px\">' + '<tr>' + '<td class=\"Head\" width=\"80%\"align=\"left\" valign=\"middle\" style=\"padding:5px;background-color:#f3f3f3\"><a href=\"' + url + '\" target=\"_new\" class=\"SubHead\">' + title + '</a> <span class=\"Normal\"><br/><small> by <a href=\"' + vendorUrl + '\" target=\"_new\" class=\"Normal\">' + vendor + '</a></small></td>' + '<td class=\"Normal\" width=\"20%\" valign=\"middle\" style=\"padding:5px;background-color:#f3f3f3\">from $' + price + ' <a class=\"SubHead\" href=\"' + url + '\" target=\"_new\">BUY</a></span></td>' + '</tr>'; var firstSentence = description.indexOf(". "); if (firstSentence > -1) itemTemplate += '<tr>' + '<td colspan=\"2\" align=\"left\" valign=\"top\" class=\"Normal\" style=\"padding-top:10px\">' + description.substr(0, firstSentence+1) + '</td>' + '</tr>' + '</table>'; } return(itemTemplate); }
JavaScript
 // Fallback for Medium Trust when the main OPML file cannot be retrieved. function defaultFeedBrowser() { var tabs = []; with (DotNetNuke.UI.WebControls.FeedBrowser) { var tab2 = new TabInfo('Marketplace','http://marketplace.dotnetnuke.com/rssfeed.aspx?channel=marketplacesolutions&affiliateid=10054','marketplace'); var tab2_0 = tab2.addSection(new SectionInfo('Modules', 'http://marketplace.dotnetnuke.com/feed-sp-2-10054.aspx')); tab2_0.addCategory(new CategoryInfo('Community Management','http://marketplace.dotnetnuke.com/feed-sc-2-18-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Discussion/Forum','http://marketplace.dotnetnuke.com/feed-sc-2-19-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('Content Management','http://marketplace.dotnetnuke.com/feed-sc-2-2-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Data Management','http://marketplace.dotnetnuke.com/feed-sc-2-11-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('Document Management','http://marketplace.dotnetnuke.com/feed-sc-2-3-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('File Management','http://marketplace.dotnetnuke.com/feed-sc-2-6-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('eCommerce','http://marketplace.dotnetnuke.com/feed-sc-2-4-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Media Management','http://marketplace.dotnetnuke.com/feed-sc-2-5-10054.aspx',0)); tab2_0.setDefaultCategory(7); tab2_0.addCategory(new CategoryInfo('Image Viewer','http://marketplace.dotnetnuke.com/feed-sc-2-9-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('Photo Albums','http://marketplace.dotnetnuke.com/feed-sc-2-7-10054.aspx',1)); tab2_0.addCategory(new CategoryInfo('Multi-Language','http://marketplace.dotnetnuke.com/feed-sc-2-14-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Navigation','http://marketplace.dotnetnuke.com/feed-sc-2-10-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Skinning/CSS Management','http://marketplace.dotnetnuke.com/feed-sc-2-16-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Time Management','http://marketplace.dotnetnuke.com/feed-sc-2-17-10054.aspx',0)); tab2_0.addCategory(new CategoryInfo('Project Management','http://marketplace.dotnetnuke.com/feed-sc-2-8-10054.aspx',1)); var tab2_1 = tab2.addSection(new SectionInfo('Skins', 'http://marketplace.dotnetnuke.com/feed-sp-3-10054.aspx')); tab2_1.addCategory(new CategoryInfo('Skins','http://marketplace.dotnetnuke.com/feed-sc-3-20-10054.aspx',0)); tab2_1.setDefaultCategory(0); var tab2_2 = tab2.addSection(new SectionInfo('Other', 'http://marketplace.dotnetnuke.com/feed-sp-8-10054.aspx')); tabs[tabs.length] = tab2; var tab3 = new TabInfo('DotNetNuke','','dotnetnuke'); var tab3_0 = tab3.addSection(new SectionInfo('Projects', 'http://www.dotnetnuke.com/')); tab3_0.addCategory(new CategoryInfo('Modules','http://www.dotnetnuke.com/portals/25/SolutionsExplorer/Projects-Modules.xml',0)); tab3_0.addCategory(new CategoryInfo('Providers','http://www.dotnetnuke.com/portals/25/SolutionsExplorer/Projects-Providers.xml',0)); tab3_0.addCategory(new CategoryInfo('Utility','http://www.dotnetnuke.com/portals/25/SolutionsExplorer/Projects-Utility.xml',0)); tab3_0.addCategory(new CategoryInfo('Core','http://www.dotnetnuke.com/portals/25/SolutionsExplorer/Projects-Core.xml',0)); tab3_0.addCategory(new CategoryInfo('Component','http://www.dotnetnuke.com/portals/25/SolutionsExplorer/Projects-Component.xml',0)); tabs[tabs.length] = tab3; var tab4 = new TabInfo('About',''); var tab4_0 = tab4.addSection(new SectionInfo('Solutions Explorer', 'http://www.dotnetnuke.com/portals/25/SolutionsExplorer/SolutionsExplorerInfo.xml')); var tab4_1 = tab4.addSection(new SectionInfo('DotNetNuke Marketplace', 'http://www.dotnetnuke.com/portals/25/SolutionsExplorer/MarketplaceInfo.xml')); var tab4_2 = tab4.addSection(new SectionInfo('Coming Soon', 'http://www.dotnetnuke.com/portals/25/SolutionsExplorer/ComingSoon.xml')); tabs[tabs.length] = tab4; } return(tabs); }
JavaScript
jQuery(document).ready(function() { if (jQuery("input[value='LAYOUT'][checked]").length == 0) { var paneId = jQuery("select[id$='cboPanes'] option:selected").text(); var pane = jQuery("td[id$='" + paneId + "'],div[id$='" + paneId + "']"); var isHidden = (pane.height() < 2); if (isHidden) { pane.removeClass("DNNEmptyPane").append("<div class='_DNNRemove' style='height:0px' />"); jQuery("._DNNRemove").animate({ height: 29 }, "slow"); } var size = { width: (pane.width() < 150 ? 150 : pane.width()), height: (pane.height() < 25 ? 25 : pane.height()) }; var offset = pane.offset(); var highlight = jQuery('#dnnPaneHighlight'); if (highlight.length < 1) { highlight = jQuery("<div id='dnnPaneHighlight' style='position:absolute;border:2px dashed #333;text-align:center;font-weight:bold;font-size:1.2em;display:none;' />") .appendTo("#Body"); } highlight.css("top", offset.top) .css("left", offset.left) .width(size.width) .height(size.height) .text(paneId) .fadeIn(1000) .fadeOut(500); if (isHidden) { jQuery("._DNNRemove").animate({ opacity: 1.0 }, 100).animate({ height: 0 }, "slow", function() { jQuery(this).remove() }); pane.addClass("DNNEmptyPane"); } } });
JavaScript
(function($) { $.fn.dnnConsole = function(options) { var opts = $.extend({}, $.fn.dnnConsole.defaults, options); $(this).find("img").each(function() { this.style.borderWidth = "0px"; }); if (opts.showTooltip && opts.showDetails != "Show") { $(this).find("div > div").each(function() { var $this = $(this); var $title = $this.find("h3"); var $desc = $this.find("div"); var tooltip = ""; if ($title.length > 0) { tooltip = $title.text(); } if ($desc.length > 0) { if (tooltip != "") tooltip += " - "; tooltip += $desc.text(); } if (tooltip != "") this.title += tooltip; }); } function _changeView(jObj) { var style = opts.selectedSize == "IconFile" ? "console-small" : "console-large"; style += opts.showDetails == "Show" ? "-detail" : ""; if (opts.selectedSize == "IconFile") { $(jObj).find("div > div img").hide(); $(jObj).find("div > div img:first-child").show(); } else { $(jObj).find("div > div img").show(); $(jObj).find("div > div img:first-child").hide(); } $(jObj).find("div").removeClass(opts.currentClass).addClass(style); opts.currentClass = style; } $(this).find("div > div").bind( "click" , function() { if ($(this).children("a").length > 0) window.location.href = $(this).children("a")[0].href; } ); $(this).find("div > div").hover( function(e) { $(this).addClass("console-mouseon"); } , function(e) { $(this).removeClass("console-mouseon"); } ); var self = this; $(this).find("select").bind("change", function() { var data = ""; if (this.value == "IconFile" || this.value == "IconFileLarge") { opts.selectedSize = this.value; data = "CS=" + opts.selectedSize; } if (this.value == "Show" || this.value == "Hide") { opts.showDetails = this.value; data = "CV=" + opts.showDetails; } _changeView(self, opts); if (data != "") { if (opts.tabModuleID.toString() != "-1") { data = data + "&CTMID=" + opts.tabModuleID.toString(); $.ajax({ type: 'get', data: data, error: function() { return; }, success: function(msg) { return; } }); } } }); _changeView(this); //this[0].style.display = "inline"; return this; }; $.fn.dnnConsole.defaults = { allowIconSizeChange: true, allowDetailChange: true, selectedSize: 'IconFile', showDetails: 'Hide', showTooltip: true }; })(jQuery);
JavaScript
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } };
JavaScript
function mask_numero(e) { e.value=e.value.replace(/\D/g,''); } function mask_cpf(e) { e.value=e.value.replace(/\D/g,'').replace(/(\d{3})(\d)/,'$1.$2').replace(/(\d{3})(\d)/,'$1.$2').replace(/(\d{3})(\d{1,2})$/,'$1-$2'); } function mask_cnpj(e) { e.value=e.value.replace(/\D/g,'').replace(/^(\d{2})(\d)/,'$1.$2').replace(/^(\d{2})\.(\d{3})(\d)/,'$1.$2.$3').replace(/\.(\d{3})(\d)/,'.$1/$2').replace(/(\d{4})(\d)/,'$1-$2'); } function mask_site(e) { v=e.value.replace(/^http:\/\/?/,''); dominio=v; caminho=''; if(v.indexOf('/')>-1) dominio=v.split('/')[0]; caminho=v.replace(/[^\/]*/,''); dominio=dominio.replace(/[^\w\.\+-:@]/g,''); caminho=caminho.replace(/[^\w\d\+-@:\?&=%\(\)\.]/g,''); caminho=caminho.replace(/([\?&])=/,'$1'); if(caminho!='')dominio=dominio.replace(/\.+$/,''); v='http://'+dominio+caminho; e.value=v; if(e.value == 'http://') e.value = ''; e.onblur = function() { if(e.value == 'http://') e.value = ''; } } function mask_data(e) { e.value=e.value.replace(/\D/g,'').replace(/(\d{2})(\d)/,'$1/$2').replace(/(\d{2})(\d)/,'$1/$2'); } function mask_hora(e) { e.value=e.value.replace(/\D/g,'').replace(/^(\d{2})(\d)/,'$1:$2'); } function mask_telefone(e) { e.value=e.value.replace(/\D/g,'').replace(/^(\d{4})(\d)/,'$1-$2'); } function mask_ddd_telefone(e) { e.value=e.value.replace(/\D/g,'').replace(/^(\d\d)(\d)/g,'($1) $2').replace(/(\d{4})(\d)/,'$1-$2'); } function mask_cep(e) { e.value=e.value.replace(/\D/g,'').replace(/^(\d{5})(\d)/,'$1-$2'); } function mask_moeda(e) { e.value=e.value.replace(/\D/g,'').replace(/(\d{1})(\d{8})$/,'$1.$2').replace(/(\d{1})(\d{5})$/,'$1.$2').replace(/(\d{1})(\d{1,2})$/,'$1,$2'); } function mask_valcard(e) { e.value=e.value.replace(/\D/g,'').replace(/(\d{2})(\d)/,'$1/$2'); } function mask_card(e) { e.value=e.value.replace(/\D/g,'').replace(/(\d{4})(\d)/,'$1 $2').replace(/(\d{4})(\d)/,'$1 $2').replace(/(\d{4})(\d)/,'$1 $2'); }
JavaScript
var params = { menu: "false", wmode: "transparent", allowFullScreen: "true", allowScriptAccess: "always" }; $(function(){ $(".dropdown").selectmenu({style:'dropdown'}); });
JavaScript
/* * jQuery UI selectmenu * * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI */ (function($) { $.widget("ui.selectmenu", { _init: function() { var self = this, o = this.options; //quick array of button and menu id's this.ids = [this.element.attr('id') + '-' + 'button', this.element.attr('id') + '-' + 'menu']; //define safe mouseup for future toggling this._safemouseup = true; //create menu button wrapper this.newelement = $('<a class="'+ this.widgetBaseClass +' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+'" role="button" href="#" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>') .insertAfter(this.element); //transfer tabindex var tabindex = this.element.attr('tabindex'); if(tabindex){ this.newelement.attr('tabindex', tabindex); } //save reference to select in data for ease in calling methods this.newelement.data('selectelement', this.element); //menu icon this.selectmenuIcon = $('<span class="'+ this.widgetBaseClass +'-icon ui-icon"></span>') .prependTo(this.newelement) .addClass( (o.style == "popup")? 'ui-icon-triangle-2-n-s' : 'ui-icon-triangle-1-s' ); //make associated form label trigger focus $('label[for='+this.element.attr('id')+']') .attr('for', this.ids[0]) .bind('click', function(){ self.newelement[0].focus(); return false; }); //click toggle for menu visibility this.newelement .bind('mousedown', function(event){ self._toggle(event); //make sure a click won't open/close instantly if(o.style == "popup"){ self._safemouseup = false; setTimeout(function(){self._safemouseup = true;}, 300); } return false; }) .bind('click',function(){ return false; }) .keydown(function(event){ var ret = true; switch (event.keyCode) { case $.ui.keyCode.ENTER: ret = true; break; case $.ui.keyCode.SPACE: ret = false; self._toggle(event); break; case $.ui.keyCode.UP: case $.ui.keyCode.LEFT: ret = false; self._moveSelection(-1); break; case $.ui.keyCode.DOWN: case $.ui.keyCode.RIGHT: ret = false; self._moveSelection(1); break; case $.ui.keyCode.TAB: ret = true; break; default: ret = false; self._typeAhead(event.keyCode, 'mouseup'); break; } return ret; }) .bind('mouseover focus', function(){ $(this).addClass(self.widgetBaseClass+'-focus ui-state-hover'); }) .bind('mouseout blur', function(){ $(this).removeClass(self.widgetBaseClass+'-focus ui-state-hover'); }); //document click closes menu $(document) .mousedown(function(event){ self.close(event); }); //change event on original selectmenu this.element .click(function(){ this._refreshValue(); }) .focus(function(){ this.newelement[0].focus(); }); //create menu portion, append to body var cornerClass = (o.style == "dropdown")? " ui-corner-bottom" : " ui-corner-all" this.list = $('<ul class="' + self.widgetBaseClass + '-menu ui-widget ui-widget-content'+cornerClass+'" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo('body'); //serialize selectmenu element options var selectOptionData = []; this.element .find('option') .each(function(){ selectOptionData.push({ value: $(this).attr('value'), text: self._formatText(jQuery(this).text()), selected: $(this).attr('selected'), classes: $(this).attr('class'), parentOptGroup: $(this).parent('optgroup').attr('label') }); }); //active state class is only used in popup style var activeClass = (self.options.style == "popup") ? " ui-state-active" : ""; //write li's for(var i in selectOptionData){ var thisLi = $('<li role="presentation"><a href="#" tabindex="-1" role="option" aria-selected="false">'+ selectOptionData[i].text +'</a></li>') .data('index',i) .addClass(selectOptionData[i].classes) .data('optionClasses', selectOptionData[i].classes|| '') .mouseup(function(event){ if(self._safemouseup){ var changed = $(this).data('index') != self._selectedIndex(); self.value($(this).data('index')); self.select(event); if(changed){ self.change(event); } self.close(event,true); } return false; }) .click(function(){ return false; }) .bind('mouseover focus', function(){ self._selectedOptionLi().addClass(activeClass); self._focusedOptionLi().removeClass(self.widgetBaseClass+'-item-focus ui-state-hover'); $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover'); }) .bind('mouseout blur', function(){ if($(this).is( self._selectedOptionLi() )){ $(this).addClass(activeClass); } $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover'); }); //optgroup or not... if(selectOptionData[i].parentOptGroup){ var optGroupName = self.widgetBaseClass + '-group-' + selectOptionData[i].parentOptGroup; if(this.list.find('li.' + optGroupName).size()){ this.list.find('li.' + optGroupName + ':last ul').append(thisLi); } else{ $('<li role="presentation" class="'+self.widgetBaseClass+'-group '+optGroupName+'"><span class="'+self.widgetBaseClass+'-group-label">'+selectOptionData[i].parentOptGroup+'</span><ul></ul></li>') .appendTo(this.list) .find('ul') .append(thisLi); } } else{ thisLi.appendTo(this.list); } //this allows for using the scrollbar in an overflowed list this.list.bind('mousedown mouseup', function(){return false;}); //append icon if option is specified if(o.icons){ for(var j in o.icons){ if(thisLi.is(o.icons[j].find)){ thisLi .data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon') .addClass(self.widgetBaseClass + '-hasIcon'); var iconClass = o.icons[j].icon || ""; thisLi .find('a:eq(0)') .prepend('<span class="'+self.widgetBaseClass+'-item-icon ui-icon '+iconClass + '"></span>'); } } } } //add corners to top and bottom menu items this.list.find('li:last').addClass("ui-corner-bottom"); if(o.style == 'popup'){ this.list.find('li:first').addClass("ui-corner-top"); } //transfer classes to selectmenu and list if(o.transferClasses){ var transferClasses = this.element.attr('class') || ''; this.newelement.add(this.list).addClass(transferClasses); } //original selectmenu width var selectWidth = this.element.width(); //set menu button width this.newelement.width( (o.width) ? o.width : selectWidth); //set menu width to either menuWidth option value, width option value, or select width if(o.style == 'dropdown'){ this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width : selectWidth)); } else { this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width - o.handleWidth : selectWidth - o.handleWidth)); } //set max height from option if(o.maxHeight && o.maxHeight < this.list.height()){ this.list.height(o.maxHeight); } //save reference to actionable li's (not group label li's) this._optionLis = this.list.find('li:not(.'+ self.widgetBaseClass +'-group)'); //transfer menu click to menu button this.list .keydown(function(event){ var ret = true; switch (event.keyCode) { case $.ui.keyCode.UP: case $.ui.keyCode.LEFT: ret = false; self._moveFocus(-1); break; case $.ui.keyCode.DOWN: case $.ui.keyCode.RIGHT: ret = false; self._moveFocus(1); break; case $.ui.keyCode.HOME: ret = false; self._moveFocus(':first'); break; case $.ui.keyCode.PAGE_UP: ret = false; self._scrollPage('up'); break; case $.ui.keyCode.PAGE_DOWN: ret = false; self._scrollPage('down'); break; case $.ui.keyCode.END: ret = false; self._moveFocus(':last'); break; case $.ui.keyCode.ENTER: case $.ui.keyCode.SPACE: ret = false; self.close(event,true); $(event.target).parents('li:eq(0)').trigger('mouseup'); break; case $.ui.keyCode.TAB: ret = true; self.close(event,true); break; case $.ui.keyCode.ESCAPE: ret = false; self.close(event,true); break; default: ret = false; self._typeAhead(event.keyCode,'focus'); break; } return ret; }); //selectmenu style if(o.style == 'dropdown'){ this.newelement .addClass(self.widgetBaseClass+"-dropdown"); this.list .addClass(self.widgetBaseClass+"-menu-dropdown"); } else { this.newelement .addClass(self.widgetBaseClass+"-popup"); this.list .addClass(self.widgetBaseClass+"-menu-popup"); } //append status span to button this.newelement.prepend('<span class="'+self.widgetBaseClass+'-status">'+ selectOptionData[this._selectedIndex()].text +'</span>'); //hide original selectmenu element this.element.hide(); //transfer disabled state if(this.element.attr('disabled') == true){ this.disable(); } //update value this.value(this._selectedIndex()); }, destroy: function() { this.element.removeData(this.widgetName) .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') .removeAttr('aria-disabled'); //unbind click on label, reset its for attr $('label[for='+this.newelement.attr('id')+']') .attr('for',this.element.attr('id')) .unbind('click'); this.newelement.remove(); this.list.remove(); this.element.show(); }, _typeAhead: function(code, eventType){ var self = this; //define self._prevChar if needed if(!self._prevChar){ self._prevChar = ['',0]; } var C = String.fromCharCode(code); c = C.toLowerCase(); var focusFound = false; function focusOpt(elem, ind){ focusFound = true; $(elem).trigger(eventType); self._prevChar[1] = ind; }; this.list.find('li a').each(function(i){ if(!focusFound){ var thisText = $(this).text(); if( thisText.indexOf(C) == 0 || thisText.indexOf(c) == 0){ if(self._prevChar[0] == C){ if(self._prevChar[1] < i){ focusOpt(this,i); } } else{ focusOpt(this,i); } } } }); this._prevChar[0] = C; }, _uiHash: function(){ return { value: this.value() }; }, open: function(event){ var self = this; var disabledStatus = this.newelement.attr("aria-disabled"); if(disabledStatus != 'true'){ this._refreshPosition(); this._closeOthers(event); this.newelement .addClass('ui-state-active'); this.list .appendTo('body') .addClass(self.widgetBaseClass + '-open') .attr('aria-hidden', false) .find('li:not(.'+ self.widgetBaseClass +'-group):eq('+ this._selectedIndex() +') a')[0].focus(); if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); } this._refreshPosition(); this._trigger("open", event, this._uiHash()); } }, close: function(event, retainFocus){ if(this.newelement.is('.ui-state-active')){ this.newelement .removeClass('ui-state-active'); this.list .attr('aria-hidden', true) .removeClass(this.widgetBaseClass+'-open'); if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); } if(retainFocus){this.newelement[0].focus();} this._trigger("close", event, this._uiHash()); } }, change: function(event) { this.element.trigger('change'); this._trigger("change", event, this._uiHash()); }, select: function(event) { this._trigger("select", event, this._uiHash()); }, _closeOthers: function(event){ $('.'+ this.widgetBaseClass +'.ui-state-active').not(this.newelement).each(function(){ $(this).data('selectelement').selectmenu('close',event); }); $('.'+ this.widgetBaseClass +'.ui-state-hover').trigger('mouseout'); }, _toggle: function(event,retainFocus){ if(this.list.is('.'+ this.widgetBaseClass +'-open')){ this.close(event,retainFocus); } else { this.open(event); } }, _formatText: function(text){ return this.options.format ? this.options.format(text) : text; }, _selectedIndex: function(){ return this.element[0].selectedIndex; }, _selectedOptionLi: function(){ return this._optionLis.eq(this._selectedIndex()); }, _focusedOptionLi: function(){ return this.list.find('.'+ this.widgetBaseClass +'-item-focus'); }, _moveSelection: function(amt){ var currIndex = parseInt(this._selectedOptionLi().data('index'), 10); var newIndex = currIndex + amt; return this._optionLis.eq(newIndex).trigger('mouseup'); }, _moveFocus: function(amt){ if(!isNaN(amt)){ var currIndex = parseInt(this._focusedOptionLi().data('index'), 10); var newIndex = currIndex + amt; } else { var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); } if(newIndex < 0){ newIndex = 0; } if(newIndex > this._optionLis.size()-1){ newIndex = this._optionLis.size()-1; } var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); this._focusedOptionLi().find('a:eq(0)').attr('id',''); this._optionLis.eq(newIndex).find('a:eq(0)').attr('id',activeID)[0].focus(); this.list.attr('aria-activedescendant', activeID); }, _scrollPage: function(direction){ var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight()); numPerPage = (direction == 'up') ? -numPerPage : numPerPage; this._moveFocus(numPerPage); }, _setData: function(key, value) { this.options[key] = value; if (key == 'disabled') { this.close(); this.element .add(this.newelement) .add(this.list) [value ? 'addClass' : 'removeClass']( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled') .attr("aria-disabled", value); } }, value: function(newValue) { if (arguments.length) { this.element[0].selectedIndex = newValue; this._refreshValue(); this._refreshPosition(); } return this.element[0].selectedIndex; }, _refreshValue: function() { var activeClass = (this.options.style == "popup") ? " ui-state-active" : ""; var activeID = this.widgetBaseClass + '-item-' + Math.round(Math.random() * 1000); //deselect previous this.list .find('.'+ this.widgetBaseClass +'-item-selected') .removeClass(this.widgetBaseClass + "-item-selected" + activeClass) .find('a') .attr('aria-selected', 'false') .attr('id', ''); //select new this._selectedOptionLi() .addClass(this.widgetBaseClass + "-item-selected"+activeClass) .find('a') .attr('aria-selected', 'true') .attr('id', activeID); //toggle any class brought in from option var currentOptionClasses = this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : ""; var newOptionClasses = this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : ""; this.newelement .removeClass(currentOptionClasses) .data('optionClasses', newOptionClasses) .addClass( newOptionClasses ) .find('.'+this.widgetBaseClass+'-status') .html( this._selectedOptionLi() .find('a:eq(0)') .html() ); this.list.attr('aria-activedescendant', activeID) }, _refreshPosition: function(){ //set left value this.list.css('left', this.newelement.offset().left); //set top value var menuTop = this.newelement.offset().top; var scrolledAmt = this.list[0].scrollTop; this.list.find('li:lt('+this._selectedIndex()+')').each(function(){ scrolledAmt -= $(this).outerHeight(); }); if(this.newelement.is('.'+this.widgetBaseClass+'-popup')){ menuTop+=scrolledAmt; this.list.css('top', menuTop); } else { menuTop += this.newelement.height(); this.list.css('top', menuTop); } } }); $.extend($.ui.selectmenu, { getter: "value", version: "@VERSION", eventPrefix: "selectmenu", defaults: { transferClasses: true, style: 'popup', width: null, menuWidth: null, handleWidth: 26, maxHeight: null, icons: null, format: null } }); })(jQuery);
JavaScript
/** * dat.globe Javascript WebGL Globe Toolkit * http://dataarts.github.com/dat.globe * * Copyright 2011 Data Arts Team, Google Creative Lab * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 */ var DAT = DAT || {}; DAT.Globe = function(container, colorFn) { colorFn = colorFn || function(x) { var c = new THREE.Color(); c.setHSV( ( 0.6 - ( x * 0.5 ) ), 1.0, 1.0 ); return c; }; var Shaders = { 'earth' : { uniforms: { 'texture': { type: 't', value: 0, texture: null } }, vertexShader: [ 'varying vec3 vNormal;', 'varying vec2 vUv;', 'void main() {', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', 'vNormal = normalize( normalMatrix * normal );', 'vUv = uv;', '}' ].join('\n'), fragmentShader: [ 'uniform sampler2D texture;', 'varying vec3 vNormal;', 'varying vec2 vUv;', 'void main() {', 'vec3 diffuse = texture2D( texture, vUv ).xyz;', 'float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );', 'vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );', 'gl_FragColor = vec4( diffuse + atmosphere, 1.0 );', '}' ].join('\n') }, 'atmosphere' : { uniforms: {}, vertexShader: [ 'varying vec3 vNormal;', 'void main() {', 'vNormal = normalize( normalMatrix * normal );', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}' ].join('\n'), fragmentShader: [ 'varying vec3 vNormal;', 'void main() {', 'float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );', 'gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;', '}' ].join('\n') } }; var camera, scene, sceneAtmosphere, renderer, w, h; var vector, mesh, atmosphere, point; var overRenderer; var imgDir = '/globe/'; var curZoomSpeed = 0; var zoomSpeed = 50; var mouse = { x: 0, y: 0 }, mouseOnDown = { x: 0, y: 0 }; var rotation = { x: 0, y: 0 }, target = { x: Math.PI*3/2, y: Math.PI / 6.0 }, targetOnDown = { x: 0, y: 0 }; var distance = 100000, distanceTarget = 100000; var padding = 40; var PI_HALF = Math.PI / 2; function init() { container.style.color = '#fff'; container.style.font = '13px/20px Arial, sans-serif'; var shader, uniforms, material; w = container.offsetWidth || window.innerWidth; h = container.offsetHeight || window.innerHeight; camera = new THREE.Camera( 30, w / h, 1, 10000); camera.position.z = distance; vector = new THREE.Vector3(); scene = new THREE.Scene(); sceneAtmosphere = new THREE.Scene(); var geometry = new THREE.Sphere(200, 40, 30); shader = Shaders['earth']; uniforms = THREE.UniformsUtils.clone(shader.uniforms); uniforms['texture'].texture = THREE.ImageUtils.loadTexture(imgDir+'world' + '.jpg'); material = new THREE.MeshShaderMaterial({ uniforms: uniforms, vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader }); mesh = new THREE.Mesh(geometry, material); mesh.matrixAutoUpdate = false; scene.addObject(mesh); shader = Shaders['atmosphere']; uniforms = THREE.UniformsUtils.clone(shader.uniforms); material = new THREE.MeshShaderMaterial({ uniforms: uniforms, vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader }); mesh = new THREE.Mesh(geometry, material); mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.1; mesh.flipSided = true; mesh.matrixAutoUpdate = false; mesh.updateMatrix(); sceneAtmosphere.addObject(mesh); geometry = new THREE.Cube(0.75, 0.75, 1, 1, 1, 1, null, false, { px: true, nx: true, py: true, ny: true, pz: false, nz: true}); for (var i = 0; i < geometry.vertices.length; i++) { var vertex = geometry.vertices[i]; vertex.position.z += 0.5; } point = new THREE.Mesh(geometry); renderer = new THREE.WebGLRenderer({antialias: true}); renderer.autoClear = false; renderer.setClearColorHex(0x000000, 0.0); renderer.setSize(w, h); renderer.domElement.style.position = 'absolute'; container.appendChild(renderer.domElement); container.addEventListener('mousedown', onMouseDown, false); container.addEventListener('mousewheel', onMouseWheel, false); document.addEventListener('keydown', onDocumentKeyDown, false); window.addEventListener('resize', onWindowResize, false); container.addEventListener('mouseover', function() { overRenderer = true; }, false); container.addEventListener('mouseout', function() { overRenderer = false; }, false); } addData = function(data, opts) { var lat, lng, size, color, i, step, colorFnWrapper; opts.animated = opts.animated || false; this.is_animated = opts.animated; opts.format = opts.format || 'magnitude'; // other option is 'legend' console.log(opts.format); if (opts.format === 'magnitude') { step = 3; colorFnWrapper = function(data, i) { return colorFn(data[i+2]); } } else if (opts.format === 'legend') { step = 4; colorFnWrapper = function(data, i) { return colorFn(data[i+3]); } } else { throw('error: format not supported: '+opts.format); } if (opts.animated) { if (this._baseGeometry === undefined) { this._baseGeometry = new THREE.Geometry(); for (i = 0; i < data.length; i += step) { lat = data[i]; lng = data[i + 1]; // size = data[i + 2]; color = colorFnWrapper(data,i); size = 0; addPoint(lat, lng, size, color, this._baseGeometry); } } if(this._morphTargetId === undefined) { this._morphTargetId = 0; } else { this._morphTargetId += 1; } opts.name = opts.name || 'morphTarget'+this._morphTargetId; } var subgeo = new THREE.Geometry(); for (i = 0; i < data.length; i += step) { lat = data[i]; lng = data[i + 1]; color = colorFnWrapper(data,i); size = data[i + 2]; size = size*200; addPoint(lat, lng, size, color, subgeo); } if (opts.animated) { this._baseGeometry.morphTargets.push({'name': opts.name, vertices: subgeo.vertices}); } else { this._baseGeometry = subgeo; } }; function createPoints() { if (this._baseGeometry !== undefined) { if (this.is_animated === false) { this.points = new THREE.Mesh(this._baseGeometry, new THREE.MeshBasicMaterial({ color: 0xffffff, vertexColors: THREE.FaceColors, morphTargets: false })); } else { if (this._baseGeometry.morphTargets.length < 8) { console.log('t l',this._baseGeometry.morphTargets.length); var padding = 8-this._baseGeometry.morphTargets.length; console.log('padding', padding); for(var i=0; i<=padding; i++) { console.log('padding',i); this._baseGeometry.morphTargets.push({'name': 'morphPadding'+i, vertices: this._baseGeometry.vertices}); } } this.points = new THREE.Mesh(this._baseGeometry, new THREE.MeshBasicMaterial({ color: 0xffffff, vertexColors: THREE.FaceColors, morphTargets: true })); } scene.addObject(this.points); } } function addPoint(lat, lng, size, color, subgeo) { var phi = (90 - lat) * Math.PI / 180; var theta = (180 - lng) * Math.PI / 180; point.position.x = 200 * Math.sin(phi) * Math.cos(theta); point.position.y = 200 * Math.cos(phi); point.position.z = 200 * Math.sin(phi) * Math.sin(theta); point.lookAt(mesh.position); point.scale.z = -size; point.updateMatrix(); var i; for (i = 0; i < point.geometry.faces.length; i++) { point.geometry.faces[i].color = color; } GeometryUtils.merge(subgeo, point); } function onMouseDown(event) { event.preventDefault(); container.addEventListener('mousemove', onMouseMove, false); container.addEventListener('mouseup', onMouseUp, false); container.addEventListener('mouseout', onMouseOut, false); mouseOnDown.x = - event.clientX; mouseOnDown.y = event.clientY; targetOnDown.x = target.x; targetOnDown.y = target.y; container.style.cursor = 'move'; } function onMouseMove(event) { mouse.x = - event.clientX; mouse.y = event.clientY; var zoomDamp = distance/1000; target.x = targetOnDown.x + (mouse.x - mouseOnDown.x) * 0.005 * zoomDamp; target.y = targetOnDown.y + (mouse.y - mouseOnDown.y) * 0.005 * zoomDamp; target.y = target.y > PI_HALF ? PI_HALF : target.y; target.y = target.y < - PI_HALF ? - PI_HALF : target.y; } function onMouseUp(event) { container.removeEventListener('mousemove', onMouseMove, false); container.removeEventListener('mouseup', onMouseUp, false); container.removeEventListener('mouseout', onMouseOut, false); container.style.cursor = 'auto'; } function onMouseOut(event) { container.removeEventListener('mousemove', onMouseMove, false); container.removeEventListener('mouseup', onMouseUp, false); container.removeEventListener('mouseout', onMouseOut, false); } function onMouseWheel(event) { event.preventDefault(); if (overRenderer) { zoom(event.wheelDeltaY * 0.3); } return false; } function onDocumentKeyDown(event) { switch (event.keyCode) { case 38: zoom(100); event.preventDefault(); break; case 40: zoom(-100); event.preventDefault(); break; } } function onWindowResize( event ) { console.log('resize'); camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); } function zoom(delta) { distanceTarget -= delta; distanceTarget = distanceTarget > 1000 ? 1000 : distanceTarget; distanceTarget = distanceTarget < 350 ? 350 : distanceTarget; } function animate() { requestAnimationFrame(animate); render(); } function render() { zoom(curZoomSpeed); rotation.x += (target.x - rotation.x) * 0.1; rotation.y += (target.y - rotation.y) * 0.1; distance += (distanceTarget - distance) * 0.3; camera.position.x = distance * Math.sin(rotation.x) * Math.cos(rotation.y); camera.position.y = distance * Math.sin(rotation.y); camera.position.z = distance * Math.cos(rotation.x) * Math.cos(rotation.y); vector.copy(camera.position); renderer.clear(); renderer.render(scene, camera); renderer.render(sceneAtmosphere, camera); } init(); this.animate = animate; this.__defineGetter__('time', function() { return this._time || 0; }); this.__defineSetter__('time', function(t) { var validMorphs = []; var morphDict = this.points.morphTargetDictionary; for(var k in morphDict) { if(k.indexOf('morphPadding') < 0) { validMorphs.push(morphDict[k]); } } validMorphs.sort(); var l = validMorphs.length-1; var scaledt = t*l+1; var index = Math.floor(scaledt); for (i=0;i<validMorphs.length;i++) { this.points.morphTargetInfluences[validMorphs[i]] = 0; } var lastIndex = index - 1; var leftover = scaledt - index; if (lastIndex >= 0) { this.points.morphTargetInfluences[lastIndex] = 1 - leftover; } this.points.morphTargetInfluences[index] = leftover; this._time = t; }); this.addData = addData; this.createPoints = createPoints; this.renderer = renderer; this.scene = scene; return this; };
JavaScript
var total_bnr = 14; var actual_time = new Date() var second = actual_time.getSeconds() var show_the_bnr = second % total_bnr; show_the_bnr +=1; if (show_the_bnr==1) { url="http://goo.gl/ffwiE"; alt="MAU PENIS BESAR SEPERTI BINTANG PORNO?"; bnr="http://www.cweb-pix.com/images/2012/11/06/tLUB1.gif"; width="250"; height="400"; } if (show_the_bnr==2) { url="http://goo.gl/ffwiE"; alt="SERUNYA BIKIN KAGET ISTRI DENGAN PENIS BESAR"; bnr="http://www.cweb-pix.com/images/2012/11/06/zRQwA.gif"; width="250"; height="400"; } if (show_the_bnr==3) { url="http://goo.gl/ffwiE"; alt="PENIS PANJANG ISTRI PUN SENANG, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/5CDzJ.gif"; width="250"; height="400"; } if (show_the_bnr==4) { url="http://goo.gl/ffwiE"; alt="DIAMETER 16 CM PANJANG 19 CM, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/yZYM4.gif"; width="250"; height="400"; } if (show_the_bnr==5) { url="http://goo.gl/ffwiE"; alt="JANGAN HARAP BISA DOGGY STYLE KALO CUMA 14 CM"; bnr="http://www.cweb-pix.com/images/2012/11/06/EeuS.gif"; width="250"; height="400"; } if (show_the_bnr==6) { url="http://goo.gl/ffwiE"; alt="PANJANG 14 SENTI JANGAN HARAP BISA KAYAK GINI"; bnr="http://www.cweb-pix.com/images/2012/11/06/ToJwK.gif"; width="250"; height="400"; } if (show_the_bnr==7) { url="http://goo.gl/ffwiE"; alt="PENIS KERAS ISTRI LEMAS, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/shq5x.gif"; width="250"; height="400"; } if (show_the_bnr==8) { url="http://goo.gl/ffwiE"; alt="PENIS KERAS ISTRI GEMAS, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/ZnGV7.gif"; width="250"; height="400"; } if (show_the_bnr==9) { url="http://goo.gl/ffwiE"; alt="PENIS RAKSASA MENUSUK VAGINA, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/04SMB.gif"; width="250"; height="400"; } if (show_the_bnr==10) { url="http://goo.gl/ffwiE"; alt="PENIS TANGGUH MINIMAL 5 RONDE, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/cjb4V.gif"; width="250"; height="400"; } if (show_the_bnr==11) { url="http://goo.gl/ffwiE"; alt="PENIS MENEKAN ISTRI MERINTIH KEENAKAN, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/qdapM.gif"; width="250"; height="400"; } if (show_the_bnr==12) { url="http://goo.gl/ffwiE"; alt="GAYA INI BUTUH PENIS 18 SENTI, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/z9WI.gif"; width="250"; height="400"; } if (show_the_bnr==13) { url="http://goo.gl/ffwiE"; alt="PENIS AMPUH MULUT PENUH, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/LAnra.gif"; width="250"; height="400"; } if (show_the_bnr==14) { url="http://goo.gl/ffwiE"; alt="PENIS KUAT BATANGNYA BERURAT, MAU?"; bnr="http://www.cweb-pix.com/images/2012/11/06/CZQqP.gif"; width="250"; height="400"; } document.write('<center>'); document.write('<a href=\"' + url + '\" target=\"_top\">'); document.write('<img src=\"' + bnr + '\" width=') document.write(width + ' height=' + height + ' '); document.write('alt=\"' + alt + '\" border=0><br>'); document.write('</center>');
JavaScript
// Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults
JavaScript
function $(element) { if (typeof element == "string") { element=document.getElementById(element); } if (element) extend_instance(element,Element); return element; } function extend_instance(instance,hash) { for (var name in hash) { instance[name] = hash[name]; } } var Element = { "hide": function () { this.setStyle("display","none") }, "show": function () { this.setStyle("display","block") }, "visible": function () { return (this.getStyle("display") != "none"); }, "toggle": function () { if (this.visible) { this.hide(); } else { this.show(); } } }; function encodeURIComponent(str) { if (typeof(str) == "string") { return str.replace(/=/g,'%3D').replace(/&/g,'%26'); } //checkboxes and radio buttons return objects instead of a string else if(typeof(str) == "object"){ for (prop in str) { return str[prop].replace(/=/g,'%3D').replace(/&/g,'%26'); } } }; var Form = {}; Form.serialize = function(form_element) { elements=$(form_element).serialize(); param_string=""; for (var name in elements) { if (param_string) param_string += "&"; param_string += encodeURIComponent(name)+"="+encodeURIComponent(elements[name]); } return param_string; }; Ajax.Updater = function (container,url,options) { this.container = container; this.url=url; this.ajax = new Ajax(); this.ajax.requireLogin = 1; if (options["onSuccess"]) { this.ajax.responseType = Ajax.JSON; this.ajax.ondone = options["onSuccess"]; } else { this.ajax.responseType = Ajax.FBML; this.ajax.ondone = function(data) { $(container).setInnerFBML(data); } } if (options["onFailure"]) { this.ajax.onerror = options["onFailure"]; } // Yes, this is an excercise in undoing what we just did // FB doesn't provide encodeURI, but they will encode things passed as a hash // so we turn it into a string, esaping & and = // then we split it all back out here // this could be killed if encodeURIComponent was available parameters={}; if (options['parameters']) { pairs=options['parameters'].split('&'); for (var i=0; i<pairs.length; i++) { kv=pairs[i].split('='); key=kv[0].replace(/%3D/g,'=').replace(/%26/g,'&'); val=kv[1].replace(/%3D/g,'=').replace(/%26/g,'&'); parameters[key]=val; } } this.ajax.post(url,parameters); if (options["onLoading"]) { options["onLoading"].call() } }; Ajax.Request = function(url,options) { Ajax.Updater('unused',url,options); }; PeriodicalExecuter = function (callback, frequency) { setTimeout(callback, frequency *1000); setTimeout(function() { new PeriodicalExecuter(callback,frequency); }, frequency*1000); };
JavaScript
function do_ajax(type,base_url,controller,sid) { var ajax = new Ajax(); ajax.responseType = type; switch (type) { case Ajax.JSON: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data.message + ' The current time is: ' + data.time + '. '); document.getElementById('ajax2').setInnerFBML(data.fbml_test); } break; case Ajax.FBML: ajax.ondone = function(data) { document.getElementById('render_layout_' + sid).setInnerFBML(data); document.getElementById('render_layout_' + sid).setStyle('display','on'); document.getElementById('indicator_' + sid).setStyle('display','none'); } break; case Ajax.RAW: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data); document.getElementById('ajax2').setTextValue(''); } break; } ajax.requireLogin = true; ajax.post('http://' + base_url + '/' + controller + '?sid=' + sid ); } function showDialog(url, title, ok, cancel) { // Set the default pop-up dialog values for those not supplied. if (title === undefined) { title = "Dialog"; } if (ok === undefined) { ok = "Okay"; } if (cancel === undefined) { cancel = "Cancel"; } // Build the AJAX object to request the dialog contents. var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.requireLogin = true; ajax.ondone = function(data) { // Fill the Dialog's DIV element with the FBML returned by the AJAX request. // This will overwrite the loading message FBML currently nested in the DIV. document.getElementById('dialog_content').setInnerFBML(data); }; // Create a "loading" dialog box that will be updated via the AJAX request. dialog = new Dialog().showChoice(title, dialog_fbml, ok, cancel); dialog.onconfirm = function() { // Submit the Dialog's form if it exists, then hide the dialog. frm = document.getElementById('dialog_form'); if (frm) { frm.submit(); } dialog.hide(); }; // Update the dialog contents via Mock AJAX request. ajax.post('http://' + url); } function toggle_expend(sid){ } function dismiss_ajax(type,id) { var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.ondone = function(data) { //document.getElementById('comments_layout_' + sid).setInnerFBML(data); } ajax.requireLogin = true; ajax.post('http://9a860085.fb.joyent.us/users/hide_' + type + '?id='+id); }
JavaScript
// Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults
JavaScript
function $(element) { if (typeof element == "string") { element=document.getElementById(element); } if (element) extend_instance(element,Element); return element; } function extend_instance(instance,hash) { for (var name in hash) { instance[name] = hash[name]; } } var Element = { "hide": function () { this.setStyle("display","none") }, "show": function () { this.setStyle("display","block") }, "visible": function () { return (this.getStyle("display") != "none"); }, "toggle": function () { if (this.visible) { this.hide(); } else { this.show(); } } }; function encodeURIComponent(str) { if (typeof(str) == "string") { return str.replace(/=/g,'%3D').replace(/&/g,'%26'); } //checkboxes and radio buttons return objects instead of a string else if(typeof(str) == "object"){ for (prop in str) { return str[prop].replace(/=/g,'%3D').replace(/&/g,'%26'); } } }; var Form = {}; Form.serialize = function(form_element) { elements=$(form_element).serialize(); param_string=""; for (var name in elements) { if (param_string) param_string += "&"; param_string += encodeURIComponent(name)+"="+encodeURIComponent(elements[name]); } return param_string; }; Ajax.Updater = function (container,url,options) { this.container = container; this.url=url; this.ajax = new Ajax(); this.ajax.requireLogin = 1; if (options["onSuccess"]) { this.ajax.responseType = Ajax.JSON; this.ajax.ondone = options["onSuccess"]; } else { this.ajax.responseType = Ajax.FBML; this.ajax.ondone = function(data) { $(container).setInnerFBML(data); } } if (options["onFailure"]) { this.ajax.onerror = options["onFailure"]; } // Yes, this is an excercise in undoing what we just did // FB doesn't provide encodeURI, but they will encode things passed as a hash // so we turn it into a string, esaping & and = // then we split it all back out here // this could be killed if encodeURIComponent was available parameters={}; if (options['parameters']) { pairs=options['parameters'].split('&'); for (var i=0; i<pairs.length; i++) { kv=pairs[i].split('='); key=kv[0].replace(/%3D/g,'=').replace(/%26/g,'&'); val=kv[1].replace(/%3D/g,'=').replace(/%26/g,'&'); parameters[key]=val; } } this.ajax.post(url,parameters); if (options["onLoading"]) { options["onLoading"].call() } }; Ajax.Request = function(url,options) { Ajax.Updater('unused',url,options); }; PeriodicalExecuter = function (callback, frequency) { setTimeout(callback, frequency *1000); setTimeout(function() { new PeriodicalExecuter(callback,frequency); }, frequency*1000); };
JavaScript
//This function highlights the selected team function selectTeam(dom,teamID) { if(dom.hasClassName("team-selected")) { dom.removeClassName("team-selected"); } else { dom.addClassName("team-selected"); } } function flashDiv(obj,endcolor){ Animation(obj).duration(2000).to('background', endcolor).from('background', '#ffa').go(); } function shiftSideBar(obj, y){ var cTop = document.getRootElement().getAbsoluteTop(); //console.log(obj.getAbsoluteTop(), y, cTop); var shift = y- obj.getAbsoluteTop(); Animation(obj).by('top', shift+'px').go(); } function do_ajax(type,base_url,controller,sid) { var ajax = new Ajax(); ajax.responseType = type; switch (type) { case Ajax.JSON: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data.message + ' The current time is: ' + data.time + '. '); document.getElementById('ajax2').setInnerFBML(data.fbml_test); } break; case Ajax.FBML: ajax.ondone = function(data) { //document.getElementById('render_layout_' + sid).setInnerFBML(data); //document.getElementById('render_layout_' + sid).setStyle('display','on'); //document.getElementById('indicator_' + sid).setStyle('display','none'); document.getElementById('render_'+controller+'_layout_' + sid).setInnerFBML(data); //document.getElementById('render_'+controller+'_layout_' + sid).setStyle('display','block'); document.getElementById(controller+'_indicator_' + sid).setStyle('display','none'); } break; case Ajax.RAW: ajax.ondone = function(data) { document.getElementById('ajax1').setTextValue(data); document.getElementById('ajax2').setTextValue(''); } break; } ajax.requireLogin = true; ajax.post('http://' + base_url + '/' + controller + '?sid=' + sid ); } function showDialog(url, title, ok, cancel) { // Set the default pop-up dialog values for those not supplied. if (title === undefined) { title = "Dialog"; } if (ok === undefined) { ok = "Okay"; } if (cancel === undefined) { cancel = "Cancel"; } // Build the AJAX object to request the dialog contents. var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.requireLogin = true; ajax.ondone = function(data) { // Fill the Dialog's DIV element with the FBML returned by the AJAX request. // This will overwrite the loading message FBML currently nested in the DIV. document.getElementById('dialog_content').setInnerFBML(data); }; // Create a "loading" dialog box that will be updated via the AJAX request. dialog = new Dialog().showChoice(title, dialog_fbml, ok, cancel); dialog.onconfirm = function() { // Submit the Dialog's form if it exists, then hide the dialog. frm = document.getElementById('dialog_form'); if (frm) { frm.submit(); } dialog.hide(); }; // Update the dialog contents via Mock AJAX request. ajax.post('http://' + url); } function toggle_expend(sid){ } function dismiss_ajax(base_url,type,id) { var ajax = new Ajax(); ajax.responseType = Ajax.FBML; ajax.ondone = function(data) { //document.getElementById('comments_layout_' + sid).setInnerFBML(data); } ajax.requireLogin = true; ajax.post('http://' + base_url +'/users/hide_' + type + '?id='+id); } function ajax_request (type, base_url, replace, controller, action, sid, dop, match_id) { var ajax = new Ajax(); ajax.responseType = type; switch (type) { case Ajax.JSON:{} break; case Ajax.FBML: { ajax.ondone = function(data){ document.getElementById(replace).setInnerFBML(data); } } break; } ajax.requireLogin = true; ajax.post('http://' + base_url + '/' + controller + '/'+action+'?sid=' + sid+'&dop='+dop+'&match_id='+match_id); } function setgray(element) { element.setStyle({'color': '#666666'}); } function setblack(element) { element.setStyle({'color': '#000'}); }
JavaScript
pref("extensions.chromelist.open-files-in-tab", true); pref("extensions.chromelist.replace.prompt", true); pref("extensions.chromelist.lxr-url", "http://mxr.mozilla.org/mozilla-central/find?string=%s");
JavaScript
// Main UI JS // Starts the whole thing function onLoad() { chrometree = document.getElementById("chrometree"); chromedirtree = document.getElementById("chromedirtree"); chrometree.view = chromeTree; chromedirtree.view = chromeDirTree; chromeBrowser.chromeStructure = new ChromeStructure(); chromeBrowser.newChromeStructure = null; chromeBrowser.init(); setStatusText(getStr("info.status.reading.manifests")); setTimeout(refreshChromeList, 0, chromeBrowser.chromeStructure, onLoadDone); } // Basically finishes starting up after we've done all the background loading function onLoadDone() { setStatusText(getStr("info.status.done")); setStatusProgress(-1); chromeTree.currentURL = "chrome://"; chromeDirTree.changeDir("chrome://"); chromeBrowser.processPossibleProblems(); var sf = document.getElementById("searchFilter"); sf.addEventListener("command", chromeBrowser.updateSearch, true); } // Close up shop: function onUnload() { var sf = document.getElementById("searchFilter"); sf.removeEventListener("command", chromeBrowser.updateSearch, true); chrometree.view = null; chromedirtree.view = null; } var chromeBrowser = {}; // Global object. chromeBrowser.init = function cb_init() { const PREF_CTRID = "@mozilla.org/preferences-service;1"; const nsIPrefService = Components.interfaces.nsIPrefService; const nsIPrefBranch = Components.interfaces.nsIPrefBranch; const nsIPrefBranchInternal = Components.interfaces.nsIPrefBranchInternal; this.prefService = Components.classes[PREF_CTRID].getService(nsIPrefService); this.prefBranch = this.prefService.getBranch("extensions.chromelist."); this.prefBranchInternal = this.prefBranch.QueryInterface(nsIPrefBranchInternal); // Fit in, wherever we may be: this.initAppCompat(); if (this.host == "Firefox") { var s = document.createElementNS(XHTML_NS, "html:script"); s.setAttribute("src", "chrome://browser/content/utilityOverlay.js"); s.setAttribute("type", "application/x-javascript;version=1.8"); var ls = document.getElementById("last-script"); var p = ls.parentNode; p.insertBefore(s, ls); } // Nothing done yet == no problems: this.foundProblems = false; } chromeBrowser.close = function cb_close() { //XXXgijs: Do we need to null out stuff here? Might be prudent... // Also see onUnload. window.close(); } chromeBrowser.initAppCompat = function cb_initAppCompat() { var app = getService("@mozilla.org/xre/app-info;1", "nsIXULAppInfo"); if (!app) { alert("Dude, couldn't find nsIXULAppInfo. No good!"); return; } switch (app.ID) { case FlockUUID: case FirefoxUUID: this.host = "Firefox"; break; case ThunderbirdUUID: this.host = "Thunderbird"; break; default: this.host = "Toolkit"; } return; } chromeBrowser.showProblems = function cb_showProblems() { var existingWindow = getWindowByType("global:console"); if (existingWindow) { existingWindow.focus(); return; } var windowArgs = "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar"; window.open("chrome://global/content/console.xul", "_blank", windowArgs); } chromeBrowser.addProblem = function cb_addProblem(problem) { var error = chromeError(problem.desc, problem.manifest, problem.severity); consoleService.logMessage(error); this.foundProblems = true; } chromeBrowser.addPossibleProblem = function cb_addPossibleProblem(problem) { if (!this.delayedProblems) this.delayedProblems = []; this.delayedProblems.push(problem); } // We post-procress problems that might not be problems: if you added content // providers with flags, and they don't exist, but there are skin and/or locale // providers, we should silently ignore the error. chromeBrowser.processPossibleProblems = function cb_processPossibleProblems() { for (var i = 0; i < this.delayedProblems.length; i++) { var p = this.delayedProblems[i]; // First, remove the actual thing, if it was ever added. // Note the odd workaround for delete's behaviour here... var prov = this.chromeStructure.findURL(p.url); if (prov) { var provParent = prov.parent; // use this later. delete provParent.directories[prov.leafName]; var isContent = prov.leafName == "content"; } else { isContent = p.url.match(/chrome:\/\/[^\/]+\/content/i); if (isContent) { var parentURL = p.url.replace(/content\/?$/, ""); provParent = this.chromeStructure.findURL(parentURL); } } // Check if there are specific flags (platform or xpcnativewrappers): var flagAry = stringTrim(p.flags).split(/\s+/g); var contentSpecificFlags = flagAry.some(/platform|xpcnativewrappers/); // If this is not a content package, // or it is a content package with no content-specific flags, // this is definitely a problem, so add it: if (!isContent || !contentSpecificFlags) { this.addProblem(p); continue; } // So if this is a content package, with content-specific flags, // and if there are other providers that did work out, // this is not a problem (eg. global-region registration in Fx 3) // Hack for absence of provParent... var packDirs = provParent ? provParent.directories : {}; if ("skin" in packDirs || "locale" in packDirs) continue; // Otherwise, this is a problem: this.addProblem(p); } this._enableProblemBtn(); } chromeBrowser._enableProblemBtn = function cb_enableProblemBtn() { if (this.foundProblems) { var problemBtn = document.getElementById("problem-button"); problemBtn.setAttribute("disabled", false); problemBtn.setAttribute("label", getStr("btn.problems")); } } chromeBrowser.getPref = function cb_getPref(prefName) { var type = this.prefBranch.getPrefType(prefName); try { switch (type) { case Components.interfaces.nsIPrefBranch.PREF_INT: return this.prefBranch.getIntPref(prefName); case Components.interfaces.nsIPrefBranch.PREF_BOOL: return this.prefBranch.getBoolPref(prefName); case Components.interfaces.nsIPrefBranch.PREF_STRING: return this.prefBranch.getCharPref(prefName); default: throw "Unknown pref type: " + type + " !?"; } } catch (ex) { logException(ex); return null; } return null; // Keep js happy (strict warning otherwise) } chromeBrowser.setPref = function cb_setPref(prefName, newValue) { var type = this.prefBranch.getPrefType(prefName); try { switch (type) { case Components.interfaces.nsIPrefBranch.PREF_INT: return this.prefBranch.setIntPref(prefName, newValue); case Components.interfaces.nsIPrefBranch.PREF_BOOL: return this.prefBranch.setBoolPref(prefName, newValue); case Components.interfaces.nsIPrefBranch.PREF_STRING: return this.prefBranch.setCharPref(prefName, newValue); default: throw "Unknown pref type: " + type + " !?"; } } catch (ex) { logException(ex); return null; } } //////////////////////////////////////////////////////////////// // View stuff. chromeBrowser.viewSourceOf = function cb_viewSourceOf(href) { const vsURL = "chrome://global/content/viewSource.xul"; // Create a window. openDialog(vsURL, "_blank", "chrome,all,dialog=no", href); } chromeBrowser.view = function cb_view(href) { const PROTO_CID = "@mozilla.org/uriloader/external-protocol-service;1"; if (!href) { alert(getStr("error.no.url.for.file")); return; } if (this.host == "Firefox") { var openInTab = this.getPref("open-files-in-tab"); if (!openInTab) { openUILinkIn(href, "window"); return; } openUILinkIn(href, "tab"); return; } else if (this.host == "Thunderbird") { try { var msngr = newObject("@mozilla.org/messenger;1", "nsIMessenger"); } catch (ex) { alert(getStr("error.launching.url", [ex])); } if (msngr) msngr.launchExternalURL(href); } else if (this.host == "Toolkit") { const extProtoSvc = getService(PROTO_CID, "nsIExternalProtocolService"); var uri = iosvc.newURI(href, "UTF-8", null); extProtoSvc.loadUrl(uri); } } chromeBrowser.viewInCurrent = function cb_viewInCurrent(href) { if (!href) { alert(getStr("error.no.url.for.file")); return; } openUILinkIn(href, "current"); } chromeBrowser.viewInWindow = function cb_viewInWindow(href) { if (!href) { alert(getStr("error.no.url.for.file")); return; } openUILinkIn(href, "window"); } chromeBrowser.viewInTab = function cb_viewInTab(href) { if (!href) { alert(getStr("error.no.url.for.file")); return; } openUILinkIn(href, "tab"); } chromeBrowser.launch = function cb_launch(item) { // Code adapted from http://developer.mozilla.org/en/docs/Code_snippets:Running_applications // Per the site, it may not be implemented on some platforms var file = newObject("@mozilla.org/file/local;1", "nsILocalFile"); file.initWithPath(item.path); file.launch(); } chromeBrowser.showManifest = function cb_showManifest(item) { var file = newObject("@mozilla.org/file/local;1", "nsILocalFile"); file.initWithPath(item.getManifest()); file.reveal(); } chromeBrowser.refresh = function cb_refresh(item) { // Make sure we have a directory: if (item.level == 1) alert("This shouldn't have happened, huh?!"); item = item.parent; // If item is too low, run on all children: if (item.level == 1) { for (var k in item.directories) this._refresh(item.directories[k]); } else { this._refresh(item); } this._enableProblemBtn(); } /** * This one does the actual refresh on this particular item... */ chromeBrowser._refresh = function cb__refresh(item) { item.directories = {}; item.files = {}; var href = item.href; var overrides = filterOverrides(this.chromeStructure, href); addSubs(this.chromeStructure, item); updateOverrides(this.chromeStructure, overrides, true); chromeTree.currentURL = href; chromeDirTree.changeDir(href); } //////////////////////////////////////////////////////////////// // Copy stuff. chromeBrowser.copy = function cb_copy(item, prop) { try { var clipboardhelper = getService("@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper"); } catch (ex) {}; if (!item || !clipboardhelper || !(prop in item)) return; clipboardhelper.copyString(item[prop]); } // Save stuff. chromeBrowser.saveAs = function cb_saveAs(href) { if (!href) { alert("Couldn't get the URL for this file... sorry!"); return; } saveURL(href, null, null, false, false, null); } chromeBrowser.replace = function cb_replace(item) { if (item.scheme == "data") { alert(getStr("replace.dataurl")); return; } var path = item.path; // Check if user really wants to do this: if (this.getPref("replace.prompt")) { var alwaysPrompt = {value: true}; var reply = confirmEx(getStr("replace.confirm"), [getStr("replace.confirm.replace"), getStr("replace.confirm.cancel")], 0, getStr("replace.confirm.remind"), alwaysPrompt, window, getStr("replace.confirm.title")); if (reply == 1) return; this.setPref("replace.prompt", alwaysPrompt.value); } // So we continue: var originalExtIndex = item.leafName.lastIndexOf("."); var fileExtension = item.leafName.substring(originalExtIndex + 1); var filters = [[fileExtension.toUpperCase() + " files", "*." + fileExtension]]; var filePickerResult = pickOpen(null, filters, item.leafName); if (filePickerResult.reason != PICK_OK) return; try { if (item.scheme == "jar") this._replaceFileInJar(path, getDirInJAR(item.resolvedURI), filePickerResult.file); else this._replaceFile(path, filePickerResult.file); } catch (ex) { logException(ex); alert(getStr("error.replacing.file", [formatException(ex)])); return; } this.refresh(item); } chromeBrowser._replaceFile = function cb_internalReplaceFile(destPath, sourceFile) { var f = nsLocalFile(destPath); var originalF = nsLocalFile(destPath); var targetName = f.leafName; // What can I say, the copyTo API sucks. It won't overwrite files, ever. // So, we try to do our own logic here... // First, move the file to a unique name: f.createUnique(0, 0700); originalF.moveTo(null, f.leafName); // Then, try to copy the new file. try { sourceFile.copyTo(f.parent, targetName); } catch (ex) { // If this fails, move the backup back, and re-throw the exception. f.moveTo(null, targetName); throw ex; } // If we get here, we managed: destroy the original (moved) file: originalF.remove(false); } chromeBrowser._replaceFileInJar = function cb_internalReplaceFileInJar(jarPath, jarEntry, filePath) { // FIXME this should copy to temp, replace, and then copy back, to avoid // quota restrictions and so on. writeFileToJar(jarPath, jarEntry, filePath); } // LXR stuff. chromeBrowser.lxr = function cb_lxr(item) { if (item) { var searchString = encodeURIComponent(glimpseEscape(item.leafName)); var href = this.getPref("lxr-url").replace("%s", searchString); this.view(href); } } // Search stuff. chromeBrowser.updateSearch = function cb_updateSearch(e) { var searchTerm = document.getElementById("searchFilter").value; chromeBrowser.search.expr = searchTerm; } chromeBrowser.search = new Object(); chromeBrowser.search._update = function ct_s_up(newExpr) { this._expr = newExpr.trim(); var treeBox = document.getElementById("chrometreebox"); if (!this._expr) treeBox.removeAttribute("filtered"); else treeBox.setAttribute("filtered", "true"); chromeTree.sort(); chromeTree.treebox.clearStyleAndImageCaches(); chromeDirTree.sort(); } chromeBrowser.search.__defineGetter__("expr", function _getSearch() { return this._expr;}); chromeBrowser.search.__defineSetter__("expr", chromeBrowser.search._update); // Properties stuff. chromeBrowser.showProperties = function cb_properties(item) { var windowArgs = "scrollbars,chrome,resizable,dialog=no"; window.openDialog("chrome://chromelist/content/ui/props/properties.xul", "_blank", windowArgs, item); } chromeBrowser.host = "Unknown"; // Error in chrome registration reported to console: function chromeError(message, file, severity) { const SCRIPT_ERROR_IID = "@mozilla.org/scripterror;1"; var scriptError = newObject(SCRIPT_ERROR_IID, "nsIScriptError"); var flags = Components.interfaces.nsIScriptError.errorFlag; if (severity == "warning") flags = Components.interfaces.nsIScriptError.warningFlag; scriptError.init(message, file, null, null, null, flags, null); return scriptError; }
JavaScript
function startChromeList() { window.openDialog("chrome://chromelist/content/chromelist.xul", "chrome-browser", "resizable,dialog=no,status", {url: "chrome://"}); }
JavaScript
// Maps the chrome's structure. // This code probably looks strange. Why not a simple for loop, you wonder? // Well, because even on my (somewhat fast) pc, it takes about a second to // parse all the manifests and make a tree. On extension-loaded browsers, // on slow machines, it might well take *very* long. So I'm trying hard not // to hang the UI. // To be called once we're done: var finalCallbackFunction; // Progress bar division: const PARSEPROGRESS = 25; const MAXPROGRESS = 100; const TREEPROGRESS = MAXPROGRESS - PARSEPROGRESS; // Kickstart it all: function refreshChromeList(chromeStructure, callback) { var chromeURLs = []; finalCallbackFunction = callback; // Fetch the manifests. var manifs = getManifests(); var numberOfManifests = manifs.length; var currentManifest = 0; // Reset status progress bar setStatusProgress(0); // Start doing the thing - with a 0 timeout setTimeout(doParseManifest, 0); function doParseManifest() { // Parse them: var f = fopen(manifs[currentManifest], "<"); var contents = f.read(); f.close(); if (contents) // If there's something in it, parse it. chromeURLs = chromeURLs.concat(parseManifest(chromeStructure, contents, manifs[currentManifest])); // Update stuff every now and then. if (currentManifest % 10 == 0) setStatusProgress(Math.floor(PARSEPROGRESS * currentManifest / numberOfManifests)); // Increment and parse some more - or start constructing the tree currentManifest++; if (currentManifest < numberOfManifests) setTimeout(doParseManifest, 0); else setTimeout(makeChromeTree, 0, chromeStructure, chromeURLs); }; } /** * Construct the chrome tree * @param chromeStructure {ChromeStruct} the chrome structure on which to build. * @param chromeURLs {array} the list of chrome URLs we have * @returns nothing! */ function makeChromeTree(chromeStructure, chromeURLs) { var currentIndex = 0; var numberOfURLs = chromeURLs.length; setStatusText(getStr("info.status.mapping.chrome")); function doProcessChromeURL() { // UI stuff + next one. function gotoNextURL() { currentIndex++; if (currentIndex % 10 == 0) setStatusProgress(PARSEPROGRESS + (TREEPROGRESS * (currentIndex / numberOfURLs))); if (currentIndex < numberOfURLs) setTimeout(doProcessChromeURL, 0); else setTimeout(updateOverrides, 0, chromeStructure, null, null); }; // Expand our stored items: var chromeURI, manifest, flags [chromeURI, manifest, flags] = chromeURLs[currentIndex]; // Extract base and package: var matches = chromeURI.match(/^chrome\:\/\/([^\/]+)\/([^\/]+)/i); var packagename = matches[1]; // Packagename var providertype = matches[2]; // Packagetype // Get the ChromeDirectory represented: var cDir = getProviderDir(chromeStructure, packagename, providertype, manifest, flags); // Find all the stuff underneath: addSubs(chromeStructure, cDir); gotoNextURL(); }; doProcessChromeURL(); } function getProviderDir(chromeStructure, packageName, providerType, manifest, flags) { var dir; if (!(packageName in chromeStructure.directories)) { dir = new ChromeDirectory(chromeStructure, packageName, manifest); chromeStructure.directories[packageName] = dir; } dir = new ChromeDirectory(chromeStructure.directories[packageName], providerType, manifest, flags); chromeStructure.directories[packageName].directories[providerType] = dir; return chromeStructure.directories[packageName].directories[providerType]; } function getManifests() { const DS_CTR = "@mozilla.org/file/directory_service;1"; const nsIProperties = Components.interfaces.nsIProperties; const nsISE = Components.interfaces.nsISimpleEnumerator; var dirSvc = Components.classes[DS_CTR].getService(nsIProperties); var manifestEnum = dirSvc.get("ChromeML", nsISE); var manifests = []; getManifestList(manifestEnum, manifests); manifestEnum = dirSvc.get("SkinML", nsISE); getManifestList(manifestEnum, manifests); return manifests; } function getManifestList(manifestEnum, manifests) { const nsIF = Components.interfaces.nsIFile; while (manifestEnum.hasMoreElements()) { var entry = manifestEnum.getNext(); try { entry.QueryInterface(nsIF); } catch (ex) { continue; } // Don't care for stuff that's not there: if (!entry.exists()) continue; // Because of bug 521262, as well as other add-on silliness, we may // get entries twice. Both for directories and for files, we remove // the earlier entry, as the last entry // will stick, in case the browser actually re-parsed stuff: // If this is not a directory, it must be a manifest file. if (!entry.isDirectory()) { var iToDelete; if ((iToDelete = manifests.indexOf(entry.path)) >= 0) manifests.splice(iToDelete, 1); manifests.push(entry.path); continue; } // Parse as a directory. var dirEntries = entry.directoryEntries; while (dirEntries.hasMoreElements()) { var file = dirEntries.getNext().QueryInterface(nsIF); if ((/\.manifest$/i).test(file.path)) { if ((iToDelete = manifests.indexOf(file.path)) >= 0) manifests.splice(iToDelete, 1); manifests.push(file.path); } } } } // Parse a manifest. function parseManifest(chromeStructure, manifest, path) { var line, params, flags, rv = []; var uriForManifest = iosvc.newURI(getURLSpecFromFile(path), null, null); // Pick apart the manifest line by line. var lines = manifest.split("\n"); for (var i = 0; i < lines.length; i++) { line = stringTrim(lines[i]); params = line.split(/\s+/); // Switch based on the type of chrome mapping. Each kind has its own // syntax. See http://developer.mozilla.org/en/docs/Chrome_Manifest switch (params[0]) { case "content": case "skin": case "locale": // elem looks like: [chrome uri, path to manifest, flags (if any)] flags = ""; if (params[0] == "content") flags = params.slice(3).join(" "); else if (params[0] == "skin") flags = params.slice(4).join(" "); else if (params[0] == "locale") flags = params.slice(4).join(" "); rv.push(["chrome://" + params[1] + "/" + params[0], path, flags]); break; case "override": if (params.length >= 3) { // If this is a relative URL, need to resolve: try { var resolvedURI = iosvc.newURI(params[2], null, uriForManifest); } catch(ex) {} flags = params.slice(3).join(" "); if (resolvedURI) chromeStructure.overrides.push([params[1], resolvedURI.spec, path, flags]); else chromeStructure.overrides.push([params[1], params[2], path, flags]); } // Otherwise, don't do anything. } } return rv; } function updateOverrides(chromeStructure, overrides, onlyOverrides) { var overridden, override, manifest, flags, overriddenURI, expectedURI; var prob, desc; var onceResolved; var chromeOverrides = overrides; if (!chromeOverrides) chromeOverrides = chromeStructure.overrides; for (var i = 0; i < chromeOverrides.length; i++) { overridden = chromeOverrides[i][0]; override = chromeOverrides[i][1]; manifest = chromeOverrides[i][2]; flags = chromeOverrides[i][3]; overriddenURI = iosvc.newURI(overridden, null, null); try { expectedURI = getRealURI(overriddenURI); onceResolved = getMappedURI(overriddenURI); } catch (ex) { /* If this fails, the chrome URI being overridden does not exist: */} if ((!expectedURI || (onceResolved.spec != override)) && flags == "") { desc = getStr("problem.override.notApplied", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "warning"}; chromeBrowser.addProblem(prob); } else // OK, this thing got applied. Do stuff: { if (expectedURI.scheme == "file") { overrideFile(chromeStructure, overridden, override, expectedURI, manifest); } else if (expectedURI.scheme == "jar") { overrideJar(chromeStructure, overridden, override, expectedURI, manifest); } else if (expectedURI.scheme == "data") { overrideData(chromeStructure, overridden, override, expectedURI, manifest); } else { desc = getStr("problem.override.unrecognized.url", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "error"}; chromeBrowser.addProblem(prob); } } } if (!onlyOverrides) setTimeout(updateFlags, 0, chromeStructure); } function overrideFile(chromeStructure, overridden, override, expectedURI, manifest) { var desc, prob, f = getFileFromURLSpec(expectedURI.spec); // The file needs to exist. if (!f || !f.exists()) { desc = getStr("problem.override.pathDoesNotExist", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } // Overriding directories is pretty useless. if (f.isDirectory()) { desc = getStr("problem.override.isDir", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "warning"}; chromeBrowser.addProblem(prob); return; } // Get a filesize neatly. try { var fileSize = f.fileSize; } catch (ex) { fileSize = 0; } addOverride(chromeStructure, overridden, override, manifest, "file", fileSize); return; } function overrideJar(chromeStructure, overridden, override, expectedURI, manifest) { var desc, prob; try { var jarURI = expectedURI.QueryInterface(nsIJARURI); var jarFileURL = jarURI.JARFile.QueryInterface(nsIFileURL); // Doublecheck this jarfile exists: if (!jarFileURL.file.exists()) { desc = getStr("problem.override.noJarFile", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } var zr = newObject("@mozilla.org/libjar/zip-reader;1", nsIZipReader); zr.open(jarFileURL.file); // If we've survived opening it, check if what we really want from it: var path = jarURI.JAREntry; path = (path[0] == "/") ? path.substr(1) : path; // Oh, right. Don't try a directory. That's useless for overrides. if (path[path.length - 1] == "/") { desc = getStr("problem.override.isDir", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } // Right. So does it really have this file? var entry; try { entry = zr.getEntry(path); if (!entry) throw "NoEntryFound"; } catch (ex) { var desc = getStr("problem.override.fileNotInJar", [overridden, override]); prob = {desc: desc, manifest: manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } // Make sure it knows what we're talking 'bout. entry = entry.QueryInterface(Components.interfaces.nsIZipEntry); try { var fileSize = entry.realSize; } catch (ex) { fileSize = 0; } // Do it: addOverride(chromeStructure, overridden, override, manifest, "jar", fileSize); } catch (ex) { // Uh oh. desc = getStr("problem.override.jarFailure", [overridden, override, ex]); prob = {desc: desc, manifest: manifest, severity: "warning"}; chromeBrowser.addProblem(prob); return; } } function overrideData(chromeStructure, overridden, override, expectedURI, manifest) { var size = expectedURI.spec.replace(/^data:[^,]*,/, "").length; addOverride(chromeStructure, overridden, override, manifest, "data", size); } function addOverride(chromeStructure, overridden, override, manifest, scheme, size) { // Alright. Get stuff. var chromeThingy = chromeStructure.findURL(overridden); if (!chromeThingy) { // So basically, you can override whatever you want. // It's hard to make a tree out of that. // We will try for a small bit, but not too long: var chromeThingyDir = overridden.replace(/[^\/]+$/, ""); chromeThingy = chromeStructure.findURL(chromeThingyDir); if (!chromeThingy) return; // Still nothing, give up. var chromeThingyFile = overridden.substr(chromeThingyDir.length); chromeThingy = new ChromeFile(chromeThingy, chromeThingyFile, size); chromeThingy.parent.files[chromeThingy.leafName] = chromeThingy; } chromeThingy.size = size; chromeThingy.manifest = manifest; chromeThingy.scheme = scheme; chromeThingy.resolvedURI = override; return; } /** * Updates all the skin/locale flags to include the flags enabled for the * content package that won't get parsed on skin/locale flags. * @param chromeStructure {ChromeStructure} the chrome structure to work on. */ function updateFlags(chromeStructure) { for each (var pack in chromeStructure.directories) { var flags; if ("content" in pack.directories && (flags = pack.directories.content.flags)) { var flagAry = flags.split(/\s+/g); var p = flags.match(/platform/); var xnw = flags.match(/xpcnativewrappers=(?:yes|no)/); var addedFlags = p ? p[0] : ""; addedFlags += " " + (xnw ? xnw[0] : ""); var otherProvs = [pack.directories[d] for (d in pack.directories) if (d != "content")]; otherProvs.forEach(function(x) x.flags += addedFlags); } } setTimeout(finalCallbackFunction, 0); } /** * (re)parse this chrome structure part. * @param chromeStructure {ChromeStruct} the structure to stick this onto. * @param cDir {ChromeDirectory} the directory to further parse. * @returns nothing. */ function addSubs(chromeStructure, cDir) { var nextRound = [cDir]; while (nextRound.length > 0) { var currentCDir = nextRound.shift(); var gen = chromeChildrenGenerator(chromeStructure, currentCDir); for (var c in gen) { if (c.TYPE == "ChromeDirectory") { currentCDir.directories[c.leafName] = c; // If the item c is a ChromeDirectory, we need to recurse: nextRound.push(c); } else { currentCDir.files[c.leafName] = c; } } } } /** * Generator for the children of a ChromeDirectory. * Does not walk directory tree recursively! */ function chromeChildrenGenerator(chromeStructure, cDir) { try { var realURL = getRealURI(cDir.href); } catch (ex) { var desc = getStr("problem.convertChromeURL.failure", cDir.href); var prob = {desc: desc, manifest: cDir.manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } var parentSpec = realURL.spec.replace(/[^\/]+$/, ""); realURL = iosvc.newURI(parentSpec, null, null); // Create a generator for the actual thing. If we don't recognize the protocol, // error out. var innerGen; if (realURL.scheme == "jar") { innerGen = jarChildrenGenerator(chromeStructure, cDir, realURL); } else if (realURL.scheme == "file") { innerGen = fileChildrenGenerator(chromeStructure, cDir, realURL); } else { var desc = getStr("problem.unrecognized.url", [cDir.href, realURL.spec]); prob = {desc: desc, manifest: cDir.manifest, severity: "error"}; chromeBrowser.addProblem(prob); } // Yield everything from the inner generator back to whatever is using us. for (var r in innerGen) yield r; return; } /** * Generator for children of a chrome URL mapped to a jar. * @param chromeURL {string} the URL to the chrome dir being mapped * @param realURL {nsIURI} the URL to the actual jar thing * @yields ChromeFile/ChromeDirectory for each child of the URL */ function jarChildrenGenerator(chromeStructure, cDir, realURL) { var zr, entries, desc, prob; try { [zr, entries] = getEntriesInJARDir(realURL); } catch (ex) { if (ex && ex.result) { if (ex.result == Components.results.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) { desc = getStr("problem.fileNotInJar", [cDir.href, realURL.spec]); prob = {desc: desc, manifest: cDir.manifest, severity: "error", url: cDir.href, flags: cDir.flags}; // FIXME document! chromeBrowser.addPossibleProblem(prob); } else if (ex.result == Components.results.NS_ERROR_FILE_NOT_FOUND) { desc = getStr("problem.noJarFile", [cDir.href, realURL.spec]); prob = {desc: desc, manifest: cDir.manifest, severity: "error", url: cDir.href, flags: cDir.flags}; chromeBrowser.addProblem(prob); delete cDir.parent.directories[cDir.leafName]; } else { logException(ex); } return; } else { logException(ex); } return; } while (entries.hasMore()) { var childName = entries.getNext(); yield getChromeJARFile(cDir, zr, realURL, childName); } zr.close(); return; } /** * Generator for children of a chrome URL mapped to a file. * @param cDir {ChromeDirectory} the chrome dir being mapped * @param realURL {nsIURI} the URL to the actual directory * @yields ChromeFile/ChromeDirectory for each item in the directory */ function fileChildrenGenerator(chromeStructure, cDir, realURL) { var fURL = realURL.QueryInterface(Components.interfaces.nsIFileURL); var f = fURL.file; var desc, prob; // Assume we only get called once per parse, so throw errors: if (!f.exists()) { desc = getStr("problem.noFile", [cDir.href, f.path]); prob = {desc: desc, manifest: cDir.manifest, severity: "error", url: cDir.href, flags: cDir.flags}; chromeBrowser.addPossibleProblem(prob); return; } if (!f.isDirectory()) { desc = getStr("problem.mappedToFile", [cDir.href, f.path]); prob = {desc: desc, manifest: cDir.manifest, severity: "error"}; chromeBrowser.addProblem(prob); return; } var children = f.directoryEntries; var empty = !children.hasMoreElements(); while (children.hasMoreElements()) { var child = children.getNext().QueryInterface(Components.interfaces.nsIFile); yield getChromeFile(cDir, child); } // If we didn't find anything, that might be a problem: if ((cDir.level == 2) && empty) { desc = getStr("problem.mappedToEmptyDir", [cDir.href, f.path]); prob = {desc: desc, manifest: cDir.manifest, severity: "warning"}; chromeBrowser.addProblem(prob); } return; } /** * Create a file object given the containing directory and the child * @param containingDir {ChromeDirectory} the chrome directory this file belongs to. * @param child {nsIFile} the file corresponding to the child in this chrome directory. * @returns {ChromeDirectory OR ChromeFile} the object corresponding to the child. * @note does NOT add the file to the list of children for the directory!! */ function getChromeFile(containingDir, child) { var fileName = encodeURIComponent(child.leafName); var size; // Try to get a normal filesize, but for all we know this may fail. try { size = child.fileSize; } catch (ex) { size = 0; } if (!child.isDirectory()) return new ChromeFile(containingDir, fileName, size); return new ChromeDirectory(containingDir, fileName); } /** * Create a file given the containing directory and the child's JARURI * @param containingDir {ChromeDirectory} the chrome directory this file belongs to. * @param zr {nsIZipReader} the zip reader that has the jar opened. * @param parentURL {nsIURI} the URL to the parent directory in the jar. * @param childName {string} the entry in the JAR file (INCLUDING the dir info!). * @returns {ChromeDirectory OR ChromeFile} the object corresponding to the child. * @note does NOT add the file to the list of children for the directory!! */ function getChromeJARFile(containingDir, zr, parentURL, childName) { parentURL.QueryInterface(Components.interfaces.nsIJARURI); var parentEntry = parentURL.JAREntry; var child = zr.getEntry(childName).QueryInterface(Components.interfaces.nsIZipEntry); var leafName = encodeURIComponent(childName.substring(parentEntry.length)); if (childName[childName.length - 1] == "/") { leafName = encodeURIComponent(childName.substring(parentEntry.length, childName.length - 1)); return new ChromeDirectory(containingDir, leafName) } var size; try { size = child.realSize; } catch (ex) { size = 0; } return new ChromeFile(containingDir, leafName, size); } function filterOverrides(chromeStructure, filterURL) { // Gives back a list of overrides: return chromeStructure.overrides.filter(function cof(item) { return item[0].indexOf(filterURL) == 0; }); }
JavaScript
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JSIRC Library. * * The Initial Developer of the Original Code is * New Dimensions Consulting, Inc. * Portions created by the Initial Developer are Copyright (C) 1999 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Robert Ginda, rginda@ndcico.com, original author * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // A large portion of the original code has been snipped. // A large portion of this code wasn't in the original code. The license header // is here for legal reasons, I think. If you want to look at the original, // refer to http://lxr.mozilla.org/seamonkey/source/extensions/irc/js/lib/utils.js // and its cvs history there. function getWindowByType(windowType) { const MEDIATOR_CONTRACTID = "@mozilla.org/appshell/window-mediator;1"; var windowManager = getService(MEDIATOR_CONTRACTID, "nsIWindowMediator"); return windowManager.getMostRecentWindow(windowType); } function stringTrim(s) { if (!s) return ""; s = s.replace(/^\s+/, ""); return s.replace(/\s+$/, ""); } function getService(contractID, iface) { var rv; var cls = Components.classes[contractID]; if (!cls) return null; switch (typeof iface) { case "undefined": rv = cls.getService(); break; case "string": rv = cls.getService(Components.interfaces[iface]); break; case "object": rv = cls.getService(iface); break; default: rv = null; break; } return rv; } function newObject(contractID, iface) { var rv; var cls = Components.classes[contractID]; if (!cls) return null; switch (typeof iface) { case "undefined": rv = cls.createInstance(); break; case "string": rv = cls.createInstance(Components.interfaces[iface]); break; case "object": rv = cls.createInstance(iface); break; default: rv = null; break; } return rv; } function dumpObjectTree (o, recurse, compress, level) { var s = ""; var pfx = ""; if (typeof recurse == "undefined") recurse = 0; if (typeof level == "undefined") level = 0; if (typeof compress == "undefined") compress = true; for (var i = 0; i < level; i++) pfx += (compress) ? "| " : "| "; var tee = (compress) ? "+ " : "+- "; for (i in o) { var t, ex; try { t = typeof o[i]; } catch (ex) { t = "ERROR"; } switch (t) { case "function": var sfunc = String(o[i]).split("\n"); if (sfunc[2] == " [native code]") sfunc = "[native code]"; else if (sfunc.length == 1) sfunc = String(sfunc); else sfunc = sfunc.length + " lines"; s += pfx + tee + i + " (function) " + sfunc + "\n"; break; case "object": s += pfx + tee + i + " (object)\n"; if (!compress) s += pfx + "|\n"; if ((i != "parent") && (recurse)) s += dumpObjectTree (o[i], recurse - 1, compress, level + 1); break; case "string": if (o[i].length > 200) s += pfx + tee + i + " (" + t + ") " + o[i].length + " chars\n"; else s += pfx + tee + i + " (" + t + ") '" + o[i] + "'\n"; break; case "ERROR": s += pfx + tee + i + " (" + t + ") ?\n"; break; default: s += pfx + tee + i + " (" + t + ") " + o[i] + "\n"; } if (!compress) s += pfx + "|\n"; } s += pfx + "*\n"; return s; } function confirmEx(msg, buttons, defaultButton, checkText, checkVal, parent, title) { /* Note that on versions before Mozilla 0.9, using 3 buttons, * the revert or dontsave button, or custom button titles will NOT work. * * The buttons should be listed in the 'accept', 'cancel' and 'extra' order, * and the exact button order is host app- and platform-dependant. * For example, on Windows this is usually [button 1] [button 3] [button 2], * and on Linux [button 3] [button 2] [button 1]. */ var PROMPT_CTRID = "@mozilla.org/embedcomp/prompt-service;1"; var nsIPromptService = Components.interfaces.nsIPromptService; var ps = Components.classes[PROMPT_CTRID].getService(nsIPromptService); var buttonConstants = { ok: ps.BUTTON_TITLE_OK, cancel: ps.BUTTON_TITLE_CANCEL, yes: ps.BUTTON_TITLE_YES, no: ps.BUTTON_TITLE_NO, save: ps.BUTTON_TITLE_SAVE, revert: ps.BUTTON_TITLE_REVERT, dontsave: ps.BUTTON_TITLE_DONT_SAVE }; var buttonFlags = 0; var buttonText = [null, null, null]; if (!isinstance(buttons, Array)) throw "buttons parameter must be an Array"; if ((buttons.length < 1) || (buttons.length > 3)) throw "the buttons array must have 1, 2 or 3 elements"; for (var i = 0; i < buttons.length; i++) { var buttonFlag = ps.BUTTON_TITLE_IS_STRING; if ((buttons[i][0] == "!") && (buttons[i].substr(1) in buttonConstants)) buttonFlag = buttonConstants[buttons[i].substr(1)]; else buttonText[i] = buttons[i]; buttonFlags += ps["BUTTON_POS_" + i] * buttonFlag; } // ignore anything but a proper number var defaultIsNumber = (typeof defaultButton == "number"); if (defaultIsNumber && arrayHasElementAt(buttons, defaultButton)) buttonFlags += ps["BUTTON_POS_" + defaultButton + "_DEFAULT"]; if (!parent) parent = window; if (!title) title = "Confirm"; if (!checkVal) checkVal = new Object(); var rv = ps.confirmEx(parent, title, msg, buttonFlags, buttonText[0], buttonText[1], buttonText[2], checkText, checkVal); return rv; } function arrayHasElementAt(ary, i) { return typeof ary[i] != "undefined"; } function equalsObject(o1, o2, path) { if (!path) path = "o1"; for (var p in o1) { // Recursing forever is pretty non-funny: if (p == "parent") continue; if (!(p in o2)) { throw path + "." + p + " does not occur in " + path.replace(/^o1/, "o2"); return false; } if (typeof o1[p] == "object") { if (!equalsObject(o1[p], o2[p], path + "." + p)) return false; } else if (o1[p] != o2[p]) { throw path + "." + p + " is " + String(o1[p]) + " while in o2 it is " + String(o2[p]); return false; } } for (p in o2) { // If the property did exist in o1, the previous loop tested it: if (!(p in o1)) { throw path.replace(/^o1/, "o2") + "." + p + " does not occur in " + path; return false; } } return true; } function isinstance(inst, base) { /* Returns |true| if |inst| was constructed by |base|. Not 100% accurate, * but plenty good enough for us. This is to work around the fix for bug * 254067 which makes instanceof fail if the two sides are 'from' * different windows (something we don't care about). */ return (inst && base && ((inst instanceof base) || (inst.constructor && (inst.constructor.name == base.name)))); } function formatException(ex) { if (isinstance(ex, Error)) { return getStr("exception.format", [ex.name, ex.message, ex.fileName, ex.lineNumber]); } if ((typeof ex == "object") && ("filename" in ex)) { return getStr("exception.format", [ex.name, ex.message, ex.filename, ex.lineNumber]); } return String(ex); } function glimpseEscape(str) { return str.replace(/([\$\^\*\[\|\(\)\!\\;,#><\-.])/g, "\\$1"); } function getStr(id, args) { if (typeof args != "undefined") { if ((args instanceof Array) && args.length > 0) return document.getElementById("locale-strings").getFormattedString(id, args); if (args !== null && args.constructor == String) return document.getElementById("locale-strings").getFormattedString(id, [args]); } return document.getElementById("locale-strings").getString(id); } function setStatusText(str) { document.getElementById("status-text").setAttribute("label", str); } function setStatusProgress(n) { var progressMeter = document.getElementById("status-progress-bar"); if (n == -1) { progressMeter.parentNode.parentNode.setAttribute("hidden", "true"); } else { progressMeter.setAttribute("value", String(n)); progressMeter.parentNode.parentNode.setAttribute("hidden", "false"); } } function logException (ex) { // FIXME: logException doesn't do anything yet. dump(ex) } function getFormattedBytes(bytes) { var strBytes = String(bytes); var ary = []; while (strBytes) { ary.unshift(strBytes.substr(-3)); strBytes = strBytes.slice(0, -3); } return ary.join(".") + " " + getStr("props.bytes") + " " + getShortBytes(bytes); } function getShortBytes(bytes) { if (bytes < 1024) return ""; var labels = ["KiB", "MiB", "GiB", "TiB"], i = -1; while (bytes > 1024) { bytes /= 1024; i++; } return "(" + bytes.toFixed(2) + " " + labels[i] + ")" ; }
JavaScript
// Chrome stuff var chromeStructure, chromeOverrides; // Services var iosvc, atomsvc, chromeReg, consoleService, extManager; // UI stuff var chrometree, chromedirtree; // Unique ID stuff: const ThunderbirdUUID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; const FlockUUID = "{a463f10c-3994-11da-9945-000d60ca027b}"; const FirefoxUUID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; const XHTML_NS = "http://www.w3.org/1999/xhtml"; // Components const nsIJARURI = Components.interfaces.nsIJARURI; const nsIFileURL = Components.interfaces.nsIFileURL; const nsIZipReader = Components.interfaces.nsIZipReader; const nsIZipEntry = Components.interfaces.nsIZipEntry; // Global constants etc: const CH_SCHEME = "chrome:".length; // Initialize all of this... function initGlobalVars() { iosvc = getService("@mozilla.org/network/io-service;1", "nsIIOService"); chromeReg = getService("@mozilla.org/chrome/chrome-registry;1", "nsIToolkitChromeRegistry"); consoleService = getService("@mozilla.org/consoleservice;1", "nsIConsoleService"); extManager = getService("@mozilla.org/extensions/manager;1", "nsIExtensionManager"); atomsvc = getService("@mozilla.org/atom-service;1", "nsIAtomService"); } initGlobalVars();
JavaScript
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is The JavaScript Debugger. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Robert Ginda, <rginda@netscape.com>, original author * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* notice that these valuse are octal. */ const PERM_IRWXU = 00700; /* read, write, execute/search by owner */ const PERM_IRUSR = 00400; /* read permission, owner */ const PERM_IWUSR = 00200; /* write permission, owner */ const PERM_IXUSR = 00100; /* execute/search permission, owner */ const PERM_IRWXG = 00070; /* read, write, execute/search by group */ const PERM_IRGRP = 00040; /* read permission, group */ const PERM_IWGRP = 00020; /* write permission, group */ const PERM_IXGRP = 00010; /* execute/search permission, group */ const PERM_IRWXO = 00007; /* read, write, execute/search by others */ const PERM_IROTH = 00004; /* read permission, others */ const PERM_IWOTH = 00002; /* write permission, others */ const PERM_IXOTH = 00001; /* execute/search permission, others */ const MODE_RDONLY = 0x01; const MODE_WRONLY = 0x02; const MODE_RDWR = 0x04; const MODE_CREATE = 0x08; const MODE_APPEND = 0x10; const MODE_TRUNCATE = 0x20; const MODE_SYNC = 0x40; const MODE_EXCL = 0x80; const PICK_OK = Components.interfaces.nsIFilePicker.returnOK; const PICK_CANCEL = Components.interfaces.nsIFilePicker.returnCancel; const PICK_REPLACE = Components.interfaces.nsIFilePicker.returnReplace; const FILTER_ALL = Components.interfaces.nsIFilePicker.filterAll; const FILTER_HTML = Components.interfaces.nsIFilePicker.filterHTML; const FILTER_TEXT = Components.interfaces.nsIFilePicker.filterText; const FILTER_IMAGES = Components.interfaces.nsIFilePicker.filterImages; const FILTER_XML = Components.interfaces.nsIFilePicker.filterXML; const FILTER_XUL = Components.interfaces.nsIFilePicker.filterXUL; const FTYPE_DIR = Components.interfaces.nsIFile.DIRECTORY_TYPE; const FTYPE_FILE = Components.interfaces.nsIFile.NORMAL_FILE_TYPE; // evald f = fopen("/home/rginda/foo.txt", MODE_WRONLY | MODE_CREATE) // evald f = fopen("/home/rginda/vnk.txt", MODE_RDONLY) var futils = new Object(); futils.umask = PERM_IWOTH | PERM_IWGRP; futils.MSG_SAVE_AS = "Save As"; futils.MSG_OPEN = "Open"; futils.getPicker = function futils_nosepicker(initialPath, typeList, attribs) { const classes = Components.classes; const interfaces = Components.interfaces; const PICKER_CTRID = "@mozilla.org/filepicker;1"; const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const nsIFilePicker = interfaces.nsIFilePicker; const nsILocalFile = interfaces.nsILocalFile; var picker = classes[PICKER_CTRID].createInstance(nsIFilePicker); if (typeof attribs == "object") { for (var a in attribs) picker[a] = attribs[a]; } else throw "bad type for param |attribs|"; if (initialPath) { var localFile; if (typeof initialPath == "string") { localFile = classes[LOCALFILE_CTRID].createInstance(nsILocalFile); localFile.initWithPath(initialPath); } else { if (!(initialPath instanceof nsILocalFile)) throw "bad type for argument |initialPath|"; localFile = initialPath; } picker.displayDirectory = localFile } var allIncluded = false; if (typeof typeList == "string") typeList = typeList.split(" "); if (typeList instanceof Array) { for (var i in typeList) { switch (typeList[i]) { case "$all": allIncluded = true; picker.appendFilters(FILTER_ALL); break; case "$html": picker.appendFilters(FILTER_HTML); break; case "$text": picker.appendFilters(FILTER_TEXT); break; case "$images": picker.appendFilters(FILTER_IMAGES); break; case "$xml": picker.appendFilters(FILTER_XML); break; case "$xul": picker.appendFilters(FILTER_XUL); break; case "$noAll": // This prevents the automatic addition of "All Files" // as a file type option by pretending it is already there. allIncluded = true; break; default: if ((typeof typeList[i] == "object") && isinstance(typeList[i], Array)) picker.appendFilter(typeList[i][0], typeList[i][1]); else picker.appendFilter(typeList[i], typeList[i]); break; } } } if (!allIncluded) picker.appendFilters(FILTER_ALL); return picker; } function pickSaveAs (title, typeList, defaultFile, defaultDir, defaultExt) { if (!defaultDir && "lastSaveAsDir" in futils) defaultDir = futils.lastSaveAsDir; var picker = futils.getPicker (defaultDir, typeList, {defaultString: defaultFile, defaultExtension: defaultExt}); picker.init (window, title ? title : futils.MSG_SAVE_AS, Components.interfaces.nsIFilePicker.modeSave); var reason; try { reason = picker.show(); } catch (ex) { dd ("caught exception from file picker: " + ex); } var obj = new Object(); obj.reason = reason; obj.picker = picker; if (reason != PICK_CANCEL) { obj.file = picker.file; futils.lastSaveAsDir = picker.file.parent; } else { obj.file = null; } return obj; } function pickOpen (title, typeList, defaultFile, defaultDir) { if (!defaultDir && "lastOpenDir" in futils) defaultDir = futils.lastOpenDir; var picker = futils.getPicker (defaultDir, typeList, {defaultString: defaultFile}); picker.init (window, title ? title : futils.MSG_OPEN, Components.interfaces.nsIFilePicker.modeOpen); var rv = picker.show(); if (rv != PICK_CANCEL) futils.lastOpenDir = picker.file.parent; return {reason: rv, file: picker.file, picker: picker}; } function mkdir (localFile, perms) { if (typeof perms == "undefined") perms = 0766 & ~futils.umask; localFile.create(FTYPE_DIR, perms); } function nsLocalFile(path) { const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const nsILocalFile = Components.interfaces.nsILocalFile; var localFile = Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile); localFile.initWithPath(path); return localFile; } function fopen (path, mode, perms, tmp) { return new LocalFile(path, mode, perms, tmp); } function LocalFile(file, mode, perms, tmp) { const classes = Components.classes; const interfaces = Components.interfaces; const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const FILEIN_CTRID = "@mozilla.org/network/file-input-stream;1"; const FILEOUT_CTRID = "@mozilla.org/network/file-output-stream;1"; const SCRIPTSTREAM_CTRID = "@mozilla.org/scriptableinputstream;1"; const nsIFile = interfaces.nsIFile; const nsILocalFile = interfaces.nsILocalFile; const nsIFileOutputStream = interfaces.nsIFileOutputStream; const nsIFileInputStream = interfaces.nsIFileInputStream; const nsIScriptableInputStream = interfaces.nsIScriptableInputStream; if (typeof perms == "undefined") perms = 0666 & ~futils.umask; if (typeof mode == "string") { switch (mode) { case ">": mode = MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE; break; case ">>": mode = MODE_WRONLY | MODE_CREATE | MODE_APPEND; break; case "<": mode = MODE_RDONLY; break; default: throw "Invalid mode ``" + mode + "''"; } } if (typeof file == "string") { this.localFile = new nsLocalFile(file); } else if (file instanceof nsILocalFile) { this.localFile = file; } else { throw "bad type for argument |file|."; } this.path = this.localFile.path; if (mode & (MODE_WRONLY | MODE_RDWR)) { this.outputStream = classes[FILEOUT_CTRID].createInstance(nsIFileOutputStream); this.outputStream.init(this.localFile, mode, perms, 0); } if (mode & (MODE_RDONLY | MODE_RDWR)) { this.baseInputStream = classes[FILEIN_CTRID].createInstance(nsIFileInputStream); this.baseInputStream.init(this.localFile, mode, perms, tmp); this.inputStream = classes[SCRIPTSTREAM_CTRID].createInstance(nsIScriptableInputStream); this.inputStream.init(this.baseInputStream); } } LocalFile.prototype.write = function fo_write(buf) { if (!("outputStream" in this)) throw "file not open for writing."; return this.outputStream.write(buf, buf.length); } LocalFile.prototype.read = function fo_read(max) { if (!("inputStream" in this)) throw "file not open for reading."; var av = this.inputStream.available(); if (typeof max == "undefined") max = av; if (!av) return null; var rv = this.inputStream.read(max); return rv; } LocalFile.prototype.close = function fo_close() { if ("outputStream" in this) this.outputStream.close(); if ("inputStream" in this) this.inputStream.close(); } LocalFile.prototype.flush = function fo_close() { return this.outputStream.flush(); } /** * Write a file to a jar * @param jarFilePath {string} the path to the jar to write to * @param entryPath {string} the path of the file in the jar to write to * @param filePath {string} the path to the file that needs to be put in the jar */ function writeFileToJar(jarFilePath, entryPath, filePath) { const PR_RDONLY = 0x01; const PR_WRONLY = 0x02; const PR_RDWR = 0x04; const PR_CREATE_FILE = 0x08; const PR_APPEND = 0x10; const PR_TRUNCATE = 0x20; const PR_SYNC = 0x40; const PR_EXCL = 0x80; var zipWriter = Components.Constructor("@mozilla.org/zipwriter;1", "nsIZipWriter"); var zipW = new zipWriter(); var jarFile = nsLocalFile(jarFilePath); zipW.open(jarFile, PR_RDWR); if (zipW.hasEntry(entryPath)) zipW.removeEntry(entryPath, false); zipW.addEntryFile(entryPath, Components.interfaces.nsIZipWriter.COMPRESSION_NONE, filePath, false); zipW.close(); // Now for some magic. Mozilla caches lots of stuff for JARs, so as to enable faster read/write. // Unfortunately, that screws us over in this case, as it will have an open copy of a zipreader // somewhere that's stuck with the old pointers to files in the JAR. If we don't fix this, // lots of things break as they can't find the right files in the JAR anymore. // So, we will find this zipreader, close it and reopen it. It will then re-read the // zipfile, and will then work correctly. Hopefully. var jarProtocolHandler = iosvc.getProtocolHandler("jar").QueryInterface(Components.interfaces.nsIJARProtocolHandler); var jarCache = jarProtocolHandler.JARCache; var ourReader = jarCache.getZip(jarFile); ourReader.close(); ourReader.open(jarFile); }
JavaScript
//////////////////////////////////////////////////////////////////////////////// // Chrome Structure representation. /////////////////// // ChromeStructure function ChromeStructure() { this.overrides = []; this.directories = {}; } ChromeStructure.prototype.TYPE = "ChromeStructure"; ChromeStructure.prototype.isDirectory = true; ChromeStructure.prototype.directories = null; ChromeStructure.prototype.overrides = null; ChromeStructure.prototype.parent = null; ChromeStructure.prototype.href = "chrome://"; ChromeStructure.prototype.level = 0; ChromeStructure.prototype.findURL = function cs_findURL(url) { var i, urlparts, currentNode = this; url = url.replace(/^chrome:\/\//, ""); urlparts = url.split("/"); for (i = 0; i < urlparts.length; i++) { if (currentNode.directories && (urlparts[i] in currentNode.directories)) currentNode = currentNode.directories[urlparts[i]]; else if (currentNode.files && (urlparts[i] in currentNode.files)) currentNode = currentNode.files[urlparts[i]]; else if (urlparts[i] != "") return null; } return currentNode; } /////////////////// /////////////////// // ChromeDirectory // Constructor // Note: name is expected to be URI-encoded function ChromeDirectory(someParent, name, manifest, flags) { this.parent = someParent; this.href = this.parent.href + name + "/"; this.level = this.parent.level + 1; // If this is somewhere down, resolve stuff: if (this.level >= 2) { var resolvedURI = chromeReg.convertChromeURL(iosvc.newURI(this.href, null, null)); this.scheme = resolvedURI.scheme; this.resolvedURI = resolvedURI.spec; if (this.level == 2) // we're looking at the magic file for our resolved URI, fix: this.resolvedURI = this.resolvedURI.replace(/[^\/]+$/, ""); } // Otherwise, we don't know: else { this.scheme = "unknown"; this.resolvedURI = ""; } // We'll have directories and files underneath this (or might, anyway): this.directories = new Object(); this.files = new Object(); // And we need to store the manifest used to register this: if (manifest) this.manifest = manifest; else this.manifest = this.parent.manifest; // And the flags: if (flags) this.flags = flags; else if (this.level > 2) this.flags = this.parent.flags; else this.flags = ""; // We calculate the path, and the leaf name: this.path = this.getPath(); this.leafName = decodeURIComponent(name); } ChromeDirectory.prototype.getPath = function cd_getPath() { try { var path = getPathForURI(this.resolvedURI); } catch (ex) { logException(ex); return ""; } return path; } ChromeDirectory.prototype.getManifest = function cd_getManifest() { return this.manifest; } ChromeDirectory.prototype._addon = ""; ChromeDirectory.prototype.getAddOn = function cd_getAddOn() { if (this._addon) return this._addon; var manifestURL = getURLSpecFromFile(this.getManifest()); var id; var m = manifestURL.match(/\/([^\/]+)\/chrome.manifest$/); if (!m) { this._addon = getStr("not.an.addon"); } else { id = m[1]; try { this._addon = extManager.getItemForID(decodeURIComponent(id)).name; } catch (ex) { logException(ex); this._addon = getStr("addon.not.found"); } } return this._addon; } ChromeDirectory.prototype.TYPE = "ChromeDirectory"; ChromeDirectory.prototype.parent = null; ChromeDirectory.prototype.isDirectory = true; /////////////////// /////////////////// // ChromeFile // Constructor // Note: name is expected to be URI-encoded function ChromeFile(parent, name, size) { this.parent = parent; this.href = this.parent.href + name; this.level = this.parent.level + 1; this.size = size; var resolvedURI = getRealURI(this.href); this.scheme = resolvedURI.scheme; this.resolvedURI = resolvedURI.spec; this.path = this.getPath(); this.leafName = decodeURIComponent(name); } ChromeFile.prototype.TYPE = "ChromeFile"; ChromeFile.prototype.parent = null; ChromeFile.prototype.isDirectory = false; ChromeFile.prototype.getManifest = function cf_getManifest() { var obj = this; while (!("manifest" in obj)) { if (obj.TYPE == "ChromeStructure") return null; obj = obj.parent; } return obj.manifest; } // Same as for directories ChromeFile.prototype.getPath = ChromeDirectory.prototype.getPath; ChromeFile.prototype._addon = ""; ChromeFile.prototype.getAddOn = ChromeDirectory.prototype.getAddOn; ///////////////////
JavaScript
/** * Obtain the chrome registry's mapping for the URI given * @param uri the string or nsIURI uri to get the mapping for * @returns the chrome registry's info about the URI */ function getMappedURI(uri) { if (typeof uri == "string") uri = iosvc.newURI(uri, null, null); return chromeReg.convertChromeURL(uri); } /** * Obtain a real (file/jar) URI for the given URI. * @param uri the string or nsIURI uri to get a mapping for * @returns the corresponding URI */ function getRealURI(uri) { if (typeof uri == "string") uri = iosvc.newURI(uri, null, null) while (uri.scheme == "chrome") uri = chromeReg.convertChromeURL(uri); return uri; //if (typeof uri == "string") // return iosvc.newChannel(uri, null, null).URI; //return iosvc.newChannelFromURI(uri).URI; } /** * Get a path to the jar file for a given jar: URI * @param uri {nsIURI OR string} the string or nsIURI uri to get a file path for * @returns {string} the corresponding path */ function getJARFileForURI(uri) { if (typeof uri == "string") uri = iosvc.newURI(uri, null, null); uri.QueryInterface(Components.interfaces.nsIJARURI); var file = getFileFromURLSpec(uri.JARFile.spec); return file.path; } /** * Get a path to the 'file' for anything: * @param uri to something * @returns the corresponding file path (to the jar if applicable) */ function getPathForURI(uri) { if (uri.substring(0, 4) == "file") return getFileFromURLSpec(uri).path; if (uri.substring(0, 3) == "jar") return getJARFileForURI(uri); return ""; } /** * Get the entry path for a JAR URI * @param uri the jar URI (string or nsIURI) * @returns the entry path (string) */ function getDirInJAR(uri) { if (typeof uri == "string") uri = iosvc.newURI(uri, null, null); uri.QueryInterface(Components.interfaces.nsIJARURI); return uri.JAREntry; } /** * Get an enumerator for the entries in a dir in a JAR: * @param uri {nsIJARURI} the jar URI to find entries for * @returns {nsISimpleEnumerator} an enumerator of the entries. * @note modelled after nsJARDirectoryInputStream::Init */ function getEntriesInJARDir(uri) { uri.QueryInterface(Components.interfaces.nsIJARURI); var zr = newObject("@mozilla.org/libjar/zip-reader;1", Components.interfaces.nsIZipReader); zr.open(uri.JARFile.QueryInterface(Components.interfaces.nsIFileURL).file); var strEntry = uri.JAREntry; // Be careful about empty entry (root of jar); nsIZipReader.getEntry balks if (strEntry) { var realEntry = zr.getEntry(strEntry); if (!realEntry.isDirectory) throw strEntry + " is not a directory!"; } var escapedEntry = escapeJAREntryForFilter(strEntry); var filter = escapedEntry + "?*~" + escapedEntry + "?*/?*"; return [zr, zr.findEntries(filter)]; } /** * Escape all the characters that have a special meaning for nsIZipReader's special needs. * @param {string} original entry name * @returns {string} escaped entry name */ function escapeJAREntryForFilter(entryName) { return entryName.replace(/([\*\?\$\[\]\^\~\(\)\\])/g, "\\$1"); } function getFileFromURLSpec(url) { const nsIFileProtocolHandler = Components.interfaces.nsIFileProtocolHandler; var handler = iosvc.getProtocolHandler("file"); handler = handler.QueryInterface(nsIFileProtocolHandler); return handler.getFileFromURLSpec(url); } /** * Get the spec of the URL from a file. * @param file {nsIFile OR string} the path to the file, or a file object * @returns the URL spec for the file. */ function getURLSpecFromFile (file) { if (!file) return null; const IOS_CTRID = "@mozilla.org/network/io-service;1"; const nsIIOService = Components.interfaces.nsIIOService; if (typeof file == "string") file = localFile(file); var service = Components.classes[IOS_CTRID].getService(nsIIOService); var nsIFileProtocolHandler = Components.interfaces.nsIFileProtocolHandler; var fileHandler = service.getProtocolHandler("file"); fileHandler = fileHandler.QueryInterface(nsIFileProtocolHandler); return fileHandler.getURLSpecFromFile(file); } /** * Create a local file from a path * @param path {string} the path to the file * @returns {nsILocalFile} the local file object */ function localFile(path) { const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const nsILocalFile = Components.interfaces.nsILocalFile; if (typeof path == "string") { var fileObj = Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile); fileObj.initWithPath(path); return fileObj; } return null; }
JavaScript
var file = null; function onLoad() { file = window.arguments[0]; document.title = document.title + file.leafName; document.getElementById("chrome-url-text").value = file.href; document.getElementById("resolved-url-text").value = file.resolvedURI; document.getElementById("resolved-file-text").value = file.path; document.getElementById("resolved-jarfile-text").value = file.path; document.getElementById("resolved-file").hidden = (file.scheme != "file"); document.getElementById("resolved-jarfile").hidden = (file.scheme != "jar"); if (file.TYPE == "ChromeDirectory") document.getElementById("file-size").hidden = true; else document.getElementById("file-size-text").value = getFormattedBytes(file.size); document.getElementById("manifest-text").value = file.getManifest(); var flags; if (file.TYPE == "ChromeFile") flags = file.parent.flags; else flags = file.flags; document.getElementById("flags-text").value = flags; document.getElementById("addon-text").value = file.getAddOn(); }
JavaScript
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is FireFTP * * The Initial Developer of the Original Code is * Mime Cuvalo * Portions created by Mime Cuvalo are Copyright (C) 2004 Mime Cuvalo. * * Alternatively, the contents of this file may be used under the * terms of the GNU Public License (the "GPL"), in which case the * provisions of the GPL are applicable instead of those above. * If you wish to allow use of your version of this file only * under the terms of the GPL and not to allow others to use your * version of this file under the MPL, indicate your decision by * deleting the provisions above and replace them with the notice * and other provisions required by the GPL. If you do not delete * the provisions above, a recipient may use your version of this * file under either the MPL or the GPL. * * Contributor(s): * Gijs Kruitbosch, <gijskruitbosch@gmail`com> */ /* * Large portions of this code are taken literally or partially from code for * the FireFTP extension by Mime Cuvalo. Many thanks to him for writing the * original code. */ var bytesMode = false; const atoms = { folder: atomsvc.getAtom("isFolder"), unfiltered: atomsvc.getAtom("unfiltered"), filtered: atomsvc.getAtom("filtered") } var chromeTree = { data: new Array(), displayData: new Array(), rowCount: 0, getCellText: ct_getCellText, getCellProperties: ct_getCellProperties, getExtension: ct_getExtension, getImageSrc: ct_getImageSrc, getFileIcon: ct_getFileIcon, cycleHeader: ct_cycleHeader, updateView: ct_updateView, getParentIndex: function(row) { return -1; }, getColumnProperties: function(colid, col, props) {}, getLevel: function(row) { return 0; }, getRowProperties: ct_getRowProperties, isContainer: function(row) { return false; }, isSeparator: function(row) { return false; }, isSorted: function(row) { return false; }, setTree: function(treebox) { this.treebox = treebox; }, sort: ct_sort, getFormattedFileSize: ct_getFormattedFileSize, click: function() {}, dblClick: ct_dblClick, keypress: ct_keypress, popupShowing: ct_popupShowing, getCurrentHref: ct_getCurrentHref, getCurrentAbsoluteHref: ct_getCurrentAbsoluteHref, getCurrentItem: ct_getCurrentItem, mouseOver: function() {}, cut: function() {}, copy: function() {}, paste: function() {}, canDrop: function (aIndex, aOrientation) { return false; }, drop: function (aIndex, aOrientation) { }, _url: "", matchesSearch: ct_matchesSearch } chromeTree.__defineSetter__("currentURL", setChromeTreeURL); chromeTree.__defineGetter__("currentURL", getChromeTreeURL); function setChromeTreeURL(newURL) { this._url = newURL; } function getChromeTreeURL() { return this._url; } // Functions used by chromeTree // Get the text to display in any given cell. function ct_getCellText(row, column) { if (row == -1) return " "; switch(column.id) { case "chromefilename": return this.displayData[row].leafName; case "chromefilesize": return this.displayData[row].size; case "chromefiletype": return this.displayData[row].extension; default: return " "; // shouldn't get here } } function ct_getCellProperties(row, col, props) { if (row == -1) return; if (col.id == "chromefilename" && this.displayData[row].isDirectory) props.AppendElement(atoms.folder); if (!this.displayData[row].filtered) props.AppendElement(atoms.unfiltered) } function ct_getRowProperties(row, props) { if (this.displayData[row].filtered) props.AppendElement(atoms.filtered); else props.AppendElement(atoms.unfiltered); } // Get the extension on a (f)ile path. function ct_getExtension(f) { if (f.lastIndexOf(".") != -1) return f.substring(f.lastIndexOf(".") + 1, f.length).toLowerCase(); else return ""; } // Get the icons for the files function ct_getImageSrc(row, column) { if (row == -1) return ""; if (column.id == "chromefilename" && this.displayData[row].icon) return this.displayData[row].icon; return ""; } function ct_cycleHeader(column) { var sortDir = column.element.getAttribute("sortDirection"); var sortDirection = (sortDir == "ascending" || sortDir == "natural") ? "descending" : "ascending"; document.getElementById('chromefilename').setAttribute("sortDirection", "natural"); document.getElementById('chromefilesize').setAttribute("sortDirection", "natural"); document.getElementById('chromefiletype').setAttribute("sortDirection", "natural"); column.element.setAttribute("sortDirection", sortDirection); this.sort(); } function ct_sort() { if (document.getElementById('chromefilename').getAttribute("sortDirection") && document.getElementById('chromefilename').getAttribute("sortDirection") != "natural") { this.data.sort(compareName); if (document.getElementById('chromefilename').getAttribute("sortDirection") == "ascending") this.data.reverse(); } if (document.getElementById('chromefilesize').getAttribute("sortDirection") && document.getElementById('chromefilesize').getAttribute("sortDirection") != "natural") { this.data.sort(compareSize); if (document.getElementById('chromefilesize').getAttribute("sortDirection") == "ascending") this.data.reverse(); } if (document.getElementById('chromefiletype').getAttribute("sortDirection") && document.getElementById('chromefiletype').getAttribute("sortDirection") != "natural") { this.data.sort(compareType); if (document.getElementById('chromefiletype').getAttribute("sortDirection") == "ascending") this.data.reverse(); } delete this.displayData; this.displayData = new Array(); var expr = chromeBrowser.search.expr; const hideFiltered = false; for (var row = 0; row < this.data.length; ++row) { var fFiltered = this.matchesSearch(this.data[row], expr) if (fFiltered || !hideFiltered) { var fName = this.data[row].leafName; var fSize = this.getFormattedFileSize(row); var fExt = this.getExtension(this.data[row].leafName); var fIcon = this.getFileIcon(row); var fIsDir = this.data[row].isDirectory; var formattedData = {leafName: fName, size: fSize, icon: fIcon, extension: fExt, filtered: fFiltered, isDirectory: fIsDir, orig: this.data[row]}; this.displayData.push(formattedData); } } this.treebox.rowCountChanged(0, -this.rowCount); this.rowCount = this.displayData.length; this.treebox.rowCountChanged(0, this.rowCount); } function ct_updateView(column, direction) { var localTreeItems = new Array(); var url = this.currentURL; var position = chromeBrowser.chromeStructure.findURL(url); if (position) { var dirs = position.directories; for (var key in dirs) localTreeItems.push(dirs[key]); var files = position.files; for (var key in files) localTreeItems.push(files[key]); } this.currentLevel = position.level; this.data = localTreeItems; this.sort(); chromeDirTree.reselectCurrentDirectory(); // select directory in chromeDirTree if (this.displayData.length) this.selection.select(0); // Select the first item. } function ct_getFormattedFileSize(row) { if (this.data[row].isDirectory) return ""; if (this.data[row].size == 0) return "0" + (bytesMode ? " " : " KB "); if (bytesMode) return this.data[row].size + " "; else return (Number(this.data[row].size / 1024).toFixed(2)) + " KB "; } function ct_getFileIcon(row) { if (this.data[row].isDirectory) return ""; // Thanks to Alex Sirota! var url = "moz-icon://" + this.data[row].leafName + "?size=16"; return url; } function ct_popupShowing(event) { // return early for submenus, don't need to do anything. if (event.target != document.getElementById("chromemenu")) return true; if (this.selection.count != 1) return false; // cancel, we can't do anything? :S var selectedItem = this.displayData[this.selection.currentIndex].orig; // Can't open or save a dir, nor copy contents: var isDir = selectedItem.isDirectory; document.getElementById("cx-open").setAttribute("disabled", isDir); document.getElementById("cx-saveas").setAttribute("disabled", isDir); document.getElementById("cx-replace").hidden = false; document.getElementById("cx-replace-sep").hidden = false; // Can't open in tabs, current tab, or window when not in Fx: if (chromeBrowser.host != "Firefox") { document.getElementById("cx-open-ext").hidden = false; document.getElementById("cx-open").hidden = true; if (chromeBrowser.host == "Toolkit") document.getElementById("cx-saveas").hidden = true; } // Only show the file or jar items, depending on the kind of mapping. var isFile = (selectedItem.scheme == "file"); var isJAR = (selectedItem.scheme == "jar"); var isData = (selectedItem.scheme == "data"); var isAddon = (selectedItem.getAddOn() != getStr("not.an.addon")); document.getElementById("cx-copyjarurl").hidden = !isJAR; document.getElementById("cx-copyjarpath").hidden = !isJAR; document.getElementById("cx-copyfilepath").hidden = !isFile; document.getElementById("cx-copyfileurl").hidden = !isFile; document.getElementById("cx-copydataurl").hidden = !isData; // Can't launch jar files (yet): document.getElementById("cx-launch").hidden = !isFile; document.getElementById("cx-launch-sep").hidden = !isFile; // Show add-on folder only for add-ons: document.getElementById("cx-show-sep").hidden = !isAddon; document.getElementById("cx-show-manifest").hidden = !isAddon; //document.getElementById("cx-copycontent").setAttribute("disabled", isDir); //document.getElementById("cx-copycontentdata").setAttribute("disabled", isDir); return true; } function ct_getCurrentHref() { if (this.selection.count != 1) return ""; var selectedItem = this.displayData[this.selection.currentIndex].orig; return selectedItem.href; } function ct_getCurrentAbsoluteHref() { if (this.selection.count != 1) return ""; var selectedItem = this.displayData[this.selection.currentIndex].orig; return selectedItem.resolvedURI; } function ct_getCurrentItem() { if (this.selection.count != 1) return null; return this.displayData[this.selection.currentIndex].orig; } function compareName(a, b) { if (!a.isDirectory && b.isDirectory) return 1; if (a.isDirectory && !b.isDirectory) return -1; if (a.leafName.toLowerCase() < b.leafName.toLowerCase()) return -1; if (a.leafName.toLowerCase() > b.leafName.toLowerCase()) return 1; return 0; } function compareSize(a, b) { if (!a.isDirectory && b.isDirectory) return 1; if (a.isDirectory && !b.isDirectory) return -1; if (a.isDirectory && b.isDirectory) return 0; return a.size - b.size; } function compareType(a, b) { if (!a.isDirectory && b.isDirectory) return 1; if (a.isDirectory && !b.isDirectory) return -1; if (chromeTree.getExtension(a.leafName.toLowerCase()) < chromeTree.getExtension(b.leafName.toLowerCase())) return -1; if (chromeTree.getExtension(a.leafName.toLowerCase()) > chromeTree.getExtension(b.leafName.toLowerCase())) return 1; return 0; } //////////////////////////////////////////////////// function ct_dblClick(event) { // Nothing to do for weird buttons, no selection or no valid target. if (event.button != 0 || event.originalTarget.localName != "treechildren" || this.selection.count == 0) return; // Select a *useful* element if necessary. if (this.selection.currentIndex < 0 || this.selection.currentIndex >= this.rowCount) this.selection.currentIndex = this.rowCount - 1; var f = this.displayData[this.selection.currentIndex].orig; if (f.isDirectory) // Open directories { chromeDirTree.changeDir(f.href, true); } else // View file sources. { // View the source of rdf, dtd, xul or js files by default. if ((/xul|js|rdf|dtd/).test(this.getExtension(f.leafName))) { chromeBrowser.viewSourceOf(f.href); } else if (chromeBrowser.host == "Firefox") { chromeBrowser.view(f.href); } else { chromeBrowser.view(f.resolvedURI); } } } function ct_keypress(event) { if (event.keyCode == 13) { var e = {button: 0, originalTarget: {localName: "treechildren"}}; // Hack-er-tee-hack: this.dblClick(e); } } function ct_matchesSearch(obj, expr) { if (!obj || !expr) return true; if (obj.leafName.indexOf(expr) > -1 || obj.href.indexOf(expr) > CH_SCHEME) // ignore "chrome://" { return true; } if (obj.isDirectory) { for (var k in obj.files) { if (k.indexOf(expr) > -1 || obj.files[k].href.indexOf(expr) > CH_SCHEME) return true; } for (var k in obj.directories) { if (k.indexOf(expr) > -1) return true; var dir = obj.directories[k]; if (dir.href.indexOf(expr) > CH_SCHEME) return true; if (this.matchesSearch(dir, expr)) return true; } } return false; }
JavaScript
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is FireFTP * * The Initial Developer of the Original Code is * Mime Cuvalo * Portions created by Mime Cuvalo are Copyright (C) 2004 Mime Cuvalo. * * Alternatively, the contents of this file may be used under the * terms of the GNU Public License (the "GPL"), in which case the * provisions of the GPL are applicable instead of those above. * If you wish to allow use of your version of this file only * under the terms of the GPL and not to allow others to use your * version of this file under the MPL, indicate your decision by * deleting the provisions above and replace them with the notice * and other provisions required by the GPL. If you do not delete * the provisions above, a recipient may use your version of this * file under either the MPL or the GPL. * * Contributor(s): * Gijs Kruitbosch, <gijskruitbosch@gmail`com> */ /* * Large portions of this code are taken literally or partially from code for * the FireFTP extension by Mime Cuvalo. Many thanks to him for writing the * original code. */ var chromeDirTree = { data: new Array(), generateData: cdt_generateData, getCellText: cdt_getCellText, getLevel: cdt_getLevel, getParentIndex: cdt_getParentIndex, getImageSrc: function(row,col) {}, getCellProperties: function(row,col,props) {}, getColumnProperties: function(colid,col,props) {}, getRowProperties: function(row,props) {}, hasNextSibling: function(row,nextrow) { return this.data[row].hasNext; }, isContainer: function(row) { return true; }, isContainerEmpty: cdt_isContainerEmpty, isContainerOpen: function(row) { return this.data[row].open; }, isSeparator: function(row) { return false; }, isSorted: function(row) { return false; }, setTree: function(treebox) { this.treebox = treebox; }, toggleOpenState: cdt_toggleOpenState, updateParentIndices: cdt_updateParentIndices, cdup: cdt_cdup, reselectCurrentDirectory: cdt_reselectCurrentDirectory, changeDir: cdt_changeDir, indexOfURL: cdt_indexOfURL, canDrop: function (aIndex, aOrientation) { return false; }, keypress: cdt_keypress, click: cdt_click, // Steal from chromeTree: matchesSearch: ct_matchesSearch } function cdt_getCellText(row,column) { return row == -1 ? "" : this.data[row].leafName; } function cdt_getLevel(row) { if ((row < 0) || (row >= this.data.length)) return 0; // Don't feed bogus, please. return this.data[row].level - 1; // Woo! Decrement because <tree> assumes lowest level is 0. } function cdt_isContainerEmpty(row) { if ((row < 0) || (row >= this.data.length)) // rows we don't know are empty. return true; return this.data[row].empty; } function cdt_getParentIndex(row) { if (row <= 0) return -1; return this.data[row].parentIndex; } function cdt_toggleOpenState(row) { // Don't feed us nonsense. if (row < 0 || row > this.data.length) return; if (this.isContainerOpen(row)) { // The container is open, find all children and remove them. var currentLevel = this.getLevel(row); // last child to remove: var lastChild = row; // Find the last child's index (within the limits of the data and with a higher level): while ((lastChild + 1 < this.rowCount) && (this.getLevel(lastChild + 1) > currentLevel)) ++lastChild; // Remove the subdirectories and clean up: this.data[row].children = this.data.splice(row + 1, lastChild - row); this.updateParentIndices(); this.rowCount = this.data.length; this.treebox.rowCountChanged(row, -(lastChild - row)); // Alright, it's no longer open: this.data[row].open = false; // Update the row: this.treebox.invalidateRow(row); // Technically, we can be asked to collapse a node above the node we're // viewing. We need to cope with that: if (chromeTree.currentURL.indexOf(this.data[row].href) == 0 && chromeTree.currentURL != this.data[row].href && chromeTree.currentLevel > this.getLevel(row)) { chromeTree.currentURL = this.data[row].href; chromeTree.updateView(); this.selection.select(row); this.treebox.ensureRowIsVisible(row); } else if (chromeTree.currentURL == this.data[row].href) { this.selection.select(row); this.treebox.ensureRowIsVisible(row); } } else // Okay, this node was closed, we open it, we need to add the children. { for (var x = this.data[row].children.length - 1; x >= 0; --x) this.data.splice(row + 1, 0, this.data[row].children[x]); // Clean up this.updateParentIndices(); this.rowCount = this.data.length; this.treebox.rowCountChanged(row + 1, this.data[row].children.length); this.data[row].open = true; this.treebox.invalidateRow(row); } } function cdt_updateParentIndices() { for (var x = 0; x < this.data.length; ++x) { var pIndex = this.data[x].parent ? this.indexOfURL(this.data[x].parent) : -1; this.data[x].parentIndex = pIndex; } } function cdt_cdup() { var parentIndex = this.getParentIndex(this.selection.currentIndex); if (parentIndex != -1) { this.changeDir(this.data[parentIndex].href, false); this.selection.select(parentIndex); } } function cdt_reselectCurrentDirectory() { var index = this.indexOfURL(chromeTree.currentURL); this.selection.select(index); this.treebox.ensureRowIsVisible(index); } function cdt_changeDir(href, forceOpen) { // Hrmmm.... if (!(/\/$/).test(href)) // No slash at the end? tsk. href = href + "/"; var oldDir = chromeTree.currentURL; chromeTree.currentURL = href; if (this.data.length == 0) // We need to create the full data array first. { this.data = this.generateData(chromeBrowser.chromeStructure); this.data.sort(dirSort); this.rowCount = this.data.length; this.treebox.rowCountChanged(0, this.data.length); this.selection.select(0); } // Now we're sure we have a tree. Do something useful with it. var currentLevel = chromeTree.currentLevel; // open parent directories til we find the directory for (var x = 0; x < this.data.length; ++x) { for (var y = this.data.length - 1; y >= x; --y) { // Does the current row have a matching href? if (chromeTree.currentURL.indexOf(this.data[y].href) == 0 // Is the level smaller (parent dir), or do we have an exactly matching URL? && (this.getLevel(y) < currentLevel || chromeTree.currentURL == this.data[y].href)) { x = y; break; } } if (chromeTree.currentURL.indexOf(this.data[x].href) == 0) { // If the directory is not open, open it. if (!this.data[x].open && forceOpen) this.toggleOpenState(x); if (chromeTree.currentURL == this.data[x].href) // Woo, we're done! { chromeTree.updateView(); return; } } } // If we get here, we never found the damn thing, and that's bad. // We should go back to where we were previously. // XXX: maybe fix this to refresh the entire dir structure (bad, lots of work!) chromeTree.currentURL = oldDir; } function cdt_indexOfURL(href) { // binary search to find an url in the chromeDirTree var left = 0; var right = this.data.length - 1; href = href.replace(/\x2f/g, "\x01").toLowerCase(); // make '/' less than everything (except null) while (left <= right) { var mid = Math.floor((left + right) / 2); var dataHref = this.data[mid].href.replace(/\x2f/g, "\x01").toLowerCase(); if (dataHref == href || dataHref + "\x01" == href || dataHref == href + "\x01") return mid; else if (href < dataHref) right = mid - 1; else if (href > dataHref) left = mid + 1; } return -1; } function cdt_generateData(obj) { var data = []; if (!obj || !obj.directories) return data; var directories = obj.directories; var parentHRef = obj.href; if (parentHRef == "chrome://") parentHRef = ""; for (var dir in directories) { var dirObj = directories[dir]; var childData = this.generateData(dirObj); if (childData.length > 0) childData[childData.length - 1].hasNext = false; var dataObj = {leafName: dirObj.leafName, parent: parentHRef, href: dirObj.href, open: false, level: dirObj.level, empty: (childData.length == 0), children: childData, hasNext: (parentHRef), parentIndex: -1}; data.push(dataObj); } return data.sort(dirSort); } function cdt_filter(expr) { for (var i = 0; i < this.data.length; i++) { var obj = this.data[i]; } } function dirSort(a, b) { // make '/' less than everything (except null) var tempA = a.href.replace(/\x2f/g, "\x01").toLowerCase(); var tempB = b.href.replace(/\x2f/g, "\x01").toLowerCase(); if (tempA < tempB) return -1; if (tempA > tempB) return 1; return 0; } ////////////////////////////// // Handlers ////////////////////////////// function cdt_click(event) { if (event.button == 0 || event.button == 2) { var row = {}; var col = {}; var child = {}; this.treebox.getCellAt(event.pageX, event.pageY, row, col, child); var index = this.selection.currentIndex; // index == row.value in case were collapsing the folder if ((index == row.value) && (this.data[index].href != chromeTree.currentURL)) this.changeDir(this.data[index].href, true); } } function cdt_keypress(event) { if (event.keyCode == 13) { var row = {}; var col = {}; var child = {}; var index = this.selection.currentIndex; if (this.data[index].href != chromeTree.currentURL) { this.changeDir(this.data[index].href, false); event.stopPropagation(); event.preventDefault(); } } }
JavaScript
// Xu ly cat --------------------------------------- function nv_chang_cat(object, catid, mod ) { var new_vid = $(object).val(); nv_ajax( "post", script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=change_cat&catid=' + catid + '&mod='+mod+'&new_vid=' + new_vid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_cat_result' ); return; } // --------------------------------------- function nv_chang_cat_result( res ) { window.location = url_back; return false; } function nv_del_cat(catid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax( 'post', script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=del_cat&catid=' + catid, '', 'nv_del_cat_result' ); } return false; } function nv_del_cat_result(res) { var r_split = res.split( "_" ); if (r_split[0] == 'OK') { window.location = url_back; } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; }
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ // Xu ly cat --------------------------------------- function nv_chang_cat(object, catid, mod ) { var new_vid = $(object).val(); nv_ajax( "post", script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=change_cat&catid=' + catid + '&mod='+mod+'&new_vid=' + new_vid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_cat_result' ); return; } // --------------------------------------- function nv_chang_cat_result( res ) { window.location = url_back; return false; } function nv_del_cat(catid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax( 'post', script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=del_cat&catid=' + catid, '', 'nv_del_cat_result' ); } return false; } function nv_del_cat_result(res) { var r_split = res.split( "_" ); if (r_split[0] == 'OK') { window.location = url_back; } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; }
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 5/9/2010, 1:31 */ function nv_send_search( qmin, qmax ) { var nv_timer = nv_settimeout_disable( 'search_submit', 1000 ); var search_query = document.getElementById( 'search_query' ); if( search_query.value.length >= qmin && search_query.value.length <= qmax ) { var q = formatStringAsUriComponent( search_query.value ); search_query.value = q; if( q.length >= qmin && q.length <= qmax ) { q = rawurlencode( q ); var mod = document.getElementById( 'search_query_mod' ).options[document.getElementById( 'search_query_mod' ).selectedIndex].value; var checkss = document.getElementById( 'search_checkss' ).value; var search_logic_and = document.getElementById( 'search_logic_and' ); var search_url = nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=adv&search_query=' + q + '&search_mod=' + mod + '&search_ss=' + checkss; if( search_logic_and.checked == true ) { search_url += '&logic=AND'; } nv_ajax( 'get', search_url, '', 'search_result' ); return; } } search_query.focus(); return false; } // --------------------------------------- function nv_search_viewall( mod, qmin, qmax ) { document.getElementById( 'search_query' ).value = document.getElementById( 'hidden_key' ).value; document.getElementById( 'search_query_mod' ).value = mod; nv_send_search( qmin, qmax ); return; } // --------------------------------------- function GoUrl ( qmin, qmax ) { var nv_timer = nv_settimeout_disable( 'search_submit', 1000 ); var mod = document.getElementById( 'search_query_mod' ).options[document.getElementById( 'search_query_mod' ).selectedIndex].value; if( mod == 'all' ) { alert( "Please choose the module!" ); document.getElementById( 'search_query_mod' ).focus(); return false; } var link = nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + mod + '&' + nv_fc_variable + '=search'; var search_query = document.getElementById( 'search_query' ); if( search_query.value.length >= qmin && search_query.value.length <= qmax ) { var q = formatStringAsUriComponent( search_query.value ); if( q.length >= qmin && q.length <= qmax ) { q = rawurlencode( q ); link = link + '&q=' + q; } } window.location.href = link; return false; } // --------------------------------------- function GoGoogle( qmin, qmax ) { var nv_timer = nv_settimeout_disable( 'search_submit', 1000 ); var search_query = document.getElementById( 'search_query' ); if( search_query.value.length >= qmin && search_query.value.length <= qmax ) { var q = rawurlencode( search_query.value ); var mydomain = rawurlencode( document.getElementById( 'mydomain' ).value ); var confirm_search_on_internet = document.getElementById( 'confirm_search_on_internet' ).value; var link = 'http://www.google.com/custom?hl=' + nv_sitelang + '&domains=' + mydomain + '&q=' + q; if ( ! confirm( confirm_search_on_internet + ' ?' ) ) { link += '&sitesearch=' + mydomain; } window.open( link , '_blank' ); // window.location.href = link; return; } search_query.focus(); return false; }
JavaScript
function faq_show_content( fid ) { window.location.href = "#faq" + fid; return; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES., JSC ( contact@vinades.vn ) * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_cat_del( catid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&del=1&catid=' + catid, '', 'nv_cat_del_result' ); } return false; } // --------------------------------------- function nv_cat_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_chang_weight( catid ) { var nv_timer = nv_settimeout_disable( 'weight' + catid, 5000 ); var newpos = document.getElementById( 'weight' + catid ).options[document.getElementById( 'weight' + catid ).selectedIndex].value; nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changeweight=1&catid=' + catid + '&new=' + newpos + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_weight_result' ); return; } // --------------------------------------- function nv_chang_weight_result( res ) { if ( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } clearTimeout( nv_timer ); window.location.href = window.location.href; return; } // --------------------------------------- function nv_chang_status( catid ) { var nv_timer = nv_settimeout_disable( 'change_status' + catid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changestatus=1&catid=' + catid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_status_res' ); return; } // --------------------------------------- function nv_chang_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = window.location.href; } return; } // --------------------------------------- function nv_chang_row_weight( fid ) { var nv_timer = nv_settimeout_disable( 'weight' + fid, 5000 ); var newpos = document.getElementById( 'weight' + fid ).options[document.getElementById( 'weight' + fid ).selectedIndex].value; nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&changeweight=1&id=' + fid + '&new=' + newpos + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_row_weight_res' ); return; } // --------------------------------------- function nv_chang_row_weight_res( res ) { if ( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } clearTimeout( nv_timer ); window.location.href = window.location.href; return; } // --------------------------------------- function nv_chang_row_status( fid ) { var nv_timer = nv_settimeout_disable( 'change_status' + fid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&changestatus=1&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_row_status_res' ); return; } // --------------------------------------- function nv_chang_row_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = window.location.href; } return; } // --------------------------------------- function nv_row_del( fid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&del=1&id=' + fid, '', 'nv_row_del_result' ); } return false; } // --------------------------------------- function nv_row_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES., JSC ( contact@vinades.vn ) * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved * @Createdate 3 / 25 / 2010 18 : 6 */ var total = 0; function nv_check_accept_number( form, acceptcm, msg ) { var fa = form['option[]']; total = 0; for ( var i = 0; i < fa.length; i ++ ) { if ( fa[i].checked ) { total = total + 1; } if ( total > acceptcm ) { alert( msg ); return false; } } } // --------------------------------------- function nv_sendvoting( form, vid, acceptcm, checkss, msg ) { var lid = '0'; acceptcm = parseInt( acceptcm ); if ( acceptcm == 1 ) { var fa = form.option; for ( var i = 0; i < fa.length; i ++ ) { if ( fa[i].checked ) { lid = fa[i].value; } } } else if ( acceptcm > 1 ) { var fa = form['option[]']; for ( var i = 0; i < fa.length; i ++ ) { if ( fa[i].checked ) { lid = lid + ',' + fa[i].value; } } } if ( lid == '0' && acceptcm > 0 ) { alert( msg ); } else { Shadowbox.open( { content : '<iframe src="' + nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=voting&' + nv_fc_variable + '=main&vid=' + vid + '&checkss=' + checkss + '&lid=' + lid + '" border="0" frameborder="0" style="width:670px;height:400px"></iframe>', player : 'html', height : 400, width : 670 } ); } return false; }
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_del_content(vid, checkss) { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del&vid=' + vid + '&checkss=' + checkss, '', 'nv_del_content_result'); } return false; } function nv_del_content_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=main'; } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } function nv_vote_additem(mess) { items++; var nclass = (items % 2 == 0) ? " class=\"second\"" : ""; var newitem = "<tbody" + nclass + "><tr>"; newitem += " <td style=\"text-align:right\">" + mess + " " + items + "</td>"; newitem += " <td><input type=\"text\" value=\"\" name=\"answervotenews[]\" size=\"60\"></td>"; newitem += " </tr>"; newitem += "</tbody>"; $("#items").append(newitem); }
JavaScript
function nv_del_row( hr, fid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', hr.href, 'del=1&id=' + fid, '', 'nv_del_row_result' ); } return false; } // --------------------------------------- function nv_del_row_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_download_file( fr, flnm ) { var download_hits = document.getElementById( 'download_hits' ).innerHTML; download_hits = intval( download_hits ); download_hits = download_hits + 1; document.getElementById( 'download_hits' ).innerHTML = download_hits; //window.open( nv_siteroot + "index.php?" + nv_lang_variable + "=" + nv_sitelang + "&" + nv_name_variable + "=" + nv_module_name + "&" + nv_fc_variable + "=down&file=" + flnm, fr); window.location.href = nv_siteroot + "index.php?" + nv_lang_variable + "=" + nv_sitelang + "&" + nv_name_variable + "=" + nv_module_name + "&" + nv_fc_variable + "=down&file=" + flnm; return false; } // --------------------------------------- function nv_linkdirect( code ) { var download_hits = document.getElementById( 'download_hits' ).innerHTML; download_hits = intval( download_hits ); download_hits = download_hits + 1; document.getElementById( 'download_hits' ).innerHTML = download_hits; win = window.open( nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=down&code=' + code, 'mydownload' ); win.focus(); return false; } // --------------------------------------- function nv_link_report( fid ) { nv_ajax( "post", nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name, nv_fc_variable + '=report&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_link_report_result' ); return false; } // --------------------------------------- function nv_link_report_result( res ) { alert( report_thanks_mess ); return false; } // --------------------------------------- function nv_sendrating ( fid, point ) { if( fid > 0 && point > 0 && point < 6 ) { nv_ajax( 'post', nv_siteroot + 'index.php', nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&rating=' + fid + '_' + point + '&num=' + nv_randomPassword( 8 ), 'stringrating' ); } return false; } // --------------------------------------- function nv_send_comment() { var nv_timer = nv_settimeout_disable( 'comment_submit', 10000 ); var query = 'uname=' + document.getElementById( 'comment_uname' ).value; query += '&uemail=' + document.getElementById( 'comment_uemail_iavim' ).value; query += '&subject=' + document.getElementById( 'comment_subject' ).value; query += '&content=' + document.getElementById( 'comment_content' ).value; query += '&seccode=' + document.getElementById( 'comment_seccode_iavim' ).value; query += '&id=' + document.getElementById( 'comment_fid' ).value; query += '&ajax=1'; nv_ajax( 'post', nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=getcomment', query + '&num=' + nv_randomPassword( 8 ), '', 'nv_send_comment_res' ); } // --------------------------------------- function nv_send_comment_res( res ) { if( res == 'OK' ) { alert( comment_thanks_mess ); nv_list_comments(); document.getElementById( 'comment_subject' ).value = comment_subject_defaul; document.getElementById( 'comment_content' ).value = ''; hidden_form(); } else if( res == 'WAIT' ) { alert( comment_please_wait ); document.getElementById( 'comment_subject' ).value = comment_subject_defaul; document.getElementById( 'comment_content' ).value = ''; } else { alert( res ); } nv_change_captcha( 'vimg', 'comment_seccode_iavim' ); return false; } // --------------------------------------- function nv_list_comments() { fid = document.getElementById( 'comment_fid' ).value; nv_ajax( 'get', nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=getcomment', '&list_comment=' + fid + '&&num=' + nv_randomPassword( 8 ), 'list_comments' ); return false; } // --------------------------------------- function show_form() { var hidden_form_comment = document.getElementById( 'hidden_form_comment' ); var form_comment = document.getElementById( 'form_comment' ); hidden_form_comment.style.visibility = 'hidden'; hidden_form_comment.style.display = 'none'; form_comment.style.visibility = 'visible'; form_comment.style.display = 'block'; window.location.href = "#cform"; return; } // --------------------------------------- function hidden_form() { var hidden_form_comment = document.getElementById( 'hidden_form_comment' ); var form_comment = document.getElementById( 'form_comment' ); form_comment.style.visibility = 'hidden'; form_comment.style.display = 'none'; hidden_form_comment.style.visibility = 'visible'; hidden_form_comment.style.display = 'block'; window.location.href = "#lcm"; return; } // --------------------------------------- function nv_comment_del( hr, cid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', hr.href, 'del=1&id=' + cid, '', 'nv_comment_del_result' ); } return false; } // --------------------------------------- function nv_comment_del_result( res ) { if( res == 'OK' ) { nv_list_comments(); } else { alert( nv_is_del_confirm[2] ); } return false; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES., JSC ( contact@vinades.vn ) * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_chang_weight( catid ) { var nv_timer = nv_settimeout_disable( 'weight' + catid, 5000 ); var newpos = document.getElementById( 'weight' + catid ).options[document.getElementById( 'weight' + catid ).selectedIndex].value; nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changeweight=1&catid=' + catid + '&new=' + newpos + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_weight_result' ); return; } // --------------------------------------- function nv_chang_weight_result( res ) { if ( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } clearTimeout( nv_timer ); window.location.href = window.location.href; return; } // --------------------------------------- function nv_chang_status( catid ) { var nv_timer = nv_settimeout_disable( 'change_status' + catid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changestatus=1&catid=' + catid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_status_res' ); return; } // --------------------------------------- function nv_chang_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = window.location.href; } return; } // --------------------------------------- function nv_row_del( catid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&del=1&catid=' + catid, '', 'nv_row_del_result' ); } return false; } // --------------------------------------- function nv_row_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_file_del( fid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&del=1&id=' + fid, '', 'nv_file_del_result' ); } return false; } // --------------------------------------- function nv_file_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_chang_file_status( fid ) { var nv_timer = nv_settimeout_disable( 'change_status' + fid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&changestatus=1&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_file_status_res' ); return; } // --------------------------------------- function nv_chang_file_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = window.location.href; } return; } // --------------------------------------- function nv_filequeue_del( fid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=filequeue&del=1&id=' + fid, '', 'nv_filequeue_del_result' ); } return false; } // --------------------------------------- function nv_filequeue_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_filequeue_alldel() { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=filequeue&alldel=1', '', 'nv_filequeue_alldel_result' ); } return false; } // --------------------------------------- function nv_filequeue_alldel_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_checkfile( mylink, is_myUrl, butt ) { var nv_timer = nv_settimeout_disable( butt, 5000 ); var link = document.getElementById( mylink ).value; if( trim( link ) == '' ) { document.getElementById( mylink ).value = ''; return false; } link = rawurlencode( link ); nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&check=1&url=' + link + '&is_myurl=' + is_myUrl + '&num=' + nv_randomPassword( 8 ), '', 'nv_checkfile_result' ); return false; } // --------------------------------------- function nv_gourl( mylink, is_myUrl, butt ) { var nv_timer = nv_settimeout_disable( butt, 5000 ); var link = document.getElementById( mylink ).value; if( trim( link ) == '' ) { document.getElementById( mylink ).value = ''; return false; } if( is_myUrl ) { link = rawurlencode( link ); link = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&fdownload=' + link; window.location.href = link; } else { if( ! link.match( /^(http|ftp)\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i ) ) { alert( nv_url ); document.getElementById( mylink ).focus(); } else { var w = window.open( link ); w.focus(); } } return false; } // --------------------------------------- function nv_checkfile_result( res ) { alert( res ); return false; } // --------------------------------------- function nv_report_del( rid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + rid, '', 'nv_report_del_result' ); } return false; } // --------------------------------------- function nv_report_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_report_check( fid ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&linkcheck=1&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_report_check_result' ); return false; } // --------------------------------------- function nv_report_check_result( res ) { var r_split = res.split( "_" ); if( r_split[0] == "OK" ) { var report_check_ok = document.getElementById( 'report_check_ok' ).value; if ( confirm( report_check_ok ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + r_split[1], '', 'nv_report_del_result' ); } } else { if( r_split[0] == "NO" ) { var report_check_error = document.getElementById( 'report_check_error' ).value; if ( confirm( report_check_error ) ) { nv_report_edit( r_split[1] ); } } else { var report_check_error2 = document.getElementById( 'report_check_error2' ).value; if ( confirm( report_check_error2 ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + r_split[1], '', 'nv_report_del_result' ); } } } return false; } // --------------------------------------- function nv_report_edit( fid ) { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&edit=1&id=' + fid + '&report=1'; return false; } // --------------------------------------- function nv_report_alldel() { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&alldel=1', '', 'nv_report_alldel_result' ); } return false; } // --------------------------------------- function nv_report_alldel_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_chang_comment_status ( cid ) { var nv_timer = nv_settimeout_disable( 'status' + cid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=comment&changestatus=1&id=' + cid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_comment_status_res' ); return; } // --------------------------------------- function nv_chang_comment_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } window.location.href = window.location.href; return; } // --------------------------------------- function nv_comment_del( cid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=comment&del=1&id=' + cid, '', 'nv_comment_del_result' ); } return false; } // --------------------------------------- function nv_comment_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_file_additem() { var newitem = "<input class=\"txt\" value=\"\" name=\"fileupload[]\" id=\"fileupload" + file_items + "\" style=\"width : 300px\" maxlength=\"255\" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_selectfile + "\" name=\"selectfile\" onclick=\"nv_open_browse_file( '" + nv_base_adminurl + "index.php?" + nv_name_variable + "=upload&popup=1&area=fileupload" + file_items + "&path=" + file_dir + "&type=file', 'NVImg', 850, 500, 'resizable=no,scrollbars=no,toolbar=no,location=no,status=no' ); return false; \" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id= \"check_fileupload" + file_items + "\" onclick=\"nv_checkfile( 'fileupload" + file_items + "', 1, 'check_fileupload" + file_items + "' ); \" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_gourl + "\" id= \"go_fileupload" + file_items + "\" onclick=\"nv_gourl( 'fileupload" + file_items + "', 1, 'go_fileupload" + file_items + "' ); \" /><br />"; $( "#fileupload_items" ).append( newitem ); file_items ++ ; } // --------------------------------------- function nv_file_additem2() { var newitem = "<input class=\"txt\" value=\"\" name=\"fileupload2[]\" id=\"fileupload2_" + file_items + "\" style=\"width : 300px\" maxlength=\"255\" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_selectfile + "\" name=\"selectfile\" onclick=\"nv_open_browse_file( '" + nv_base_adminurl + "index.php?" + nv_name_variable + "=upload&popup=1&area=fileupload2_" + file_items + "&path=" + file_dir + "&type=file', 'NVImg', 850, 500, 'resizable=no,scrollbars=no,toolbar=no,location=no,status=no' ); return false; \" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id= \"check_fileupload2_" + file_items + "\" onclick=\"nv_checkfile( 'fileupload2_" + file_items + "', 1, 'check_fileupload2_" + file_items + "' ); \" />"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_gourl + "\" id= \"go_fileupload2_" + file_items + "\" onclick=\"nv_gourl( 'fileupload2_" + file_items + "', 1, 'go_fileupload2_" + file_items + "' ); \" /><br />"; $( "#fileupload2_items" ).append( newitem ); file_items ++ ; } // --------------------------------------- function nv_linkdirect_additem() { var newitem = "<textarea name=\"linkdirect[]\" id=\"linkdirect" + linkdirect_items + "\" style=\"width : 300px; height : 150px\"></textarea>"; newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id=\"check_linkdirect" + linkdirect_items + "\" onclick=\"nv_checkfile( 'linkdirect" + linkdirect_items + "', 0, 'check_linkdirect" + linkdirect_items + "' ); \" /><br />"; $( "#linkdirect_items" ).append( newitem ); linkdirect_items ++ ; }
JavaScript
function sendcontact( num ) { var sendname = document.getElementById( 'fname' ); var sendemail = document.getElementById( 'femail_iavim' ); var sendtitle = document.getElementById( 'ftitle' ); var sendcontent = document.getElementById( 'fcon' ); var bt = document.getElementById( 'btsend' ); var fcon = document.getElementById( 'fcontact' ); bt.disabled = true; if( sendname.value.length < 2 ) { alert( nv_fullname ); bt.disabled = false; sendname.focus(); return false; } if( ! nv_mailfilter.test( sendemail.value ) ) { alert( nv_email ); bt.disabled = false; sendemail.focus(); return false; } if( sendtitle.value.length < 2 ) { alert( nv_title ); bt.disabled = false; sendtitle.focus(); return false; } if( sendcontent.value.length < 2 ) { alert( nv_content ); bt.disabled = false; sendcontent.focus(); return false; } var seccode = document.getElementById( 'fcode_iavim' ); if( ( seccode.value.length != num ) || ! nv_namecheck.test( seccode.value ) ) { alert( nv_code ); nv_change_captcha( 'vimg', 'fcode_iavim' ); bt.disabled = false; seccode.focus(); return false; } return true; } // --------------------------------------- function nv_ismaxlength ( fid, length ) { if ( fid.value.length < length ) { fid.value = fid.value.substring( 0, length ); } }
JavaScript
function nv_chang_status( vid ) { var nv_timer = nv_settimeout_disable( 'change_status_' + vid, 5000 ); var new_status = document.getElementById( 'change_status_' + vid ).options[document.getElementById( 'change_status_' + vid ).selectedIndex].value; nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_status&id=' + vid + '&new_status=' + new_status + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_status_res' ); return; } // --------------------------------------- function nv_chang_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = strHref; } return; } // --------------------------------------- function nv_row_del( vid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_row&id=' + vid, '', 'nv_row_del_result' ); } return false; } // --------------------------------------- function nv_row_del_result( res ) { if( res == 'OK' ) { window.location.href = strHref; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_del_submit( oForm, cbName ) { var ts = 0; if( oForm[cbName].length ) { for ( var i = 0; i < oForm[cbName].length; i ++ ) { if( oForm[cbName][i].checked == true ) { ts = 1; break; } } } else { if( oForm[cbName].checked == true ) { ts = 1; } } if( ts ) { if ( confirm( nv_is_del_confirm[0] ) ) { oForm.submit(); } } return false; } // --------------------------------------- function nv_delall_submit() { if ( confirm( nv_is_del_confirm[0] ) ) { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del&t=3'; } return false; } // --------------------------------------- function nv_del_mess( mid ) { if ( confirm( nv_is_del_confirm[0] ) ) { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del&t=1&id=' + mid; } return false; }
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function sendrating(id, point, newscheckss) { if(point==1 || point==2 || point==3 || point==4 || point==5){ nv_ajax('post', nv_siteroot + 'index.php', nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=rating&id=' + id + '&checkss=' + newscheckss + '&point=' + point, 'stringrating', ''); } } function sendcommment(id, newscheckss, gfx_count) { var commentname = document.getElementById('commentname'); var commentemail = document.getElementById('commentemail_iavim'); var commentseccode = document.getElementById('commentseccode_iavim'); var commentcontent = strip_tags(document.getElementById('commentcontent').value); if (commentname.value == "") { alert(nv_fullname); commentname.focus(); } else if (!nv_email_check(commentemail)) { alert(nv_error_email); commentemail.focus(); } else if (!nv_name_check(commentseccode)) { error = nv_error_seccode.replace( /\[num\]/g, gfx_count ); alert(error); commentseccode.focus(); } else if (commentcontent == "") { alert(nv_content); document.getElementById('commentcontent').focus(); } else { var sd = document.getElementById('buttoncontent'); sd.disabled = true; nv_ajax('post', nv_siteroot + 'index.php', nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=postcomment&id=' + id + '&checkss=' + newscheckss + '&name=' + commentname.value + '&email=' + commentemail.value + '&code=' + commentseccode.value + '&content=' + encodeURIComponent(commentcontent), '', 'nv_commment_result'); } return; } function nv_commment_result(res) { nv_change_captcha('vimg', 'commentseccode_iavim'); var r_split = res.split("_"); if (r_split[0] == 'OK') { document.getElementById('commentcontent').value = ""; nv_show_hidden('showcomment', 1); nv_show_comment(r_split[1], r_split[2], r_split[3]); alert(r_split[4]); } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_content_failed); } nv_set_disable_false('buttoncontent'); return false; } function nv_show_comment(id, checkss, page) { nv_ajax('get', nv_siteroot + 'index.php', nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=comment&id=' + id + '&checkss=' + checkss + '&page=' + page, 'showcomment', ''); } function remove_text() { document.getElementById('to_date').value = ""; document.getElementById('from_date').value = ""; } function nv_del_content(id, checkss, base_adminurl) { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', base_adminurl + 'index.php', nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_content&id=' + id + '&checkss=' + checkss, '', 'nv_del_content_result'); } return false; } function nv_del_content_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { window.location.href = strHref; } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES., JSC ( contact@vinades.vn ) * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_chang_cat(catid, mod) { var nv_timer = nv_settimeout_disable('id_' + mod + '_' + catid, 5000); var new_vid = document.getElementById('id_' + mod + '_' + catid).options[document.getElementById('id_' + mod + '_' + catid).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_cat&catid=' + catid + '&mod=' + mod + '&new_vid=' + new_vid + '&num=' + nv_randomPassword(8), '', 'nv_chang_cat_result'); return; } // --------------------------------------- function nv_chang_cat_result(res) { var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); var parentid = parseInt(r_split[1]); nv_show_list_cat(parentid); return; } // --------------------------------------- function nv_show_list_cat(parentid) { if (document.getElementById('module_show_list')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list_cat&parentid=' + parentid + '&num=' + nv_randomPassword(8), 'module_show_list'); } return; } // --------------------------------------- function nv_del_cat(catid) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_cat&catid=' + catid, '', 'nv_del_cat_result'); return false; } // --------------------------------------- function nv_del_cat_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { var parentid = parseInt(r_split[1]); nv_show_list_cat(parentid); } else if (r_split[0] == 'CONFIRM') { if (confirm(nv_is_del_confirm[0])) { var catid = r_split[1]; var delallcheckss = r_split[2]; nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_cat&catid=' + catid + '&delallcheckss=' + delallcheckss, '', 'nv_del_cat_result'); } } else if (r_split[0] == 'ERR' && r_split[1] == 'CAT') { alert(r_split[2]); } else if (r_split[0] == 'ERR' && r_split[1] == 'ROWS') { if (confirm(r_split[4])) { var catid = r_split[2]; var delallcheckss = r_split[3]; nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_cat&catid=' + catid + '&delallcheckss=' + delallcheckss, 'edit', ''); parent.location='#edit'; } } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_chang_topic(topicid, mod) { var nv_timer = nv_settimeout_disable('id_' + mod + '_' + topicid, 5000); var new_vid = document.getElementById('id_' + mod + '_' + topicid).options[document.getElementById('id_' + mod + '_' + topicid).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_topic&topicid=' + topicid + '&mod=' + mod + '&new_vid=' + new_vid + '&num=' + nv_randomPassword(8), '', 'nv_chang_topic_result'); return; } // --------------------------------------- function nv_chang_topic_result(res) { var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_list_topic(); return; } // --------------------------------------- function nv_show_list_topic() { if (document.getElementById('module_show_list')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list_topic&num=' + nv_randomPassword(8), 'module_show_list'); } return; } // --------------------------------------- function nv_del_topic(topicid) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_topic&topicid=' + topicid, '', 'nv_del_topic_result'); } // --------------------------------------- function nv_del_topic_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { nv_show_list_topic(); } else if (r_split[0] == 'ERR') { if (r_split[1] == 'ROWS') { if (confirm(r_split[4])) { var topicid = r_split[2]; var checkss = r_split[3]; nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_topic&topicid=' + topicid + '&checkss=' + checkss, '', 'nv_del_topic_result'); } } else { alert(r_split[1]); } } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_chang_sources(sourceid, mod) { var nv_timer = nv_settimeout_disable('id_' + mod + '_' + sourceid, 5000); var new_vid = document.getElementById('id_' + mod + '_' + sourceid).options[document.getElementById('id_' + mod + '_' + sourceid).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_source&sourceid=' + sourceid + '&mod=' + mod + '&new_vid=' + new_vid + '&num=' + nv_randomPassword(8), '', 'nv_chang_sources_result'); return; } // --------------------------------------- function nv_chang_sources_result(res) { var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_list_source(); return; } // --------------------------------------- function nv_show_list_source() { if (document.getElementById('module_show_list')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list_source&num=' + nv_randomPassword(8), 'module_show_list'); } return; } // --------------------------------------- function nv_del_source(sourceid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_source&sourceid=' + sourceid, '', 'nv_del_source_result'); } return false; } // --------------------------------------- function nv_del_source_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { nv_show_list_source(); } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_del_block_cat(bid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_block_cat&bid=' + bid, '', 'nv_del_block_cat_result'); } return false; } // --------------------------------------- function nv_del_block_cat_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { nv_show_list_block_cat(); } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_chang_block_cat(bid, mod) { var nv_timer = nv_settimeout_disable('id_' + mod + '_' + bid, 5000); var new_vid = document.getElementById('id_' + mod + '_' + bid).options[document.getElementById('id_' + mod + '_' + bid).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=chang_block_cat&bid=' + bid + '&mod=' + mod + '&new_vid=' + new_vid + '&num=' + nv_randomPassword(8), '', 'nv_chang_block_cat_result'); return; } // --------------------------------------- function nv_chang_block_cat_result(res) { var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_list_block_cat(); return; } // --------------------------------------- function nv_show_list_block_cat() { if (document.getElementById('module_show_list')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list_block_cat&num=' + nv_randomPassword(8), 'module_show_list'); } return; } // --------------------------------------- function nv_chang_block(bid, id, mod) { var nv_timer = nv_settimeout_disable('id_weight_' + id, 5000); var new_vid = document.getElementById('id_weight_' + id).options[document.getElementById('id_weight_' + id).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_block&id=' + id + '&bid=' + bid + '&&mod=' + mod + '&new_vid=' + new_vid + '&num=' + nv_randomPassword(8), '', 'nv_chang_block_result'); return; } // --------------------------------------- function nv_chang_block_result(res) { var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } var bid = parseInt(r_split[1]); nv_show_list_block(bid); return; } // --------------------------------------- function nv_show_list_block(bid) { if (document.getElementById('module_show_list')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list_block&bid=' + bid + '&num=' + nv_randomPassword(8), 'module_show_list'); } return; } // --------------------------------------- function nv_del_block_list(oForm, bid) { var del_list = ''; var fa = oForm['idcheck[]']; if (fa.length) { for ( var i = 0; i < fa.length; i++) { if (fa[i].checked) { del_list = del_list + ',' + fa[i].value; } } } else { if (fa.checked) { del_list = del_list + ',' + fa.value; } } if (del_list != '') { nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_block&del_list=' + del_list + '&bid=' + bid + '&num=' + nv_randomPassword(8), '', 'nv_chang_block_result'); } } // --------------------------------------- function nv_main_action(oForm, checkss, msgnocheck) { var fa = oForm['idcheck[]']; var listid = ''; if (fa.length) { for ( var i = 0; i < fa.length; i++) { if (fa[i].checked) { listid = listid + fa[i].value + ','; } } } else { if (fa.checked) { listid = listid + fa.value + ','; } } if (listid != '') { var action = document.getElementById('action').value; if (action == 'delete') { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_content&listid=' + listid + '&checkss=' + checkss, '', 'nv_del_content_result'); } } else if (action == 'addtoblock') { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=block&listid=' + listid + '#add'; } else if (action == 'publtime') { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=publtime&listid=' + listid + '&checkss=' + checkss; } else if (action == 'exptime') { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=exptime&listid=' + listid + '&checkss=' + checkss; } else { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=addtotopics&listid=' + listid; } } else { alert(msgnocheck); } } // --------------------------------------- function nv_del_content(id, checkss, base_adminurl) { if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_content&id=' + id + '&checkss=' + checkss, '', 'nv_del_content_result'); } return false; } // --------------------------------------- function nv_check_movecat(oForm, msgnocheck) { var fa = oForm['catidnews']; if (fa.value == 0) { alert(msgnocheck); return false; } } // --------------------------------------- function nv_del_content_result(res) { var r_split = res.split("_"); if (r_split[0] == 'OK') { window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=main'; } else if (r_split[0] == 'ERR') { alert(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function create_keywords() { var content = strip_tags(document.getElementById('keywords').value); if (content != '') { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=keywords&content=' + encodeURIComponent(content), '', 'res_keywords'); } return false; } // --------------------------------------- function res_keywords(res) { if (res != "n/a") { document.getElementById('keywords').value = res; } else { document.getElementById('keywords').value = ''; } return false; } //--------------------------------------- function get_alias(mod,id) { var title = strip_tags(document.getElementById('idtitle').value); if (title != '') { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=alias&title=' + encodeURIComponent(title)+'&mod='+mod+'&id='+id, '', 'res_get_alias'); } return false; } function res_get_alias(res) { if (res != "") { document.getElementById('idalias').value = res; } else { document.getElementById('idalias').value = ''; } return false; } // autocomplete function function findValue(li) { if (li == null) return alert("No match!"); if (!!li.extra) var sValue = li.extra[0]; else var sValue = li.selectValue; return sValue; } // --------------------------------------- function selectItem(li) { sValue = findValue(li); } // --------------------------------------- function formatItem(row) { return row[0] + " (" + row[1] + ")"; } // --------------------------------------- // end autocomplete function // collapse Div $(document).ready(function() { // hide message_body after the first one $(".message_list .message_body:gt(1)").hide(); // hide message li after the 5th $(".message_list li:gt(5)").hide(); // toggle message_body $(".message_head").click(function() { $(this).next(".message_body").slideToggle(500) return false; }); // collapse all messages $(".collpase_all_message").click(function() { $(".message_body").slideUp(500) return false; }); // Show all messages $(".show_all_message").click(function() { $(".message_body").slideDown(1000) return false; }); } // --------------------------------------- ); // End collapse Div
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES ( contact@vinades.vn ) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3 - 24 - 2010 23 : 41 */ function nv_login_info( containerid ) { /* alert(nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners&' + nv_fc_variable + '=logininfo' + '&num=' + nv_randomPassword( 8 )); return false;*/ nv_ajax( "get", nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners&' + nv_fc_variable + '=logininfo' + '&num=' + nv_randomPassword( 8 ), '', containerid ); return false; } // --------------------------------------- function nv_cl_login_submit( nick_max, nick_min, pass_max, pass_min, gfx_count, gfx_chk, login_id, pass_id, sec_id, button_id ) { var request_query = nv_fc_variable + '=logininfo&save=1'; var login = document.getElementById( login_id ); var error; if( login.value.length > nick_max || login.value.length < nick_min || ! nv_namecheck.test( login.value ) ) { error = nv_error_login.replace( /\[max\]/g, nick_max ); error = error.replace( /\[min\]/g, nick_min ); alert( error ); login.focus(); return false; } request_query += '&login=' + login.value; var pass = document.getElementById( pass_id ); if( pass.value.length > pass_max || pass.value.length < pass_min || ! nv_namecheck.test( pass.value ) ) { error = nv_error_password.replace( /\[max\]/g, pass_max ); error = error.replace( /\[min\]/g, pass_min ); alert( error ); pass.focus(); return false; } request_query += '&password=' + pass.value; if( gfx_chk ) { var sec = document.getElementById( sec_id ); if( sec.value.length != gfx_count) { error = nv_error_seccode.replace( /\[num\]/g, gfx_count ); alert( error ); sec.focus(); return false; } request_query += '&seccode=' + sec.value; } var nv_timer = nv_settimeout_disable( button_id, 5000 ); nv_ajax( "post",nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners', request_query + '&num=' + nv_randomPassword( 8 ), '', 'nv_cl_login_submit_res' ); return false; } // --------------------------------------- function nv_cl_login_submit_res( res ) { if( res == 'OK' ) { window.location.href = window.location.href; return false; } alert( nv_login_failed ); nv_login_info( res ); return false; } // --------------------------------------- function nv_cl_info( containerid ) { nv_ajax( "get", nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners&' + nv_fc_variable + '=clinfo' + '&num=' + nv_randomPassword( 8 ), '', containerid ); return false; } // --------------------------------------- function nv_cl_edit( containerid ) { nv_ajax( "get", nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners&' + nv_fc_variable + '=cledit' + '&num=' + nv_randomPassword( 8 ), '', containerid ); return false; } // --------------------------------------- function nv_cl_edit_save( full_name, email, website, location, yim, phone, fax, mobile, pass, re_pass, button_id ) { var request_query = nv_fc_variable + '=cledit&save=1'; request_query += '&full_name=' + rawurlencode( strip_tags( trim( document.getElementById( full_name ).value.replace( /[\s]{2,}/g, ' ' ) ) ) ); request_query += '&email=' + rawurlencode( strip_tags( document.getElementById( email ).value.replace( /[^a-zA-Z0-9\_\-\.\@]/g, '' ) ) ); request_query += '&website=' + rawurlencode( strip_tags( trim( document.getElementById( website ).value.replace(/[^a-zA-Z0-9\:\#\!\:\.\?\+\=\&\%\@\-\/\,]/g,'') ) ) ); request_query += '&location=' + rawurlencode( strip_tags( trim( document.getElementById( location ).value.replace( /[\s]{2,}/g, ' ' ) ) ) ); request_query += '&yim=' + rawurlencode( strip_tags( trim( document.getElementById( yim ).value.replace(/[^a-zA-Z0-9\.\-\_]/g,'') ) ) ); request_query += '&phone=' + rawurlencode( strip_tags( trim( document.getElementById( phone ).value.replace(/[^0-9\.\+\-\#\(\) ]/g,'').replace(/[\s]{2,}/g, ' ') ) ) ); request_query += '&fax=' + rawurlencode( strip_tags( trim( document.getElementById( fax ).value.replace(/[^0-9\.\+\-\#\(\) ]/g,'').replace(/[\s]{2,}/g, ' ') ) ) ); request_query += '&mobile=' + rawurlencode( strip_tags( trim( document.getElementById( mobile ).value.replace(/[^0-9\.\+\-\#\(\) ]/g,'').replace(/[\s]{2,}/g, ' ') ) ) ); request_query += '&pass=' + rawurlencode( strip_tags( trim( document.getElementById( pass ).value ) ) ); request_query += '&re_pass=' + rawurlencode( strip_tags( trim( document.getElementById( re_pass ).value ) ) ); request_query += '&num=' + nv_randomPassword( 8 ); var nv_timer = nv_settimeout_disable( button_id, 5000 ); nv_ajax( "post", nv_siteroot + 'index.php?' + nv_lang_variable + '=' + nv_sitelang + '&' + nv_name_variable + '=banners', request_query, '', 'nv_cl_edit_save_res' ); return false; } // --------------------------------------- function nv_cl_edit_save_res( res ) { var r_split = res.split( "|" ); if( r_split[0] == 'OK' ) { nv_cl_info( r_split[1] ); } else { var error = r_split[0].replace( /\&[l|r]dquo\;/g, '' ); alert( error ); if( r_split[1] ) { var nif = document.getElementById( r_split[1] ); nif.focus(); } } return false; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES ( contact@vinades.vn ) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3 - 11 - 2010 20 : 50 */ function nv_show_cl_list(containerid) { nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=cl_list&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_cl_del(cl_id) { if (confirm(nv_is_del_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=del_client&id=' + cl_id + '&num=' + nv_randomPassword(8), '', 'nv_cl_del_res'); } return false; } // --------------------------------------- function nv_cl_del_res(res) { var r_split = res.split("|"); if (r_split[0] == 'OK') { nv_show_cl_list(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_cl_del2(cl_id) { if (confirm(nv_is_del_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=del_client&id=' + cl_id + '&num=' + nv_randomPassword(8), '', 'nv_cl_del2_res'); } return false; } // --------------------------------------- function nv_cl_del2_res(res) { var r_split = res.split("|"); if (r_split[0] == 'OK') { window.location.href = script_name + '?' + nv_name_variable + '=banners&' + nv_fc_variable + '=' + r_split[2]; } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_chang_act(cl_id, checkbox_id) { if (confirm(nv_is_change_act_confirm[0])) { var nv_timer = nv_settimeout_disable(checkbox_id, 5000); nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_client&id=' + cl_id + '&num=' + nv_randomPassword(8), '', 'nv_chang_act_res'); } else { var sl = document.getElementById(checkbox_id); if (sl.checked == true) sl.checked = false; else sl.checked = true; } return; } // --------------------------------------- function nv_chang_act_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); var sl = document.getElementById(r_split[1]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; } return false; } // --------------------------------------- function nv_chang_act2(cl_id) { if (confirm(nv_is_change_act_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_client&id=' + cl_id + '&num=' + nv_randomPassword(8), '', 'nv_chang_act2_res'); } return; } // --------------------------------------- function nv_chang_act2_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } else { nv_client_info(r_split[2], r_split[3]) } return false; } // --------------------------------------- function nv_client_info(cl_id, containerid) { nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=info_cl&id=' + cl_id + '&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_banners_list(cl_id, containerid) { nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=banners_client&id=' + cl_id + '&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_show_plans_list(containerid) { nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=plist&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_pl_chang_act(pid, checkbox_id) { if (confirm(nv_is_change_act_confirm[0])) { var nv_timer = nv_settimeout_disable(checkbox_id, 5000); nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_plan&id=' + pid + '&num=' + nv_randomPassword(8), '', 'nv_pl_chang_act_res'); } else { var sl = document.getElementById(checkbox_id); if (sl.checked == true) sl.checked = false; else sl.checked = true; } return; } // --------------------------------------- function nv_pl_chang_act_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); var sl = document.getElementById(r_split[1]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; } return false; } // --------------------------------------- function nv_pl_del(pid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=del_plan&id=' + pid + '&num=' + nv_randomPassword(8), '', 'nv_pl_del_res'); } return false; } // --------------------------------------- function nv_pl_del_res(res) { var r_split = res.split("|"); if (r_split[0] == 'OK') { nv_show_plans_list(r_split[1]); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_plan_info(pid, containerid) { nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=info_pl&id=' + pid + '&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_pl_chang_act2(pid) { if (confirm(nv_is_change_act_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_plan&id=' + pid + '&num=' + nv_randomPassword(8), '', 'nv_pl_chang_act2_res'); } return; } // --------------------------------------- function nv_pl_chang_act2_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } else { nv_plan_info(r_split[2], r_split[3]) } return false; } // --------------------------------------- function nv_pl_del2(pid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=del_plan&id=' + pid + '&num=' + nv_randomPassword(8), '', 'nv_pl_del2_res'); } return false; } // --------------------------------------- function nv_pl_del2_res(res) { var r_split = res.split("|"); if (r_split[0] == 'OK') { window.location.href = script_name + '?' + nv_name_variable + '=banners&' + nv_fc_variable + '=' + r_split[2]; } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_show_banners_list(containerid, clid, pid, act) { var request_query = nv_fc_variable + '=b_list'; if (clid != 0) { request_query += '&clid=' + clid; } else { if (pid != 0) request_query += '&pid=' + pid; } request_query += '&act=' + act; $('#' + containerid).load(script_name + '?' + nv_name_variable + '=banners&' + request_query + '&num=' + nv_randomPassword(8) + '&nocache=' + new Date().getTime()); return false; } function nv_chang_weight_banners(containerid, clid, pid, act, id) { var request_query = nv_fc_variable + '=b_list'; var nv_timer = nv_settimeout_disable('id_weight_' + id, 5000); var weight = document.getElementById('id_weight_' + id).options[document.getElementById('id_weight_' + id).selectedIndex].value; if (clid != 0) { request_query += '&clid=' + clid; } else { if (pid != 0) request_query += '&pid=' + pid; } request_query += '&act=' + act; request_query += '&id=' + id; request_query += '&weight=' + weight; $('#' + containerid).load(script_name + '?' + nv_name_variable + '=banners&' + request_query + '&num=' + nv_randomPassword(8) + '&nocache=' + new Date().getTime()); return false; } // --------------------------------------- function nv_b_chang_act(id, checkbox_id) { if (confirm(nv_is_change_act_confirm[0])) { var nv_timer = nv_settimeout_disable(checkbox_id, 5000); nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_banner&id=' + id + '&num=' + nv_randomPassword(8), '', 'nv_b_chang_act_res'); } else { var sl = document.getElementById(checkbox_id); if (sl.checked == true) sl.checked = false; else sl.checked = true; } return; } // --------------------------------------- function nv_b_chang_act_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); var sl = document.getElementById(r_split[1]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; } else { window.location.href = window.location.href; } return false; } // --------------------------------------- function nv_b_chang_act2(id) { if (confirm(nv_is_change_act_confirm[0])) { nv_ajax("post", script_name + '?' + nv_name_variable + '=banners', nv_fc_variable + '=change_act_banner&id=' + id + '&num=' + nv_randomPassword(8), '', 'nv_b_chang_act_res'); } return; } // --------------------------------------- function nv_b_chang_act_res(res) { var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } else { window.location.href = window.location.href; } return false; } // --------------------------------------- function nv_show_stat(bid, select_month, select_ext, button_id, containerid) { var nv_timer = nv_settimeout_disable(button_id, 5000); var month = document.getElementById(select_month).options[document.getElementById(select_month).selectedIndex].value; var ext = document.getElementById(select_ext).options[document.getElementById(select_ext).selectedIndex].value; var request_query = nv_fc_variable + '=show_stat&id=' + bid + '&month=' + month + '&ext=' + ext; nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', request_query + '&num=' + nv_randomPassword(8), containerid); return false; } // --------------------------------------- function nv_show_list_stat(bid, month, ext, val, containerid, page) { var request_query = nv_fc_variable + '=show_list_stat&bid=' + bid + '&month=' + month + '&ext=' + ext + '&val=' + val; if (page != '0') request_query += '&page=' + page; nv_ajax("get", script_name + '?' + nv_name_variable + '=banners', request_query + '&num=' + nv_randomPassword(8), containerid); }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES., JSC ( contact@vinades.vn ) * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_chang_question( qid ) { var nv_timer = nv_settimeout_disable( 'id_weight_' + qid, 5000 ); var new_vid = document.getElementById( 'id_weight_' + qid ).options[document.getElementById( 'id_weight_' + qid ).selectedIndex].value; nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=question&changeweight=1&qid=' + qid + '&new_vid=' + new_vid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_question_result' ); return; } // --------------------------------------- function nv_chang_question_result( res ) { if ( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } clearTimeout( nv_timer ); nv_show_list_question(); return; } // --------------------------------------- function nv_save_title( qid ) { var new_title = document.getElementById( 'title_' + qid ); var hidden_title = document.getElementById( 'hidden_' + qid ); if(new_title.value == hidden_title.value) { return; } if(new_title.value == '') { alert( nv_content ); new_title.focus(); return false; } var nv_timer = nv_settimeout_disable( 'title_' + qid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=question&edit=1&qid=' + qid + '&title=' + new_title.value + '&num=' + nv_randomPassword( 8 ), '', 'nv_save_title_result' ); return; } // --------------------------------------- function nv_save_title_result(res) { if ( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); } clearTimeout( nv_timer ); nv_show_list_question(); return; } // --------------------------------------- function nv_show_list_question() { if ( document.getElementById( 'module_show_list' ) ) { nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=question&qlist=1&num=' + nv_randomPassword( 8 ), 'module_show_list' ); } return; } // --------------------------------------- function nv_del_question( qid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=question&del=1&qid=' + qid, '', 'nv_del_question_result' ); } return false; } // --------------------------------------- function nv_del_question_result( res ) { if ( res == 'OK' ) { nv_show_list_question(); } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_add_question() { var new_title = document.getElementById( 'new_title' ); if(new_title.value == '') { alert( nv_content ); new_title.focus(); return false; } var nv_timer = nv_settimeout_disable( 'new_title', 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=question&add=1&title=' + new_title.value + '&num=' + nv_randomPassword( 8 ), '', 'nv_add_question_result' ); return; } // --------------------------------------- function nv_add_question_result( res ) { if ( res == 'OK' ) { nv_show_list_question(); } else { alert( nv_content ); } return false; } // --------------------------------------- function nv_row_del( vid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del&userid=' + vid, '', 'nv_row_del_result' ); } return false; } // --------------------------------------- function nv_row_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_waiting_row_del( uid ) { if ( confirm( nv_is_del_confirm[0] ) ) { nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=user_waiting&del=1&userid=' + uid, '', 'nv_waiting_row_del_result' ); } return false; } // --------------------------------------- function nv_waiting_row_del_result( res ) { if( res == 'OK' ) { window.location.href = window.location.href; } else { alert( nv_is_del_confirm[2] ); } return false; } // --------------------------------------- function nv_chang_status( vid ) { var nv_timer = nv_settimeout_disable( 'change_status_' + vid, 5000 ); nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=setactive&userid=' + vid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_status_res' ); return; } // --------------------------------------- function nv_chang_status_res( res ) { if( res != 'OK' ) { alert( nv_is_change_act_confirm[2] ); window.location.href = window.location.href; } return; } /** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 1 - 31 - 2010 5 : 12 */ function nv_group_change_status(group_id) { var nv_timer = nv_settimeout_disable('select_' + group_id, 5000); nv_ajax( "post", script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_act&group_id=' + group_id + '&num=' + nv_randomPassword(8), '', 'nv_group_change_res' ); return; } // --------------------------------------- function nv_group_change_res(res) { var r_split = res.split( "_" ); var sl = document.getElementById( 'select_' + r_split[1] ); if(r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); if(sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; return; } return; } // --------------------------------------- function nv_group_del(group_id) { if (confirm(nv_is_del_confirm[0])) { nv_ajax( 'post', script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_del&group_id=' + group_id, '', 'nv_group_del_result' ); } return false; } // --------------------------------------- function nv_group_del_result(res) { var r_split = res.split( "_" ); if(r_split[0] == 'OK') { window.location.href = strHref; } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_group_search_users(my_url) { var search_query = document.getElementById( 'search_query' ); var search_option = document.getElementById( 'search_option' ).options[document.getElementById( 'search_option' ).selectedIndex].value; var is_search = document.getElementById( 'is_search' ); is_search.value = 1; nv_settimeout_disable('search_click', 5000); search_query = rawurlencode(search_query.value); my_url = rawurldecode(my_url); nv_ajax( 'get', my_url, 'search_query=' + search_query + '&search_option=' + search_option, 'search_users_result' ); return; } // --------------------------------------- function nv_group_add_user(group_id, userid) { var user_checkbox = document.getElementById( 'user_' + userid ); if (confirm(nv_is_add_user_confirm[0])) { user_checkbox.disabled = true; nv_ajax( "post", script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_add_user&group_id=' + group_id + '&userid=' + userid, '', 'nv_group_add_user_res' ); } else { user_checkbox.checked = false; } return; } // --------------------------------------- function nv_group_add_user_res(res) { var res2 = res.split( "_" ); if(res2[0] != 'OK') { var user_checkbox = document.getElementById( 'user_' + userid ); user_checkbox.disabled = false; user_checkbox.checked = false; alert(nv_is_add_user_confirm[2]); return false; } else { var count_user = document.getElementById( 'count_users_' + res2[1] ).innerHTML; count_user = intval(count_user) + 1; document.getElementById( 'count_users_' + res2[1] ).innerHTML = count_user; var is_search = document.getElementById( 'is_search' ).value; if(is_search != 0) { var url2 = script_name + '?' + nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_search_users&group_id=' + res2[1]; url2 = rawurlencode(url2); nv_group_search_users(url2, 'search_users_result'); } var url3 = script_name + '?' + nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_users&group_id=' + res2[1]; url3 = rawurlencode(url3); nv_urldecode_ajax(url3, 'list_users'); } } // --------------------------------------- function nv_group_exclude_user(group_id, userid) { var user_checkbox2 = document.getElementById( 'exclude_user_' + userid ); if (confirm(nv_is_exclude_user_confirm[0])) { user_checkbox2.disabled = true; nv_ajax( "post", script_name, nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_exclude_user&group_id=' + group_id + '&userid=' + userid, '', 'nv_group_exclude_user_res' ); } else { user_checkbox2.checked = false; } return; } // --------------------------------------- function nv_group_exclude_user_res(res) { var res3 = res.split( "_" ); if(res3[0] != 'OK') { var user_checkbox2 = document.getElementById( 'exclude_user_' + userid ); user_checkbox2.disabled = false; user_checkbox2.checked = false; alert(nv_is_exclude_user_confirm[2]); return false; } else { var count_user = document.getElementById( 'count_users_' + res3[1] ).innerHTML; count_user = intval(count_user) - 1; document.getElementById( 'count_users_' + res3[1] ).innerHTML = count_user; var is_search = document.getElementById( 'is_search' ).value; if(is_search != 0) { var url2 = script_name + '?' + nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_search_users&id=' + res3[1]; url2 = rawurlencode(url2); nv_group_search_users(url2, 'search_users_result'); } var url3 = script_name+'?'+ nv_name_variable+'='+nv_module_name+'&'+nv_fc_variable + '=groups_users&group_id=' + res3[1]; url3 = rawurlencode(url3); nv_urldecode_ajax(url3, 'list_users'); } }
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','en',{placeholder:{title:'Placeholder Properties',toolbar:'Create Placeholder',text:'Placeholder Text',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add('uicolor',{requires:['dialog'],lang:['en','he'],init:function(a){if(CKEDITOR.env.ie6Compat)return;a.addCommand('uicolor',new CKEDITOR.dialogCommand('uicolor'));a.ui.addButton('UIColor',{label:a.lang.uicolor.title,command:'uicolor',icon:this.path+'uicolor.gif'});CKEDITOR.dialog.add('uicolor',this.path+'dialogs/uicolor.js');CKEDITOR.scriptLoader.load(CKEDITOR.getUrl('plugins/uicolor/yui/yui.js'));a.element.getDocument().appendStyleSheet(CKEDITOR.getUrl('plugins/uicolor/yui/assets/yui.css'));}});
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','he',{uicolor:{title:'בחירת צבע ממשק משתמש',preview:'תצוגה מקדימה',config:'הדבק את הטקסט הבא לתוך הקובץ config.js',predefined:'קבוצות צבעים מוגדרות מראש'}});
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */
JavaScript
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; };
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'); var nv_aryDayNS = nv_aryDayNS = new Array('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'); var nv_aryMonth = nv_aryMonth = new Array('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'); var nv_aryMS = new Array('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aout', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Êtes-vous sûr de vouloir quitter l\'Administration?','Toutes les informations de votre session ont été supprimées. Vous avez quitté l\'Administration'); var nv_is_del_confirm = new Array('Êtes-vous sûr de vouloir supprimer? Si vous acceptez, toutes les données seront supprimées, il est impossible de les restauter.','Suppression réussie','Suppression échouée'); var nv_is_change_act_confirm = new Array('Êtes-vous sûr de vouloir \'changer\'?',' \'Changement\' réussi',' \'Changement\' échoué'); var nv_is_empty_confirm = new Array('Êtes-vous sûr de vouloir \'vider\'?',' \'vider\' avec succès',' \'vider\' échoué pour une raison inconnue'); var nv_is_recreate_confirm = new Array('Êtes-vous sûr de vouloir \'ré-installer\'?',' \'Ré-installation\' réussie','\'Ré-installation\' échouée pour une raison inconnue'); var nv_is_add_user_confirm = new Array('Êtes-vous sûr de vouloir ajouter les nouveaux membres au groupe?','\'Ajout\' de nouveaux membres au groupe avec succcès',' \'Ajout \' échoué pour une raison inconnue'); var nv_is_exclude_user_confirm = new Array('Êtes-vous sûr de vouloir éliminer ce membre?','\'Élimination\' réussie',' \'Élimination\ échouée pour une raison inconnue'); var nv_formatString = "jj.mm.aaaa"; var nv_gotoString = "Aller au mois actuel"; var nv_todayString = "Aujourd'hui c'est"; var nv_weekShortString = "Semaine"; var nv_weekString = "par semaine"; var nv_scrollLeftMessage = "Cliquez pour aller au mois précédant. Enfoncez le bouton du souris pour enrouler automatiquement."; var nv_scrollRightMessage = "Cliquez pour aller au mois suivant. Enfoncez le bouton du souris pour enrouler automatiquement."; var nv_selectMonthMessage = "Cliquez pour sélectionner un mois."; var nv_selectYearMessage = "Cliquez pour sélectionner un an."; var nv_selectDateMessage = "Sélectionnez [date] comme date."; var nv_loadingText = "Chargement..."; var nv_loadingTitle = "Cliquez pour annuler"; var nv_focusTitle = "Cliquez pour mettre au premier plan"; var nv_fullExpandTitle = "Expandre à la taille réelle (f)"; var nv_restoreTitle = "Cliquez pour fermer l'image, Cliquez et glissez pour déplacer. Utilisez les flèches pour Précédente et Suivante."; var nv_error_login = "Erreur: Vous n'avez pas rempli votre compte ou les infos du compte sont incorrectes. Le compte se combine de lettres latines, de chiffres et tiret. Maximum [max], minimum [min] caractères."; var nv_error_password = "Erreur: Vous n'avez pas rempli le mot de passe ou le mot de passe n'est pas correct. Le mot de passe se combine de lettres latines, de chiffres et tiret. Maximum [max], minimum [min] caractères."; var nv_error_email = "Erreur: Vous n'avez pas entré votre e-mail ou l'e-mail n'est pas correct."; var nv_error_seccode = "Erreur: Vous n'avez pas entré le code de sécurité ou le code n'est pas correct. Code de sécurité est une série de [num] caractères affichées en image."; var nv_login_failed = "Erreur: Le système n'accepte pas votre compte. Essayez de nouveau."; var nv_content_failed = "Erreur: Le système n'accepte pas les infos. Essayez de nouveau."; var nv_required ="Ce champ est obligatoire."; var nv_remote = "Merci de corriger ce champ."; var nv_email = "Merci d'entrer un e-mail valide."; var nv_url = "Merci de donner un lien valide."; var nv_date = "Merci de donner une date valide."; var nv_dateISO = "Merci de donner une date valide (ISO)."; var nv_number = "Merci d'entrer un nombre valide."; var nv_digits = "Merci d'entrer uniquement les chiffres."; var nv_creditcard = "Merci d'entrer un numéro valide de carte bancaire."; var nv_equalTo = "Merci d'entrer la même valeur encore une fois."; var nv_accept = "Merci d'entrer une valeur avec extension valide."; var nv_maxlength = "Merci de ne pas entrer plus de {0} caractères."; var nv_minlength = "Merci d'entrer au minimum {0} caractères."; var nv_rangelength = "Merci d'entrer une valeur entre {0} et {1} caractères."; var nv_range = "Merci d'entrer une valeur entre {0} et {1}."; var nv_max = "Merci d'entrer une valeur moins ou égale à {0}."; var nv_min = "Merci d'entrer une valeur plus ou égal à {0}."; //contact var nv_fullname = "Nom complet entré n'est pas valide."; var nv_title = "Titre invalide."; var nv_content = "Contenu vide."; var nv_code = "Code de sécurité incorrect.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Chủ nhật','Thứ Hai','Thứ Ba','Thứ Tư','Thứ Năm','Thứ Sáu','Thứ Bảy'); var nv_aryDayNS = new Array('CN','Hai','Ba','Tư','Năm','Sáu','Bảy'); var nv_aryMonth = new Array('Tháng Một','Tháng Hai','Tháng Ba','Tháng Tư','Tháng Năm','Tháng Sáu','Tháng Bảy','Tháng Tám','Tháng Chín','Tháng Mười','Tháng Mười một','Tháng Mười hai'); var nv_aryMS = new Array('Tháng 1','Tháng 2','Tháng 3','Tháng 4','Tháng 5','Tháng 6','Tháng 7','Tháng 8','Tháng 9','Tháng 10','Tháng 11','Tháng 12'); var nv_admlogout_confirm = new Array('Bạn thực sự muốn thoát khỏi tài khoản Quản trị?','Toàn bộ thông tin đăng nhập đã được xóa. Bạn đã thoát khỏi tài khoản Quản trị'); var nv_is_del_confirm = new Array('Bạn thực sự muốn xóa? Nếu đồng ý, tất cả dữ liệu liên quan sẽ bị xóa. Bạn sẽ không thể phục hồi lại chúng sau này','Lệnh Xóa đã được thực hiện','Vì một lý do nào đó lệnh Xóa đã không được thực hiện'); var nv_is_change_act_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Thay đổi\'?','Lệnh \'Thay đổi\' đã được thực hiện','Vì một lý do nào đó lệnh \'Thay đổi\' đã không được thực hiện'); var nv_is_empty_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Làm rỗng\'?','Lệnh \'Làm rỗng\' đã được thực hiện','Vì một lý do nào đó lệnh \'Làm rỗng\' đã không được thực hiện'); var nv_is_recreate_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Cài lại\'?','Lệnh \'Cài lại\' đã được thực hiện','Vì một lý do nào đó lệnh \'Cài lại\' đã không được thực hiện'); var nv_is_add_user_confirm = new Array('Bạn thực sự muốn thêm thành viên này vào nhóm?','Lệnh \'Thêm vào nhóm\' đã được thực hiện','Vì một lý do nào đó lệnh \'Thêm vào nhóm\' đã không được thực hiện'); var nv_is_exclude_user_confirm = new Array('Bạn thực sự muốn loại thành viên này ra khỏi nhóm?','Lệnh \'Loại khỏi nhóm\' đã được thực hiện','Vì một lý do nào đó lệnh \'Loại khỏi nhóm\' đã không được thực hiện'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Chọn tháng hiện tại"; var nv_todayString = "Hôm nay"; var nv_weekShortString = "Tuần"; var nv_weekString = "Tuần"; var nv_scrollLeftMessage = "Click để di chuyển đến tháng trước. Giữ chuột để di chuyển tự động."; var nv_scrollRightMessage = "Click để di chuyển đến tháng sau. Giữ chuột để di chuyển tự động."; var nv_selectMonthMessage = "Click để chọn tháng."; var nv_selectYearMessage = "Click để chọn năm."; var nv_selectDateMessage = "Chọn ngày [date]."; var nv_loadingText = "Đang tải..."; var nv_loadingTitle = "Click để thôi"; var nv_focusTitle = "Click để xem tiếp"; var nv_fullExpandTitle = "Mở rộng kích thước thực tế (f)"; var nv_restoreTitle = "Click để đóng hình ảnh, Click và kéo để di chuyển. Sử dụng phím mũi tên Tiếp theo và Quay lại."; var nv_error_login = "Lỗi: Bạn chưa khai báo tài khoản hoặc khai báo không đúng. Tài khoản phải bao gồm những ký tự có trong bảng chữ cái latin, số và dấu gạch dưới. Số ký tự tối đa là [max], tối thiểu là [min]"; var nv_error_password = "Lỗi: Bạn chưa khai báo mật khẩu hoặc khai báo không đúng. Mật khẩu phải bao gồm những ký tự có trong bảng chữ cái latin, số và dấu gạch dưới. Số ký tự tối đa là [max], tối thiểu là [min]"; var nv_error_email = "Lỗi: Bạn chưa khai báo địa chỉ hộp thư điện tử hoặc khai báo không đúng quy định"; var nv_error_seccode = "Lỗi: Bạn chưa khai báo mã chống spam hoặc khai báo không đúng. Mã chống spam phải là một dãy số có chiều dài là [num] ký tự được thể hiện trong hình bên"; var nv_login_failed = "Lỗi: Vì một lý do nào đó, hệ thống không tiếp nhận tài khoản của bạn. Hãy thử khai báo lại lần nữa"; var nv_content_failed = "Lỗi: Vì một lý do nào đó, hệ thống không tiếp nhận thông tin của bạn. Hãy thử khai báo lại lần nữa"; var nv_required = "Trường này là bắt buộc."; var nv_remote = "Xin vui lòng sửa chữa trường này."; var nv_email = "Xin vui lòng nhập địa chỉ email hợp lệ."; var nv_url = "Xin vui lòng nhập URL hợp lệ."; var nv_date = "Xin vui lòng nhập ngày hợp lệ."; var nv_dateISO = "Xin vui lòng nhập ngày hợp lệ (ISO)."; var nv_dateDE = "Bitte geben Sie ein gültiges Datum ein."; var nv_number = "Xin vui lòng nhập số hợp lệ."; var nv_numberDE = "Bitte geben Sie eine Nummer ein."; var nv_digits = "Xin vui lòng nhập chỉ chữ số"; var nv_creditcard = "Xin vui lòng nhập số thẻ tín dụng hợp lệ."; var nv_equalTo = "Xin vui lòng nhập cùng một giá trị một lần nữa."; var nv_accept = "Xin vui lòng nhập giá trị có phần mở rộng hợp lệ."; var nv_maxlength = "Xin vui lòng nhập không quá {0} ký tự."; var nv_minlength = "Xin vui lòng nhập ít nhất {0} ký tự."; var nv_rangelength = "Xin vui lòng nhập một giá trị giữa {0} và {1} ký tự."; var nv_range = "Xin vui lòng nhập một giá trị giữa {0} và {1}."; var nv_max = "Xin vui lòng nhập một giá trị nhỏ hơn hoặc bằng {0}."; var nv_min = "Xin vui lòng nhập một giá trị lớn hơn hoặc bằng {0}."; //contact var nv_fullname = "Họ tên nhập không hợp lệ."; var nv_title = "Bạn chưa nhập tiêu đề."; var nv_content = "Nội dung không được để trống."; var nv_code = "Mã chống spam không đúng.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'); var nv_aryDayNS = nv_aryDayNS = new Array('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'); var nv_aryMonth = nv_aryMonth = new Array('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Decembre'); var nv_aryMS = new Array('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aout', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Êtes-vous sûr de vouloir quitter l\'Administration?','Toutes les informations de votre session ont été supprimées. Vous avez quitté l\'Administration'); var nv_is_del_confirm = new Array('Êtes-vous sûr de vouloir supprimer? Si vous acceptez, toutes les données seront supprimées, il est impossible de les restauter.','Suppression réussie','Suppression échouée'); var nv_is_change_act_confirm = new Array('Êtes-vous sûr de vouloir \'changer\'?',' \'Changement\' réussi',' \'Changement\' échoué'); var nv_is_empty_confirm = new Array('Êtes-vous sûr de vouloir \'vider\'?',' \'vider\' avec succès',' \'vider\' échoué pour une raison inconnue'); var nv_is_recreate_confirm = new Array('Êtes-vous sûr de vouloir \'ré-installer\'?',' \'Ré-installation\' réussie','\'Ré-installation\' échouée pour une raison inconnue'); var nv_is_add_user_confirm = new Array('Êtes-vous sûr de vouloir ajouter les nouveaux membres au groupe?','\'Ajout\' de nouveaux membres au groupe avec succcès',' \'Ajout \' échoué pour une raison inconnue'); var nv_is_exclude_user_confirm = new Array('Êtes-vous sûr de vouloir éliminer ce membre?','\'Élimination\' réussie',' \'Élimination\ échouée pour une raison inconnue'); var nv_formatString = "jj.mm.aaaa"; var nv_gotoString = "Aller au mois actuel"; var nv_todayString = "Aujourd'hui c'est"; var nv_weekShortString = "Semaine"; var nv_weekString = "par semaine"; var nv_scrollLeftMessage = "Cliquez pour aller au mois précédant. Enfoncez le bouton du souris pour enrouler automatiquement."; var nv_scrollRightMessage = "Cliquez pour aller au mois suivant. Enfoncez le bouton du souris pour enrouler automatiquement."; var nv_selectMonthMessage = "Cliquez pour sélectionner un mois."; var nv_selectYearMessage = "Cliquez pour sélectionner un an."; var nv_selectDateMessage = "Sélectionnez [date] comme date."; var nv_loadingText = "Chargement..."; var nv_loadingTitle = "Cliquez pour annuler"; var nv_focusTitle = "Cliquez pour mettre au premier plan"; var nv_fullExpandTitle = "Expandre à la taille réelle (f)"; var nv_restoreTitle = "Cliquez pour fermer l'image, Cliquez et glissez pour déplacer. Utilisez les flèches pour Précédente et Suivante."; var nv_error_login = "Erreur: Vous n'avez pas rempli votre compte ou les infos du compte sont incorrectes. Le compte se combine de lettres latines, de chiffres et tiret. Maximum [max], minimum [min] caractères."; var nv_error_password = "Erreur: Vous n'avez pas rempli le mot de passe ou le mot de passe n'est pas correct. Le mot de passe se combine de lettres latines, de chiffres et tiret. Maximum [max], minimum [min] caractères."; var nv_error_email = "Erreur: Vous n'avez pas entré votre e-mail ou l'e-mail n'est pas correct."; var nv_error_seccode = "Erreur: Vous n'avez pas entré le code de sécurité ou le code n'est pas correct. Code de sécurité est une série de [num] caractères affichées en image."; var nv_login_failed = "Erreur: Le système n'accepte pas votre compte. Essayez de nouveau."; var nv_content_failed = "Erreur: Le système n'accepte pas les infos. Essayez de nouveau."; var nv_required ="Ce champ est obligatoire."; var nv_remote = "Merci de corriger ce champ."; var nv_email = "Merci d'entrer un e-mail valide."; var nv_url = "Merci de donner un lien valide."; var nv_date = "Merci de donner une date valide."; var nv_dateISO = "Merci de donner une date valide (ISO)."; var nv_number = "Merci d'entrer un nombre valide."; var nv_digits = "Merci d'entrer uniquement les chiffres."; var nv_creditcard = "Merci d'entrer un numéro valide de carte bancaire."; var nv_equalTo = "Merci d'entrer la même valeur encore une fois."; var nv_accept = "Merci d'entrer une valeur avec extension valide."; var nv_maxlength = "Merci de ne pas entrer plus de {0} caractères."; var nv_minlength = "Merci d'entrer au minimum {0} caractères."; var nv_rangelength = "Merci d'entrer une valeur entre {0} et {1} caractères."; var nv_range = "Merci d'entrer une valeur entre {0} et {1}."; var nv_max = "Merci d'entrer une valeur moins ou égale à {0}."; var nv_min = "Merci d'entrer une valeur plus ou égal à {0}."; //contact var nv_fullname = "Nom complet entré n'est pas valide."; var nv_title = "Titre invalide."; var nv_content = "Contenu vide."; var nv_code = "Code de sécurité incorrect.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Chủ nhật','Thứ Hai','Thứ Ba','Thứ Tư','Thứ Năm','Thứ Sáu','Thứ Bảy'); var nv_aryDayNS = new Array('CN','Hai','Ba','Tư','Năm','Sáu','Bảy'); var nv_aryMonth = new Array('Tháng Một','Tháng Hai','Tháng Ba','Tháng Tư','Tháng Năm','Tháng Sáu','Tháng Bảy','Tháng Tám','Tháng Chín','Tháng Mười','Tháng Mười một','Tháng Mười hai'); var nv_aryMS = new Array('Tháng 1','Tháng 2','Tháng 3','Tháng 4','Tháng 5','Tháng 6','Tháng 7','Tháng 8','Tháng 9','Tháng 10','Tháng 11','Tháng 12'); var nv_admlogout_confirm = new Array('Bạn thực sự muốn thoát khỏi tài khoản Quản trị?','Toàn bộ thông tin đăng nhập đã được xóa. Bạn đã thoát khỏi tài khoản Quản trị'); var nv_is_del_confirm = new Array('Bạn thực sự muốn xóa? Nếu đồng ý, tất cả dữ liệu liên quan sẽ bị xóa. Bạn sẽ không thể phục hồi lại chúng sau này','Lệnh Xóa đã được thực hiện','Vì một lý do nào đó lệnh Xóa đã không được thực hiện'); var nv_is_change_act_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Thay đổi\'?','Lệnh \'Thay đổi\' đã được thực hiện','Vì một lý do nào đó lệnh \'Thay đổi\' đã không được thực hiện'); var nv_is_empty_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Làm rỗng\'?','Lệnh \'Làm rỗng\' đã được thực hiện','Vì một lý do nào đó lệnh \'Làm rỗng\' đã không được thực hiện'); var nv_is_recreate_confirm = new Array('Bạn thực sự muốn thực hiện lệnh \'Cài lại\'?','Lệnh \'Cài lại\' đã được thực hiện','Vì một lý do nào đó lệnh \'Cài lại\' đã không được thực hiện'); var nv_is_add_user_confirm = new Array('Bạn thực sự muốn thêm thành viên này vào nhóm?','Lệnh \'Thêm vào nhóm\' đã được thực hiện','Vì một lý do nào đó lệnh \'Thêm vào nhóm\' đã không được thực hiện'); var nv_is_exclude_user_confirm = new Array('Bạn thực sự muốn loại thành viên này ra khỏi nhóm?','Lệnh \'Loại khỏi nhóm\' đã được thực hiện','Vì một lý do nào đó lệnh \'Loại khỏi nhóm\' đã không được thực hiện'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Chọn tháng hiện tại"; var nv_todayString = "Hôm nay"; var nv_weekShortString = "Tuần"; var nv_weekString = "Tuần"; var nv_scrollLeftMessage = "Click để di chuyển đến tháng trước. Giữ chuột để di chuyển tự động."; var nv_scrollRightMessage = "Click để di chuyển đến tháng sau. Giữ chuột để di chuyển tự động."; var nv_selectMonthMessage = "Click để chọn tháng."; var nv_selectYearMessage = "Click để chọn năm."; var nv_selectDateMessage = "Chọn ngày [date]."; var nv_loadingText = "Đang tải..."; var nv_loadingTitle = "Click để thôi"; var nv_focusTitle = "Click để xem tiếp"; var nv_fullExpandTitle = "Mở rộng kích thước thực tế (f)"; var nv_restoreTitle = "Click để đóng hình ảnh, Click và kéo để di chuyển. Sử dụng phím mũi tên Tiếp theo và Quay lại."; var nv_error_login = "Lỗi: Bạn chưa khai báo tài khoản hoặc khai báo không đúng. Tài khoản phải bao gồm những ký tự có trong bảng chữ cái latin, số và dấu gạch dưới. Số ký tự tối đa là [max], tối thiểu là [min]"; var nv_error_password = "Lỗi: Bạn chưa khai báo mật khẩu hoặc khai báo không đúng. Mật khẩu phải bao gồm những ký tự có trong bảng chữ cái latin, số và dấu gạch dưới. Số ký tự tối đa là [max], tối thiểu là [min]"; var nv_error_email = "Lỗi: Bạn chưa khai báo địa chỉ hộp thư điện tử hoặc khai báo không đúng quy định"; var nv_error_seccode = "Lỗi: Bạn chưa khai báo mã chống spam hoặc khai báo không đúng. Mã chống spam phải là một dãy số có chiều dài là [num] ký tự được thể hiện trong hình bên"; var nv_login_failed = "Lỗi: Vì một lý do nào đó, hệ thống không tiếp nhận tài khoản của bạn. Hãy thử khai báo lại lần nữa"; var nv_content_failed = "Lỗi: Vì một lý do nào đó, hệ thống không tiếp nhận thông tin của bạn. Hãy thử khai báo lại lần nữa"; var nv_required = "Trường này là bắt buộc."; var nv_remote = "Xin vui lòng sửa chữa trường này."; var nv_email = "Xin vui lòng nhập địa chỉ email hợp lệ."; var nv_url = "Xin vui lòng nhập URL hợp lệ."; var nv_date = "Xin vui lòng nhập ngày hợp lệ."; var nv_dateISO = "Xin vui lòng nhập ngày hợp lệ (ISO)."; var nv_dateDE = "Bitte geben Sie ein gültiges Datum ein."; var nv_number = "Xin vui lòng nhập số hợp lệ."; var nv_numberDE = "Bitte geben Sie eine Nummer ein."; var nv_digits = "Xin vui lòng nhập chỉ chữ số"; var nv_creditcard = "Xin vui lòng nhập số thẻ tín dụng hợp lệ."; var nv_equalTo = "Xin vui lòng nhập cùng một giá trị một lần nữa."; var nv_accept = "Xin vui lòng nhập giá trị có phần mở rộng hợp lệ."; var nv_maxlength = "Xin vui lòng nhập không quá {0} ký tự."; var nv_minlength = "Xin vui lòng nhập ít nhất {0} ký tự."; var nv_rangelength = "Xin vui lòng nhập một giá trị giữa {0} và {1} ký tự."; var nv_range = "Xin vui lòng nhập một giá trị giữa {0} và {1}."; var nv_max = "Xin vui lòng nhập một giá trị nhỏ hơn hoặc bằng {0}."; var nv_min = "Xin vui lòng nhập một giá trị lớn hơn hoặc bằng {0}."; //contact var nv_fullname = "Họ tên nhập không hợp lệ."; var nv_title = "Bạn chưa nhập tiêu đề."; var nv_content = "Nội dung không được để trống."; var nv_code = "Mã chống spam không đúng.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Воскресник','Понедельник','Вторник','Среда','Четверг','Пятница','Суббота'); var nv_aryDayNS = new Array('ВС','ПН','ВТ','СР','ЧТ','ПТ','СБ'); var nv_aryMonth = new Array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'); var nv_aryMS = new Array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'); var nv_admlogout_confirm = new Array('Вы действительно хотите выход из Администрации?','Все информации были удалены. Вы выходите из администрации'); var nv_is_del_confirm = new Array('Вы действительно хотите удалить? Если вы согласите, все данные будут удалиться. Вы не можете восстановить ','Успешно','Не может удалть'); var nv_is_change_act_confirm = new Array('Вы действительно хотите \'Изменить\'?','Успешно!','Не может изменить'); var nv_is_empty_confirm = new Array('Вы действительно хотите \'опустеть\'?','Успешно!','Не может опустеть'); var nv_is_recreate_confirm = new Array('Вы действительно хотите \'восстанавливать\'?','Успешно!','Не может восстанавливать'); var nv_is_add_user_confirm = new Array('Вы действительно хотите добавить новой пользователя в группу?','Успешно!','Не может добавить'); var nv_is_exclude_user_confirm = new Array('Вы действительно хотите удалить пользователя из группы?','Успешно!','Не может удалить'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Перейти на текущий месяц"; var nv_todayString = "Сегодня"; var nv_weekShortString = "Неделя"; var nv_weekString = "Неделя"; var nv_scrollLeftMessage = "Нажмите, чтобы перейти к предыдущему месяцу. Держите мышь, чтобы авто переместить."; var nv_scrollRightMessage = "Нажмите, чтобы перейти к следующему месяцу. Держите мышь, чтобы авто переместить."; var nv_selectMonthMessage = "Выберите месяц."; var nv_selectYearMessage = "Выберите год."; var nv_selectDateMessage = "Выберите дату [date]."; var nv_loadingText = "Загрузка..."; var nv_loadingTitle = "Нажмите, чтобы отменить"; var nv_focusTitle = "Нажмите, чтобы продолжать"; var nv_fullExpandTitle = "Фактический размер (f)"; var nv_restoreTitle = "Нажмите, чтобы закрыть изображение и с помощью мыши переместите. Используйте стрелки Вперед и назад."; var nv_error_login = "Ошибка: Код безопасности не был объявлен или признан недействительным. (Только букв латинского алфавита , цифры и знак подчеркивания . Минимально [max] символов, максимально [min] символов)"; var nv_error_password = "Ошибка: Пароль пользователя не был объявлен или признан недействительным. (Только букв латинского алфавита , цифры и знак подчеркивания . Минимально [max] символов, максимально [min] символов)"; var nv_error_email = "Ошибка: Адрес Email не был объявлен или признан недействительным"; var nv_error_seccode = "Ошибка: Код безопасности не был объявлен или признан недействительным. "; var nv_login_failed = "Ошибка: По некоторым причинам, система не принимает ваш аккунт."; var nv_content_failed = "Ошибка: По некоторым причинам, система не принимает ваш аккунт."; var nv_required = "Это поле является обязательным."; var nv_remote = "Пожалуйста, исправьте это поле."; var nv_email = "Пожалуйста, введите адрес Email."; var nv_url = "Пожалуйста, введите URL."; var nv_date = "Пожалуйста, введите дату."; var nv_dateISO = "Пожалуйста, введите дату (ISO)."; var nv_number = "Пожалуйста, введите действительный номер."; var nv_digits = "Пожалуйста, введите только цифры"; var nv_creditcard = "Пожалуйста, введите действительный номер кредитной карты."; var nv_equalTo = "Пожалуйста, введите такое значение снова."; var nv_accept = "Пожалуйста, введите значение с действительным расширением."; var nv_maxlength = "Пожалуйста, введите не более {0} символов."; var nv_minlength = "Пожалуйста, введите более {0} символов."; var nv_rangelength = "Пожалуйста, введите значение в диапазоне от {0} до {1} символов."; var nv_range = "Пожалуйста, введите значение в диапазоне от {0} до {1} ."; var nv_max = "Пожалуйста, введите значение меньше или равно {0}."; var nv_min = "Пожалуйста, введите значение больше или равно {0}."; //contact var nv_fullname = "Недействительные ФИО."; var nv_title = "Недействительное название."; var nv_content = "Содержание обязательно не является пустым."; var nv_code = "Недействительный код безопасности.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES., JSC. All rights reserved * @Createdate 3-13-2010 15:24 */ var nv_aryDayName = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); var nv_aryDayNS = nv_aryDayNS = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); var nv_aryMonth = nv_aryMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); var nv_aryMS = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var nv_admlogout_confirm = new Array('Are you sure to logout from administrator account?','The entire login information has been deleted. You have been logout Administrator account successfully'); var nv_is_del_confirm = new Array('Are you sure to delete? If you accept,all data will be deleted. You could not restore them','Delete succesfully','Delete data faile for some unknown reason'); var nv_is_change_act_confirm = new Array('Are you sure to \'change\'?','Be \'Change\' successfully',' \'Change\' fail'); var nv_is_empty_confirm = new Array('Are you sure to be \'empty\'?','Be \'empty\' succesful','Be \'empty\' fail for some unknown reason'); var nv_is_recreate_confirm = new Array('Are you sure to \'repair\'?','Be \'Repair\' succesfully','\'Repair\' fail for some unknown reason'); var nv_is_add_user_confirm = new Array('Are you sure to add new member into group?','\'Add\' new member into group successfully',' \'Add \' fail for some unknown reason'); var nv_is_exclude_user_confirm = new Array('Are you sure to exclude this member?','\'Exclude\' member successfully',' \'Exclude\ member fail for some unknown reason'); var nv_formatString = "dd.mm.yyyy"; var nv_gotoString = "Go To Current Month"; var nv_todayString = "Today is"; var nv_weekShortString = "Wk"; var nv_weekString = "calendar week"; var nv_scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."; var nv_scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."; var nv_selectMonthMessage = "Click to select a month."; var nv_selectYearMessage = "Click to select a year."; var nv_selectDateMessage = "Select [date] as date."; var nv_loadingText = "Loading..."; var nv_loadingTitle = "Click to cancel"; var nv_focusTitle = "Click to bring to front"; var nv_fullExpandTitle = "Expand to actual size (f)"; var nv_restoreTitle = "Click to close image, click and drag to move. Use arrow keys for next and previous."; var nv_error_login = "Error: You haven't fill your account or account information incorrect. Account include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_password = "Error: You haven't fill your password or password information incorrect. Password include Latin characters, numbers, underscore. Max characters is [max], min characters is [min]"; var nv_error_email = "Error: You haven't fill your email address or email address incorrect."; var nv_error_seccode = "Error: You haven't fill anti spam secure code or anti spam secure code you fill incorrect. Anti spam secure code is a sequense of number [num] characters display in image."; var nv_login_failed = "Error: For some reasons, system doesn't accept your account. Try again."; var nv_content_failed = "Error: For some reasons, system doesn't accept content Try again."; var nv_required ="This field is required."; var nv_remote = "Please fix this field."; var nv_email = "Please enter a valid email address."; var nv_url = "Please enter a valid URL."; var nv_date = "Please enter a valid date."; var nv_dateISO = "Please enter a valid date (ISO)."; var nv_number = "Please enter a valid number."; var nv_digits = "Please enter only digits."; var nv_creditcard = "Please enter a valid credit card number."; var nv_equalTo = "Please enter the same value again."; var nv_accept = "Please enter a value with a valid extension."; var nv_maxlength = "Please enter no more than {0} characters."; var nv_minlength = "Please enter at least {0} characters."; var nv_rangelength = "Please enter a value between {0} and {1} characters long."; var nv_range = "Please enter a value between {0} and {1}."; var nv_max = "Please enter a value less than or equal to {0}."; var nv_min = "Please enter a value greater than or equal to {0}."; //contact var nv_fullname = "Full name entered is not valid."; var nv_title = "Title not valid."; var nv_content = "The content is not empty."; var nv_code = "Capcha not valid.";
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @copyright 2009 * @createdate 19/3/2010 22:58 */ var seccodecheck = /^([a-zA-Z0-9])+$/; if (typeof (jsi) == 'undefined') var jsi = new Array(); if (!jsi[0]) jsi[0] = 'vi'; if (!jsi[1]) jsi[1] = './'; if (!jsi[2]) jsi[2] = 0; if (!jsi[3]) jsi[3] = 6; var strHref = window.location.href; if (strHref.indexOf("?") > -1) { var strHref_split = strHref.split("?"); var script_name = strHref_split[0]; var query_string = strHref_split[1]; } else { var script_name = strHref; var query_string = ''; } // --------------------------------------- function nv_checkadminlogin_seccode(seccode) { return (seccode.value.length == jsi[3] && seccodecheck.test(seccode.value)) ? true : false; } // --------------------------------------- function nv_randomPassword(plength) { var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; var pass = ""; for ( var z = 0; z < plength; z++) { pass += chars.charAt(Math.floor(Math.random() * 62)); } return pass; } // --------------------------------------- function nv_checkadminlogin_submit() { if (jsi[2] == 1) { var seccode = document.getElementById('seccode'); if (!nv_checkadminlogin_seccode(seccode)) { alert(login_error_security); seccode.focus(); return false; } } var login = document.getElementById('login'); var password = document.getElementById('password'); if (login.value!='' && password.value!=''){ return true; } else{ return false; } } // --------------------------------------- function nv_change_captcha() { var vimg = document.getElementById('vimg'); nocache = nv_randomPassword(10); vimg.src = jsi[1] + 'index.php?scaptcha=captcha&nocache=' + nocache; document.getElementById('seccode').value = ''; return false; }
JavaScript
/* * Metadata - jQuery plugin for parsing metadata from elements * * Copyright (c) 2006 John Resig, Yehuda Katz, J�rn Zaefferer, Paul McLanahan * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: $Id$ * */ /** * Sets the type of metadata to use. Metadata is encoded in JSON, and each property * in the JSON will become a property of the element itself. * * There are three supported types of metadata storage: * * attr: Inside an attribute. The name parameter indicates *which* attribute. * * class: Inside the class attribute, wrapped in curly braces: { } * * elem: Inside a child element (e.g. a script tag). The * name parameter indicates *which* element. * * The metadata for an element is loaded the first time the element is accessed via jQuery. * * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements * matched by expr, then redefine the metadata type and run another $(expr) for other elements. * * @name $.metadata.setType * * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p> * @before $.metadata.setType("class") * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" * @desc Reads metadata from the class attribute * * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p> * @before $.metadata.setType("attr", "data") * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" * @desc Reads metadata from a "data" attribute * * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p> * @before $.metadata.setType("elem", "script") * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" * @desc Reads metadata from a nested script element * * @param String type The encoding type * @param String name The name of the attribute to be used to get metadata (optional) * @cat Plugins/Metadata * @descr Sets the type of encoding to be used when loading metadata for the first time * @type undefined * @see metadata() */ (function($) { $.extend({ metadata : { defaults : { type: 'class', name: 'metadata', cre: /({.*})/, single: 'metadata' }, setType: function( type, name ){ this.defaults.type = type; this.defaults.name = name; }, get: function( elem, opts ){ var settings = $.extend({},this.defaults,opts); // check for empty string in single property if ( !settings.single.length ) settings.single = 'metadata'; var data = $.data(elem, settings.single); // returned cached data if it already exists if ( data ) return data; data = "{}"; if ( settings.type == "class" ) { var m = settings.cre.exec( elem.className ); if ( m ) data = m[1]; } else if ( settings.type == "elem" ) { if( !elem.getElementsByTagName ) return; var e = elem.getElementsByTagName(settings.name); if ( e.length ) data = $.trim(e[0].innerHTML); } else if ( elem.getAttribute != undefined ) { var attr = elem.getAttribute( settings.name ); if ( attr ) data = attr; } if ( data.indexOf( '{' ) <0 ) data = "{" + data + "}"; data = eval("(" + data + ")"); $.data( elem, settings.single, data ); return data; } } }); /** * Returns the metadata object for the first member of the jQuery object. * * @name metadata * @descr Returns element's metadata object * @param Object opts An object contianing settings to override the defaults * @type jQuery * @cat Plugins/Metadata */ $.fn.metadata = function( opts ){ return $.metadata.get( this[0], opts ); }; })(jQuery);
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 31/05/2010, 9:36 */ function nv_admin_add_result(form_id, go, tp){ var formid = document.getElementById(form_id); var input_go = document.getElementById(go); input_go.value = (tp == 2) ? "sendmail" : "savefile"; formid.submit(); return false; } function nv_admin_edit_result(form_id, go, tp){ var formid = document.getElementById(form_id); var input_go = document.getElementById(go); input_go.value = (tp == 2) ? "sendmail" : "savefile"; formid.submit(); return false; }
JavaScript
/* * ContextMenu - jQuery plugin for right-click context menus * * Author: Chris Domigan * Contributors: Dan G. Switzer, II * Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Version: r2 * Date: 16 July 2007 * * For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/ * */ (function($) { var menu, shadow, trigger, content, hash, currentTarget; var defaults = { menuStyle: { listStyle: 'none', padding: '1px', margin: '0px', backgroundColor: '#fff', border: '1px solid #999', width: '100px' }, itemStyle: { margin: '0px', color: '#000', display: 'block', cursor: 'default', padding: '3px', border: '1px solid #fff', backgroundColor: 'transparent' }, itemHoverStyle: { border: '1px solid #0a246a', backgroundColor: '#b6bdd2' }, eventPosX: 'pageX', eventPosY: 'pageY', shadow : true, onContextMenu: null, onShowMenu: null }; $.fn.contextMenu = function(id, options) { if (!menu) { // Create singleton menu menu = $('<div id="jqContextMenu"></div>') .hide() .css({position:'absolute', zIndex:'500'}) .appendTo('body') .bind('click', function(e) { e.stopPropagation(); }); } if (!shadow) { shadow = $('<div></div>') .css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499}) .appendTo('body') .hide(); } hash = hash || []; hash.push({ id : id, menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}), itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}), itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}), bindings: options.bindings || {}, shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow, onContextMenu: options.onContextMenu || defaults.onContextMenu, onShowMenu: options.onShowMenu || defaults.onShowMenu, eventPosX: options.eventPosX || defaults.eventPosX, eventPosY: options.eventPosY || defaults.eventPosY }); var index = hash.length - 1; $(this).bind('contextmenu', function(e) { // Check if onContextMenu() defined var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true; if (bShowContext) display(index, this, e, options); return false; }); return this; }; function display(index, trigger, e, options) { var cur = hash[index]; content = $('#'+cur.id).find('ul:first').clone(true); content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover( function() { $(this).css(cur.itemHoverStyle); }, function(){ $(this).css(cur.itemStyle); } ).find('img').css({verticalAlign:'middle',paddingRight:'2px'}); // Send the content to the menu menu.html(content); // if there's an onShowMenu, run it now -- must run after content has been added // if you try to alter the content variable before the menu.html(), IE6 has issues // updating the content if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu); $.each(cur.bindings, function(id, func) { $('#'+id, menu).bind('click', function(e) { hide(); func(trigger, currentTarget); }); }); menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show(); if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show(); $(document).one('click', hide); } function hide() { menu.hide(); shadow.hide(); } // Apply defaults $.contextMenu = { defaults : function(userDefaults) { $.each(userDefaults, function(i, val) { if (typeof val == 'object' && defaults[i]) { $.extend(defaults[i], val); } else defaults[i] = val; }); } }; })(jQuery); $(function() { $('div.contextMenu').hide(); });
JavaScript
if( typeof( nv_siteroot ) == 'undefined' ) { var nv_siteroot = '/'; } // ----------------------- if( typeof( nv_sitelang ) == 'undefined' ) { var nv_sitelang = 'en'; } // ----------------------- if( typeof( nv_name_variable ) == 'undefined' ) { var nv_name_variable = 'nv'; } // ----------------------- if( typeof( nv_fc_variable ) == 'undefined' ) { var nv_fc_variable = 'fc'; } // ----------------------- if( typeof( nv_lang_variable ) == 'undefined' ) { var nv_lang_variable = 'lang'; } // ----------------------- if( typeof( nv_module_name ) == 'undefined' ) { var nv_module_name = ''; } if( typeof( nv_area_admin ) == 'undefined' ) { var nv_area_admin = 0; } // ----------------------- if( typeof( nv_my_ofs ) == 'undefined' ) { var nv_my_ofs = 7; } // ----------------------- if( typeof( nv_my_dst ) == 'undefined' ) { var nv_my_dst = false; } // ----------------------- if( typeof( nv_my_abbr ) == 'undefined' ) { var nv_my_abbr = 'ICT'; } // ----------------------- if( typeof( nv_cookie_prefix ) == 'undefined' ) { var nv_cookie_prefix = 'nv3'; } // --------------------------------------- var OP = ( navigator.userAgent.indexOf( 'Opera' ) != - 1 ); var IE = ( navigator.userAgent.indexOf( 'MSIE' ) != - 1 && ! OP ); var GK = ( navigator.userAgent.indexOf( 'Gecko' ) != - 1 ); var SA = ( navigator.userAgent.indexOf( 'Safari' ) != - 1 ); var DOM = document.getElementById; var NS4 = document.layers; var nv_mailfilter = /^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$/; var nv_numcheck = /^([0-9])+$/; var nv_namecheck = /^([a-zA-Z0-9_-])+$/; var nv_md5check = /^[a-z0-9]{32}$/; var nv_imgexts = /^.+\.(jpg|gif|png|bmp)$/; var nv_iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?"; var nv_specialchars = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g var nv_old_Minute = - 1; var strHref = window.location.href; if( strHref.indexOf( "?" ) > - 1 ) { var strHref_split = strHref.split( "?" ); var script_name = strHref_split[0]; var query_string = strHref_split[1]; } // ----------------------- else { var script_name = strHref; var query_string = ''; } // ----------------------- function nv_email_check( field_id ) { return ( field_id.value.length >= 7 && nv_mailfilter.test( field_id.value ) ) ? true : false; } // ----------------------- function nv_num_check( field_id ) { return ( field_id.value.length >= 1 && nv_numcheck.test( field_id.value ) ) ? true : false; } // ----------------------- function nv_name_check(field_id) { return ( field_id.value != '' && nv_namecheck.test( field_id.value ) ) ? true : false; } // ----------------------- function nv_md5_check(field_id) { return ( nv_md5check.test( field_id.value ) ) ? true : false; } // ----------------------- function nv_iChars_check(field_id) { for (var i = 0; i < field_id.value.length; i ++ ) { if (nv_iChars.indexOf(field_id.value.charAt(i)) != - 1) { return true; } } return false; } // ----------------------- function nv_iChars_Remove(str) { return str.replace(nv_specialchars, ""); } // ----------------------- function formatStringAsUriComponent( s ) { // replace html with whitespace s = s.replace( /<\/?[^>]*>/gm, " " ); // remove entities s = s.replace( /&[\w]+;/g, "" ); // remove 'punctuation' s = s.replace ( /[\.\,\"\'\?\!\;\:\#\$\%\&\(\)\*\+\-\/\<\>\=\@\[\]\\^\_\{\}\|\~]/g, ""); // replace multiple whitespace with single whitespace s = s.replace( /\s{2,}/g, " " ); // trim whitespace at start and end of title s = s.replace( /^\s+|\s+$/g, "" ); return s; } // ----------------------- function nv_setCookie(name, value, expiredays) { if (expiredays) { var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays); var expires = exdate.toGMTString(); } var is_url = /^([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$/; var domainName = document.domain; domainName = domainName.replace(/www\./g,''); domainName = is_url.test( domainName ) ? '.' + domainName : ''; document.cookie = name + "=" + escape(value) + ((expiredays) ? "; expires=" + expires : "") + ((domainName) ? "; domain=" + domainName : "") + "; path=" + nv_siteroot; } // ----------------------- function nv_getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != - 1) { offset += search.length; end = cookie.indexOf(";", offset) if (end == - 1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return setStr; } // ----------------------- function nv_check_timezone() { var is_url = /^([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$/; var domainName = document.domain; domainName = domainName.replace(/www\./g,''); domainName = is_url.test( domainName ) ? '.' + domainName : ''; var cookie_timezone = nv_getCookie( nv_cookie_prefix + '_cltz' ); var giohientai = new Date(); var giomuahe = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0)); var giomuadong = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0)); var new_value = -giomuahe.getTimezoneOffset() + '.' + -giomuadong.getTimezoneOffset() + '.' + -giohientai.getTimezoneOffset(); new_value += '|' + nv_siteroot; new_value += '|' + domainName; if( rawurldecode(cookie_timezone) != new_value) { nv_setCookie( nv_cookie_prefix + '_cltz', rawurlencode(new_value), 365 ); //Khong biet bac nao viet them vao cho nay ma vo ly qua. Xin loi xoa nhe! //cookie_timezone = nv_getCookie( nv_cookie_prefix + '_cltz' ); /*if( rawurldecode(cookie_timezone) == new_value){ window.location.href = strHref; }*/ } } // ----------------------- function is_array( mixed_var ) { return ( mixed_var instanceof Array ); } // ----------------------- // strip_tags('<p>Kevin</p> <b>van</b> <i>Zonneveld</i>', '<i><b>'); function strip_tags (str, allowed_tags) { var key = '', allowed = false; var matches = []; var allowed_array = []; var allowed_tag = ''; var i = 0; var k = ''; var html = ''; var replacer = function (search, replace, str) { return str.split(search).join(replace); } ; // Build allowes tags associative array if (allowed_tags) { allowed_array = allowed_tags.match(/([a-zA-Z0-9]+)/gi); } str += ''; // Match tags matches = str.match(/(<\/?[\S][^>]*>)/gi); // Go through all HTML tags for (key in matches) { if (isNaN(key)) { // IE7 Hack continue; } // Save HTML tag html = matches[key].toString(); // Is tag not in allowed list ? Remove from str ! allowed = false; // Go through all allowed tags for (k in allowed_array) { // Init allowed_tag = allowed_array[k]; i = - 1; if (i != 0) { i = html.toLowerCase().indexOf('<' + allowed_tag + '>'); } if (i != 0) { i = html.toLowerCase().indexOf('<' + allowed_tag + ' '); } if (i != 0) { i = html.toLowerCase().indexOf('</' + allowed_tag) ; } // Determine if (i == 0) { allowed = true; break; } } if ( ! allowed) { str = replacer(html, "", str); // Custom replace. No regexing } } return str; } // ----------------------- // trim(' Kevin van Zonneveld '); function trim (str, charlist) { var whitespace, l = 0, i = 0; str += ''; if ( ! charlist) { whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000"; } else { charlist += ''; whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1'); } l = str.length; for (i = 0; i < l; i ++ ) { if (whitespace.indexOf(str.charAt(i)) === - 1) { str = str.substring(i); break; } } l = str.length; for (i = l - 1; i >= 0; i -- ) { if (whitespace.indexOf(str.charAt(i)) === - 1) { str = str.substring(0, i + 1); break; } } return whitespace.indexOf(str.charAt(0)) === - 1 ? str : ''; } // ----------------------- // rawurlencode('Kevin van Zonneveld!'); = > 'Kevin%20van%20Zonneveld%21' function rawurlencode (str) { str = (str + '').toString(); return encodeURIComponent( str ).replace( /!/g, '%21' ).replace( /'/g, '%27').replace(/\(/g, '%5B').replace(/\)/g, '%5D').replace(/\*/g, '%2A'); } // ----------------------- // rawurldecode('Kevin+van+Zonneveld%21'); = > 'Kevin+van+Zonneveld!' function rawurldecode (str) { return decodeURIComponent(str); } // ----------------------- function is_numeric( mixed_var ) { return ! isNaN( mixed_var ); } // ----------------------- function intval (mixed_var, base) { var type = typeof( mixed_var ); if (type === 'boolean') { return (mixed_var) ? 1 : 0; } else if (type === 'string') { tmp = parseInt(mixed_var, base || 10); return (isNaN(tmp) || ! isFinite(tmp)) ? 0 : tmp; } else if (type === 'number' && isFinite(mixed_var) ) { return Math.floor(mixed_var); } else { return 0; } } // ----------------------- function AJAX() { this.http_request = false; this.mimetype = 'text/html'; this.callback = false; this.containerid = false; this.rmethod = 'POST'; this.response = 'text'; this.request = function( request_method, request_url, request_query, containerid, callback ) { if ( typeof( XMLHttpRequest ) != 'undefined' ) { this.http_request = new XMLHttpRequest(); } else if( window.ActiveXObject ) { try { this.http_request = new ActiveXObject( "Msxml2.XMLHTTP" ); } catch ( e ) { try { this.http_request = new ActiveXObject( "Microsoft.XMLHTTP" ); } catch ( e ) { } } } if( ! this.http_request || ! request_url ) return; if( request_method.toLowerCase() == 'get' ) { this.rmethod = 'GET'; if( request_query ) { request_url += ( request_url.indexOf( "?" ) + 1 ) ? "&" : "?"; request_url += request_query; } } request_url += ( request_url.indexOf( "?" ) + 1 ) ? "&" : "?"; request_url += 'nocache=' + new Date().getTime(); if ( typeof( containerid ) != 'undefined' ) this.containerid = containerid; if ( typeof( callback ) != 'undefined' ) this.callback = callback; if ( this.http_request.overrideMimeType ) this.http_request.overrideMimeType( this.mimetype ); var ths = this; this.http_request.onreadystatechange = function() { if( ! ths ) return; switch( ths.http_request.readyState ) { case 1 : case 2 : case 3 : // if( ths.containerid && ! ths.callback ) // document.getElementById( ths.containerid ).innerHTML = "<div // style=\"text - align : center; \"><img alt=\"Loading...\" // src=\"" + nv_siteroot + "images / load.gif\" width=\"16\" // height=\"16\" /></div>"; break; case 4 : if( ths.http_request.status == 200 ) { if( ths.response == 'xml' && ths.http_request.responseXML ) { ths.result = ths.http_request.responseXML; } else if( ths.response == 'text' && ths.http_request.responseText ) { ths.result = ths.http_request.responseText; } if(typeof( ths.result ) == 'undefined') { ths.result = ""; } if( ! ths.callback ) { if( ths.containerid ) { document.getElementById( ths.containerid ).innerHTML = ths.result; } } else { if(ths.result) { ths.result = ths.result.replace( /[\n\r]/g, '' ); } eval( ths.callback + '(\'' + ths.result + '\');' ); } } else { if( ths.containerid && ! ths.callback ) document.getElementById( ths.containerid ).innerHTML = 'There was a problem with the request.'; } break; } } this.http_request.open( this.rmethod, request_url, true ); if( this.rmethod == 'GET' ) { this.http_request.send( null ); } else { this.http_request.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); this.http_request.setRequestHeader( "Content-length", request_query.length ); this.http_request.setRequestHeader( "Connection", "close" ); this.http_request.send( request_query ); } } } // ----------------------- function nv_get_element_value( formElement ) { if( formElement.length != null ) var type = formElement[0].type; if( ( typeof( type ) == 'undefined' ) || ( type == 0 ) ) var type = formElement.type; var val = ''; switch( type ) { case 'undefined' : break; case 'radio' : if( formElement.checked ) { val = formElement.value; } break; case 'select-multiple' : var myArray = new Array(); for( var x = 0; x < formElement.length; x ++ ) { if( formElement[x].selected == true ) { myArray[myArray.length] = formElement[x].value; } } val = myArray; break; case 'checkbox' : val = formElement.checked; break; default : val = formElement.value; } return val; } // ----------------------- function nv_ajax( request_method, request_url, request_query, containerid, callback ) { object = new AJAX(); object.request( request_method, request_url, request_query, containerid, callback ); } // ----------------------- function nv_form_send( form, containerid, callback ) { var query = ""; var z = 0; for( var i = 0; i < form.elements.length; i ++ ) { var pkey = form.elements[i].name; var pvalue = nv_get_element_value( form.elements[i] ); if( pkey && pvalue ) { z ++ ; if( z > 1 ) { query += "&"; } if( form.method.toLowerCase() == 'get' ) { pkey = encodeURIComponent( pkey ); pvalue = encodeURIComponent( pvalue ); } query += pkey + "=" + pvalue; } } nv_ajax( form.method, form.action, query, containerid, callback ); } // ----------------------- function nv_is_dst() { var now = new Date(); var dst_start = new Date(); var dst_end = new Date(); // Set dst start to 2AM 2nd Sunday of March dst_start.setMonth( 2 ); // March dst_start.setDate( 1 ); // 1st dst_start.setHours( 2 ); dst_start.setMinutes( 0 ); dst_start.setSeconds( 0 ); // 2AM // Need to be on first Sunday if( dst_start.getDay() ) dst_start.setDate( dst_start.getDate() + ( 7 - dst_start.getDay() ) ); // Set to second Sunday dst_start.setDate( dst_start.getDate() + 7 ); // Set dst end to 2AM 1st Sunday of November dst_end.setMonth( 10 ); dst_end.setDate( 1 ); dst_end.setHours( 2 ); dst_end.setMinutes( 0 ); dst_end.setSeconds( 0 ); // 2AM // Need to be on first Sunday if( dst_end.getDay() ) dst_end.setDate( dst_end.getDate() + ( 7 - dst_end.getDay() ) ); return ( now > dst_start && now < dst_end ) } // ----------------------- function nv_DigitalClock( div_id ) { if( document.getElementById( div_id ) ) { if( nv_my_dst ) { var test_dst = nv_is_dst(); if( test_dst ) nv_my_ofs += 1; } var newDate = new Date(); var ofs = newDate.getTimezoneOffset() / 60; newDate.setHours( newDate.getHours() + ofs + nv_my_ofs ); var intMinutes = newDate.getMinutes(); var intSeconds = newDate.getSeconds(); if( intMinutes != nv_old_Minute ) { nv_old_Minute = intMinutes; var intDay = newDate.getDay(); var intMonth = newDate.getMonth(); var intWeekday = newDate.getDate(); var intYear = newDate.getYear(); var intHours = newDate.getHours(); if ( intYear < 200 ) intYear = intYear + 1900; var strDayName = new String( nv_aryDayName[intDay] ); var strDayNameShort = new String( nv_aryDayNS[intDay] ); var strMonthName = new String( nv_aryMonth[intMonth] ); var strMonthNameShort = new String( nv_aryMS[intMonth] ); var strMonthNumber = intMonth + 1; var strYear = new String( intYear ); var strYearShort = strYear.substring( 2, 4 ); if ( intHours <= 9 ) intHours = '0' + intHours; if ( intMinutes <= 9 ) intMinutes = '0' + intMinutes; // if ( intSeconds <= 9 ) intSeconds = '0' + intSeconds; if ( intWeekday <= 9 ) intWeekday = '0' + intWeekday; if ( strMonthNumber <= 9 ) strMonthNumber = '0' + strMonthNumber; var strClock = ''; // strClock = intHours + ':' + intMinutes + ':' + intSeconds + ' ' + // GMT // + ' &nbsp; ' + strDayName + ', ' + intWeekday + '/' + // strMonthNumber // + '/' + intYear; strClock = intHours + ':' + intMinutes + ' ' + nv_my_abbr + ' &nbsp; ' + strDayName + ', ' + intWeekday + '/' + strMonthNumber + '/' + intYear; var spnClock = document.getElementById( div_id ); spnClock.innerHTML = strClock; } setTimeout( 'nv_DigitalClock("'+div_id+'")', ( 60 - intSeconds ) * 1000 ); } } // ----------------------- function nv_search_submit(search_query, topmenu_search_checkss, search_button, minlength, maxlength) { var query = document.getElementById(search_query); var format_query = formatStringAsUriComponent(query.value); var allowed = ( format_query != '' && format_query.length >= minlength && format_query.length <= maxlength) ? true : false; if( ! allowed) { query.value = format_query; messalert = nv_rangelength.replace('{0}', minlength); messalert = messalert.replace('{1}', maxlength); alert(messalert); } else { var sbutton = document.getElementById(search_button); sbutton.disabled = true; var search_checkss = document.getElementById(topmenu_search_checkss).value; window.location.href = nv_siteroot + 'index.php?' + nv_lang_variable+'='+nv_sitelang+'&'+nv_name_variable + '=search&q=' + rawurlencode(format_query) + '&search_checkss=' + search_checkss; } return false; } // ----------------------- function nv_show_hidden(div_id, st) { var divid = document.getElementById(div_id); if(st == 2) { if(divid.style.visibility == 'hidden' || divid.style.display == 'none') { divid.style.visibility = 'visible'; divid.style.display = 'block'; } else { divid.style.visibility = 'hidden'; divid.style.display = 'none'; } } else if(st == 1) { divid.style.visibility = 'visible'; divid.style.display = 'block'; } else { divid.style.visibility = 'hidden'; divid.style.display = 'none'; } return; } // ----------------------- function nv_checkAll(oForm, cbName, caName, check_value) { if(oForm[cbName].length) { for (var i = 0; i < oForm[cbName].length; i ++ ) { oForm[cbName][i].checked = check_value; } } else { oForm[cbName].checked = check_value; } if(oForm[caName].length) { for (var j = 0; j < oForm[caName].length; j ++ ) { oForm[caName][j].checked = check_value; } } else { oForm[caName].checked = check_value; } } // ----------------------- function nv_UncheckAll(oForm, cbName, caName, check_value) { var ts = 0; if(oForm[cbName].length) { for (var i = 0; i < oForm[cbName].length; i ++ ) { if(oForm[cbName][i].checked != check_value) { ts = 1; break; } } } var chck = false; if(ts == 0) { chck = check_value; } if(oForm[caName].length) { for (var j = 0; j < oForm[caName].length; j ++ ) { oForm[caName][j].checked = chck; } } else { oForm[caName].checked = chck; } } // ----------------------- function nv_set_disable_false(sid) { if(document.getElementById( sid )) { var sd = document.getElementById( sid ); sd.disabled = false; } } // ----------------------- function nv_settimeout_disable(sid, tm) { var sd = document.getElementById( sid ); sd.disabled = true; nv_timer = setTimeout('nv_set_disable_false("'+sid+'")', tm); return nv_timer; } // ----------------------- function nv_randomPassword( plength ) { var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; var pass = ""; for( var z = 0; z < plength; z ++ ) { pass += chars.charAt( Math.floor( Math.random() * 62 ) ); } return pass; } // ----------------------- function nv_urldecode_ajax(my_url, containerid) { my_url = rawurldecode(my_url); nv_ajax( 'get', my_url, '', containerid ); return; } function nv_change_captcha(imgid,captchaid) { var vimg = document.getElementById( imgid ); nocache = nv_randomPassword( 10 ); vimg.src = nv_siteroot + 'index.php?scaptcha=captcha&nocache=' + nocache; document.getElementById( captchaid ).value = ''; return false; } function NewWindow(mypage,myname,w,h,scroll){ var win = null; LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' win = window.open(mypage,myname,settings) } nv_check_timezone();
JavaScript
function nv_randomNum( a ) { for( var b = "", d = 0; d < a; d++ ) { b += "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".charAt( Math.floor( Math.random() * 62 ) ) } return b } // --------------------------------------- function resize_byWidth( a, b, d ) { return Math.round( d / a * b ) } // --------------------------------------- function resize_byHeight( a, b, d ) { return Math.round( d / b * a ) } // --------------------------------------- function calSize( a, b, d, e ) { if( a > d ) { b = resize_byWidth( a, b, d ); a = d } if( b > e ) { a = resize_byHeight( a, b, e ); b = e } return[a, b] } // --------------------------------------- function calSizeMax( a, b, d, e ) { var g = d; d = resize_byWidth( a, b, d ); if( !( d <= e ) ) { d = e; g = resize_byHeight( a, b, e ) } return[g, d] } // --------------------------------------- function calSizeMin( a, b, d, e ) { var g = d; d = resize_byWidth( a, b, d ); if( !( d >= e ) ) { d = e; g = resize_byHeight( a, b, e ) } return[g, d] } // --------------------------------------- function is_numeric( a ) { return( typeof a === "number" || typeof a === "string" ) && a !== "" && !isNaN( a ) } // --------------------------------------- function checkNewSize() { var a = $( "input[name=newWidth]" ).val(), b = $( "input[name=newHeight]" ).val(), d = [], e = $( "input[name=origWidth]" ).val(), g = $( "input[name=origHeight]" ).val(), h = calSizeMax( e, g, nv_max_width, nv_max_height ); e = calSizeMin( e, g, nv_min_width, nv_min_height ); if( a == "" || !is_numeric( a ) ) { d = [LANG.errorEmptyX, "newWidth"] } else { if( a > h[0] ) { d = [LANG.errorMaxX, "newWidth"] } else { if( a < e[0] ) { d = [LANG.errorMinX, "newWidth"] } else { if( b == "" || !is_numeric( b ) ) { d = [LANG.errorEmptyY, "newHeight"] } else { if( b > h[1] ) { d = [LANG.errorMaxY, "newHeight"] } else { if( b < e[1] ) { d = [LANG.errorMinY, "newHeight"] } } } } } } $( "div[title=createInfo]" ).find( "div" ).remove(); if( typeof d[0] != "undefined" ) { $( "div[title=createInfo]" ).prepend( '<div class="red">' + d[0] + "</div>" ); $( "input[name='" + d[1] + "']" ).select(); return false } a = calSize( a, b, 360, 230 ); $( "img[name=myFile2]" ).width( a[0] ).height( a[1] ); return true } // --------------------------------------- function pathList( a, b ) { var d = []; $( "#foldertree" ).find( "span" ).each( function() { if( $( this ).attr( "title" ) == b || $( this ).attr( "title" ) != "" && $( this ).is( "." + a ) ) { d[d.length] = $( this ).attr( "title" ) } } ); return d } // --------------------------------------- function insertvaluetofield() { var a = $( "input[name=CKEditorFuncNum]" ).val(), b = $( "input[name=area]" ).val(), d = nv_base_siteurl + $( "span#foldervalue" ).attr( "title" ) + "/" + $( "input[name=selFile]" ).val(); if( a > 0 ) { window.opener.CKEDITOR.tools.callFunction( a, d, "" ); window.close() } if( b != "" ) { $( "#" + b, opener.document ).val( d ); window.close() } } // --------------------------------------- function download() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( "input[name=selFile]" ).val(); $( "iframe#Fdownload" ).attr( "src", nv_module_url + "dlimg&path=" + a + "&img=" + b ) } // --------------------------------------- function preview() { $( "div.dynamic" ).text( "" ); $( "input.dynamic" ).val( "" ); var a = $( "input[name=selFile]" ).val(), b = $( "span#foldervalue" ).attr( "title" ), d = $( "img[title='" + a + "']" ).attr( "name" ), e = LANG.upload_size + ": "; d = d.split( "|" ); if( d[3] == "image" || d[2] == "swf" ) { var g = calSize( d[0], d[1], 360, 230 ); e += d[0] + " x " + d[1] + " pixels (" + d[4] + ")<br />"; d[3] == "image" ? $( "div#fileView" ).html( '<img style="border:2px solid #F0F0F0;" width="' + g[0] + '" height="' + g[1] + '" src="' + nv_base_siteurl + b + "/" + a + '" />' ) : $( "#fileView" ).flash( { src:nv_base_siteurl + b + "/" + a, width:g[0], height:g[1] } , { version:8 } ) } else { e += d[4] + "<br />"; b = $( "div[title='" + a + "'] div" ).html(); $( "div#fileView" ).html( b ) } e += LANG.pubdate + ": " + d[6]; $( "#fileInfoDetail" ).html( e ); $( "#fileInfoName" ).html( a ); $( "div#imgpreview" ).dialog( { autoOpen:false, width:388, modal:true, position:"center" } ).dialog( "open" ).dblclick( function() { $( "div#imgpreview" ).dialog( "close" ) } ) } // --------------------------------------- function create() { $( "div.dynamic" ).text( "" ); $( "input.dynamic" ).val( "" ); var a = $( "input[name=selFile]" ).val(), b = $( "span#foldervalue" ).attr( "title" ), d = $( "img[title='" + a + "']" ).attr( "name" ); d = d.split( "|" ); if( d[3] == "image" ) { $( "input[name=origWidth]" ).val( d[0] ); $( "input[name=origHeight]" ).val( d[1] ); var e = calSizeMax( d[0], d[1], nv_max_width, nv_max_height ), g = calSizeMin( d[0], d[1], nv_min_width, nv_min_height ); $( "div[title=createInfo]" ).html( "Max: " + e[0] + " x " + e[1] + ", Min: " + g[0] + " x " + g[1] + " (pixels)" ); e = calSize( d[0], d[1], 360, 230 ); $( "img[name=myFile2]" ).width( e[0] ).height( e[1] ).attr( "src", nv_base_siteurl + b + "/" + a ); $( "#fileInfoDetail2" ).html( LANG.origSize + ": " + d[0] + " x " + d[1] + " pixels" ); $( "#fileInfoName2" ).html( a ); $( "div#imgcreate" ).dialog( { autoOpen:false, width:650, modal:true, position:"center" } ).dialog( "open" ) } } // --------------------------------------- function move() { $( "div.dynamic" ).text( "" ); $( "input.dynamic" ).attr( "checked", false ); var a = $( "span#foldervalue" ).attr( "title" ), b = pathList( "create_file", a ), d, e, g = $( "input[name=selFile]" ).val(); for( e in b ) { d = a == b[e] ? ' selected="selected"' : ""; $( "select[name=newPath]" ).append( '<option value="' + b[e] + '"' + d + ">" + b[e] + "</option>" ) } $( "div[title=pathFileName]" ).text( a + "/" + g ); $( "div#filemove" ).dialog( { autoOpen:false, width:300, modal:true, position:"center" } ).dialog( "open" ) } // --------------------------------------- function filerename() { $( "div.dynamic, span.dynamic" ).text( "" ); $( "input.dynamic" ).val( "" ); var a = $( "input[name=selFile]" ).val(); $( "div#filerenameOrigName" ).text( a ); a = a.replace( /^(.+)\.([a-zA-Z0-9]+)$/, "$2" ); $( "span[title=Ext]" ).text( "." + a ); $( "div#filerename" ).dialog( { autoOpen:false, width:300, modal:true, position:"center" } ).dialog( "open" ) } // --------------------------------------- function filedelete() { var a = $( "input[name=selFile]" ).val(), b = $( "span#foldervalue" ).attr( "title" ), d = $( "select[name=imgtype]" ).val(), e = $( "select[name=author]" ).val() == 1 ? "&author" : ""; confirm( LANG.upload_delimg_confirm + " " + a + " ?" ) && $.ajax( { type:"POST", url:nv_module_url + "delimg", data:"path=" + b + "&file=" + a, success:function() { $( "#imglist" ).load( nv_module_url + "imglist&path=" + b + "&type=" + d + e + "&num=" + +nv_randomNum( 10 ) ) } } ) } // --------------------------------------- function fileMouseup( a ) { $( ".imgsel" ).removeClass( "imgsel" ); $( a ).addClass( "imgsel" ); a = $( a ).attr( "title" ); $( "input[name=selFile]" ).val( a ); a = a.slice( -3 ); var b = $( "input[name=CKEditorFuncNum]" ).val(), d = $( "input[name=area]" ).val(), e = "<ul>"; if( b > 0 || d != "" ) { e += '<li id="select"><img style="margin-right:5px" src="' + ICON.select + '"/>' + LANG.select + "</li>" } e += '<li id="download"><img style="margin-right:5px" src="' + ICON.download + '"/>' + LANG.download + "</li>"; e += '<li id="filepreview"><img style="margin-right:5px" src="' + ICON.preview + '"/>' + LANG.preview + "</li>"; if( $.inArray( a, array_images ) !== -1 && $( "span#create_file" ).attr( "title" ) == "1" ) { e += '<li id="create"><img style="margin-right:5px" src="' + ICON.create + '"/>' + LANG.upload_createimage + "</li>" } if( $( "span#move_file" ).attr( "title" ) == "1" ) { e += '<li id="move"><img style="margin-right:5px" src="' + ICON.move + '"/>' + LANG.move + "</li>" } if( $( "span#rename_file" ).attr( "title" ) == "1" ) { e += '<li id="rename"><img style="margin-right:5px" src="' + ICON.rename + '"/>' + LANG.rename + "</li>" } if( $( "span#delete_file" ).attr( "title" ) == "1" ) { e += '<li id="filedelete"><img style="margin-right:5px" src="' + ICON.filedelete + '"/>' + LANG.upload_delfile + "</li>" } e += "</ul>"; $( "div#contextMenu" ).html( e ) } // --------------------------------------- function is_allowed_upload() { $( "input[name=fileupload]" ).parent().css( "display", "block" ); $( "span#upload_file" ).attr( "title" ) == "1" ? $( "input[name=fileupload]" ).parent().parent().css( "display", "block" ).next().css( "display", "none" ) : $( "input[name=fileupload]" ).parent().parent().css( "display", "none" ).next().css( "display", "block" ) } // --------------------------------------- function folderClick( a ) { var b = $( a ).attr( "title" ); if( b != $( "span#foldervalue" ).attr( "title" ) ) { $( "span#foldervalue" ).attr( "title", b ); $( "span#view_dir" ).attr( "title", $( a ).is( ".view_dir" ) ? "1" : "0" ); $( "span#create_dir" ).attr( "title", $( a ).is( ".create_dir" ) ? "1" : "0" ); $( "span#rename_dir" ).attr( "title", $( a ).is( ".rename_dir" ) ? "1" : "0" ); $( "span#delete_dir" ).attr( "title", $( a ).is( ".delete_dir" ) ? "1" : "0" ); $( "span#upload_file" ).attr( "title", $( a ).is( ".upload_file" ) ? "1" : "0" ); $( "span#create_file" ).attr( "title", $( a ).is( ".create_file" ) ? "1" : "0" ); $( "span#rename_file" ).attr( "title", $( a ).is( ".rename_file" ) ? "1" : "0" ); $( "span#delete_file" ).attr( "title", $( a ).is( ".delete_file" ) ? "1" : "0" ); $( "span#move_file" ).attr( "title", $( a ).is( ".move_file" ) ? "1" : "0" ); $( "span.folder" ).css( "color", "" ); $( a ).css( "color", "red" ); if( $( a ).is( ".view_dir" ) ) { a = $( "select[name=imgtype]" ).val(); var d = $( "input[name=selFile]" ).val(), e = $( "select[name=author]" ).val() == 1 ? "&author" : ""; $( "div#imglist" ).load( nv_module_url + "imglist&path=" + b + "&imgfile=" + d + "&type=" + a + e + "&random=" + nv_randomNum( 10 ) ) } else { $( "div#imglist" ).text( "" ) } is_allowed_upload() } } // --------------------------------------- function menuMouseup( a ) { $( a ).attr( "title" ); $( "span" ).attr( "name", "" ); $( a ).attr( "name", "current" ); var b = ""; if( $( a ).is( ".create_dir" ) ) { b += '<li id="createfolder"><img style="margin-right:5px" src="' + ICON.create + '"/>' + LANG.createfolder + "</li>" } if( $( a ).is( ".rename_dir" ) ) { b += '<li id="renamefolder"><img style="margin-right:5px" src="' + ICON.rename + '"/>' + LANG.renamefolder + "</li>" } if( $( a ).is( ".delete_dir" ) ) { b += '<li id="deletefolder"><img style="margin-right:5px" src="' + ICON.filedelete + '"/>' + LANG.deletefolder + "</li>" } if( b != "" ) { b = "<ul>" + b + "</ul>" } $( "div#contextMenu" ).html( b ) } // --------------------------------------- function renamefolder() { var a = $( "span[name=current]" ).attr( "title" ).split( "/" ); a = a[a.length - 1]; $( "input[name=foldername]" ).val( a ); $( "div#renamefolder" ).dialog( "open" ) } // --------------------------------------- function createfolder() { $( "input[name=createfoldername]" ).val( "" ); $( "div#createfolder" ).dialog( "open" ) } // --------------------------------------- function deletefolder() { if( confirm( LANG.delete_folder ) ) { var a = $( "span[name=current]" ).attr( "title" ); $.ajax( { type:"POST", url:nv_module_url + "delfolder&random=" + nv_randomNum( 10 ), data:"path=" + a, success:function( b ) { b = b.split( "_" ); if( b[0] == "ERROR" ) { alert( b[1] ) } else { b = a.split( "/" ); a = ""; for( i = 0; i < b.length - 1; i++ ) { if( a != "" ) { a += "/" } a += b[i] } b = $( "select[name=imgtype]" ).val(); var d = $( "select[name=author]" ).val() == 1 ? "&author" : "", e = $( "span#path" ).attr( "title" ), g = $( "input[name=selFile]" ).val(); $( "#imgfolder" ).load( nv_module_url + "folderlist&path=" + e + "&currentpath=" + a + "&random=" + nv_randomNum( 10 ) ); $( "div#imglist" ).load( nv_module_url + "imglist&path=" + a + "&imgfile=" + g + "&type=" + b + d + "&random=" + nv_randomNum( 10 ) ) } } } ) } } // --------------------------------------- $( "select[name=imgtype]" ).change( function() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( this ).val(), d = $( "input[name=selFile]" ).val(), e = $( "select[name=author]" ).val() == 1 ? "&author" : ""; $( "#imglist" ).load( nv_module_url + "imglist&path=" + a + "&type=" + b + "&imgfile=" + d + e + "&random=" + nv_randomNum( 10 ) ) } // --------------------------------------- ); $( "select[name=author]" ).change( function() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( "input[name=selFile]" ).val(), d = $( "select[name=imgtype]" ).val(), e = $( this ).val() == 1 ? "&author" : ""; $( "#imglist" ).load( nv_module_url + "imglist&path=" + a + "&type=" + d + "&imgfile=" + b + e + "&random=" + nv_randomNum( 10 ) ) } // --------------------------------------- ); $( ".refresh a" ).click( function() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( "select[name=imgtype]" ).val(), d = $( "input[name=selFile]" ).val(), e = $( "select[name=author]" ).val() == 1 ? "&author" : "", g = $( "span#path" ).attr( "title" ); $( "#imgfolder" ).load( nv_module_url + "folderlist&path=" + g + "&currentpath=" + a + "&dirListRefresh&random=" + nv_randomNum( 10 ) ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + a + "&type=" + b + "&imgfile=" + d + e + "&refresh&random=" + nv_randomNum( 10 ) ); return false } // --------------------------------------- ); $( "input[name=fileupload]" ).change( function() { var a = $( this ).val(); f = a.replace( /.*\\(.*)/, "$1" ).replace( /.*\/(.*)/, "$1" ); $( this ).parent().prev().html( f ); a = a + " " + $( "span#foldervalue" ).attr( "title" ); $( "input[name=currentFileUpload]" ).val() != a && $( this ).parent().next().next().css( "display", "none" ).next().css( "display", "none" ) } // --------------------------------------- ); $( "input[name=imgurl]" ).change( function() { $( this ).parent().next().next().css( "display", "none" ).next().css( "display", "none" ) } // --------------------------------------- ); $( "#confirm" ).click( function() { var a = $( "input[name=fileupload]" ).val(), b = $( "span#foldervalue" ).attr( "title" ), d = $( "input[name=currentFileUpload]" ).val(), e = a + " " + b, g = $( "select[name=imgtype]" ).val(), h = $( "select[name=author]" ).val() == 1 ? "&author" : ""; if( a != "" && d != e ) { $( "input[name=fileupload]" ).parent().css( "display", "none" ).next().css( "display", "block" ).next().css( "display", "none" ); $( "input[name=fileupload]" ).upload( nv_module_url + "upload&random=" + nv_randomNum( 10 ), "path=" + b, function( k ) { $( "input[name=currentFileUpload]" ).val( e ); var l = k.split( "_" ); if( l[0] == "ERROR" ) { $( "div#errorInfo" ).html( l[1] ).dialog( "open" ); $( "input[name=fileupload]" ).parent().css( "display", "block" ).next().css( "display", "none" ).next().css( "display", "none" ).next().css( "display", "block" ) } else { $( "input[name=fileupload]" ).parent().css( "display", "block" ).next().css( "display", "none" ).next().css( "display", "block" ); $( "input[name=selFile]" ).val( k ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + b + "&type=" + g + h + "&imgfile=" + k ) } } , "html" ) } else { a = $( "input[name=imgurl]" ).val(); d = $( "input[name=currentFileUrl]" ).val(); var j = a + " " + b; if( /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a) && d != j ) { $( "input[name=imgurl]" ).parent().css( "display", "none" ).next().css( "display", "block" ).next().css( "display", "none" ); $.ajax( { type:"POST", url:nv_module_url + "upload&random=" + nv_randomNum( 10 ), data:"path=" + b + "&fileurl=" + a, success:function( k ) { $( "input[name=currentFileUrl]" ).val( j ); var l = k.split( "_" ); if( l[0] == "ERROR" ) { $( "div#errorInfo" ).html( l[1] ).dialog( "open" ); $( "input[name=imgurl]" ).parent().css( "display", "block" ).next().css( "display", "none" ).next().css( "display", "none" ).next().css( "display", "block" ) } else { $( "input[name=imgurl]" ).parent().css( "display", "block" ).next().css( "display", "none" ).next().css( "display", "block" ).next().css( "display", "none" ); $( "input[name=selFile]" ).val( k ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + b + "&type=" + g + "&imgfile=" + k + h + "&num=" + +nv_randomNum( 10 ) ) } } } ) } } } // --------------------------------------- ); $( "div#errorInfo" ).dialog( { autoOpen:false, width:300, height:180, modal:true, position:"center", show:"slide" } // --------------------------------------- ); $( "div#renamefolder" ).dialog( { autoOpen:false, width:250, height:160, modal:true, position:"center", buttons: { Ok:function() { var a = $( "span[name=current]" ).attr( "title" ), b = $( "input[name=foldername]" ).val(), d = $( "span#foldervalue" ).attr( "title" ), e = a.split( "/" ); e = e[e.length - 1]; if( b == "" || b == e || !nv_namecheck.test( b ) ) { alert( LANG.rename_nonamefolder ); $( "input[name=foldername]" ).focus(); return false } e = $( "span[name=current]" ).attr( "class" ).split( " " ); e = e[e.length - 1]; var g = true; $( "span." + e ).each( function() { var h = $( this ).attr( "title" ).split( "/" ); h = h[h.length - 1]; if( b == h ) { g = false } } ); if( !g ) { alert( LANG.folder_exists ); $( "input[name=foldername]" ).focus(); return false } $.ajax( { type:"POST", url:nv_module_url + "renamefolder&random=" + nv_randomNum( 10 ), data:"path=" + a + "&newname=" + b, success:function( h ) { var j = h.split( "_" ); if( j[0] == "ERROR" ) { alert( j[1] ) } else { j = h.split( "/" ); j = j[j.length - 1]; var k; $( "span[name=current]" ).parent().find( "span" ).each( function() { k = $( this ).attr( "title" ); k = k.replace( a, h ); $( this ).attr( "title" ) == d && $( "span#foldervalue" ).attr( "title", k ); $( this ).attr( "title", k ) } ); $( "span[name=current]" ).html( "&nbsp;" + j ).attr( "title", h ) } } } ); $( this ).dialog( "close" ) } } } // --------------------------------------- ); $( "div#createfolder" ).dialog( { autoOpen:false, width:250, height:160, modal:true, position:"center", buttons: { Ok:function() { var a = $( "input[name=createfoldername]" ).val(), b = $( "span[name=current]" ).attr( "title" ); if( a == "" || !nv_namecheck.test( a ) ) { alert( LANG.name_folder_error ); $( "input[name=createfoldername]" ).focus(); return false } $.ajax( { type:"POST", url:nv_module_url + "createfolder&random=" + nv_randomNum( 10 ), data:"path=" + b + "&newname=" + a, success:function( d ) { var e = d.split( "_" ); if( e[0] == "ERROR" ) { alert( e[1] ) } else { e = $( "select[name=imgtype]" ).val(); var g = $( "select[name=author]" ).val() == 1 ? "&author" : "", h = $( "span#path" ).attr( "title" ); $( "#imgfolder" ).load( nv_module_url + "folderlist&path=" + h + "&currentpath=" + d + "&random=" + nv_randomNum( 10 ) ); $( "div#imglist" ).load( nv_module_url + "imglist&path=" + d + "&type=" + e + g + "&random=" + nv_randomNum( 10 ) ) } } } ); $( this ).dialog( "close" ) } } } // --------------------------------------- ); $( "input[name=newWidth], input[name=newHeight]" ).keyup( function() { var a = $( this ).attr( "name" ), b = $( "input[name='" + a + "']" ).val(), d = $( "input[name=origWidth]" ).val(), e = $( "input[name=origHeight]" ).val(), g = calSizeMax( d, e, nv_max_width, nv_max_height ); g = a == "newWidth" ? g[0] : g[1]; if( !is_numeric( b ) || b > g || b < 0 ) { $( "input[name=newWidth]" ).val( "" ); $( "input[name=newHeight]" ).val( "" ) } else { a == "newWidth" ? $( "input[name=newHeight]" ).val( resize_byWidth( d, e, b ) ) : $( "input[name=newWidth]" ).val( resize_byHeight( d, e, b ) ) } } // --------------------------------------- ); $( "input[name=prView]" ).click( function() { checkNewSize() } // --------------------------------------- ); $( "input[name=newSizeOK]" ).click( function() { var a = $( "input[name=newWidth]" ).val(), b = $( "input[name=newHeight]" ).val(), d = $( "input[name=origWidth]" ).val(), e = $( "input[name=origHeight]" ).val(); if( a == d && b == e ) { $( "div#imgcreate" ).dialog( "close" ) } else { if( checkNewSize() !== false ) { $( this ).attr( "disabled", "disabled" ); d = $( "input[name=selFile]" ).val(); var g = $( "span#foldervalue" ).attr( "title" ); $.ajax( { type:"POST", url:nv_module_url + "createimg", data:"path=" + g + "&img=" + d + "&width=" + a + "&height=" + b + "&num=" + nv_randomNum( 10 ), success:function( h ) { var j = h.split( "_" ); if( j[0] == "ERROR" ) { alert( j[1] ); $( "input[name=newSizeOK]" ).removeAttr( "disabled" ) } else { j = $( "select[name=imgtype]" ).val(); var k = $( "select[name=author]" ).val() == 1 ? "&author" : ""; $( "input[name=selFile]" ).val( h ); $( "input[name=newSizeOK]" ).removeAttr( "disabled" ); $( "div#imgcreate" ).dialog( "close" ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + g + "&type=" + j + "&imgfile=" + h + k + "&num=" + +nv_randomNum( 10 ) ) } } } ) } } } // --------------------------------------- ); $( "input[name=newPathOK]" ).click( function() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( "select[name=newPath]" ).val(), d = $( "input[name=selFile]" ).val(), e = $( "input[name=mirrorFile]:checked" ).length; if( a == b ) { $( "div#filemove" ).dialog( "close" ) } else { $( this ).attr( "disabled", "disabled" ); $.ajax( { type:"POST", url:nv_module_url + "moveimg&num=" + nv_randomNum( 10 ), data:"path=" + a + "&newpath=" + b + "&file=" + d + "&mirror=" + e, success:function( g ) { var h = g.split( "_" ); if( h[0] == "ERROR" ) { alert( h[1] ); $( "input[name=newPathOK]" ).removeAttr( "disabled" ) } else { h = $( "select[name=imgtype]" ).val(); var j = $( "input[name=goNewPath]:checked" ).length, k = $( "select[name=author]" ).val() == 1 ? "&author" : ""; $( "input[name=selFile]" ).val( g ); $( "input[name=newPathOK]" ).removeAttr( "disabled" ); $( "div#filemove" ).dialog( "close" ); if( j == 1 ) { j = $( "span#path" ).attr( "title" ); $( "#imgfolder" ).load( nv_module_url + "folderlist&path=" + j + "&currentpath=" + b + "&random=" + nv_randomNum( 10 ) ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + b + "&type=" + h + "&imgfile=" + g + k + "&num=" + +nv_randomNum( 10 ) ) } else { $( "#imglist" ).load( nv_module_url + "imglist&path=" + a + "&type=" + h + "&imgfile=" + g + k + "&num=" + +nv_randomNum( 10 ) ) } } } } ) } } // --------------------------------------- ); $( "input[name=filerenameOK]" ).click( function() { var a = $( "span#foldervalue" ).attr( "title" ), b = $( "input[name=selFile]" ).val(), d = $( "input[name=filerenameNewName]" ).val(), e = b.match( /^(.+)\.([a-zA-Z0-9]+)$/ ); d = $.trim( d ); $( "input[name=filerenameNewName]" ).val( d ); if( d == "" ) { alert( LANG.rename_noname ); $( "input[name=filerenameNewName]" ).focus() } else { if( e[1] == d ) { $( "div#filerename" ).dialog( "close" ) } else { $( this ).attr( "disabled", "disabled" ); $.ajax( { type:"POST", url:nv_module_url + "renameimg&num=" + nv_randomNum( 10 ), data:"path=" + a + "&file=" + b + "&newname=" + d, success:function( g ) { var h = g.split( "_" ); if( h[0] == "ERROR" ) { alert( h[1] ); $( "input[name=filerenameOK]" ).removeAttr( "disabled" ) } else { h = $( "select[name=imgtype]" ).val(); var j = $( "select[name=author]" ).val() == 1 ? "&author" : ""; $( "input[name=filerenameOK]" ).removeAttr( "disabled" ); $( "div#filerename" ).dialog( "close" ); $( "#imglist" ).load( nv_module_url + "imglist&path=" + a + "&type=" + h + "&imgfile=" + g + j + "&num=" + nv_randomNum( 10 ) ) } } } ) } } } // --------------------------------------- ); $( "img[name=myFile2]" ).dblclick( function() { $( "div[title=createInfo]" ).find( "div" ).remove(); var a = $( "input[name=origWidth]" ).val(), b = $( "input[name=origHeight]" ).val(); c = calSize( a, b, 360, 230 ); $( this ).width( c[0] ).height( c[1] ); $( "input[name=newHeight]" ).val( b ); $( "input[name=newWidth]" ).val( a ).select() } // --------------------------------------- );
JavaScript
/** * DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>. * Author: Drew Diller * Email: drew.diller@gmail.com * URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/ * Version: 0.0.8a * Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license * * Example usage: * DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector * DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement **/ /* PLEASE READ: Absolutely everything in this script is SILLY. I know this. IE's rendering of certain pixels doesn't make sense, so neither does this code! */ var DD_belatedPNG = { ns: 'DD_belatedPNG', imgSize: {}, delay: 10, nodesFixed: 0, createVmlNameSpace: function () { /* enable VML */ if (document.namespaces && !document.namespaces[this.ns]) { document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml'); } }, createVmlStyleSheet: function () { /* style VML, enable behaviors */ /* Just in case lots of other developers have added lots of other stylesheets using document.createStyleSheet and hit the 31-limit mark, let's not use that method! further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx */ var screenStyleSheet, printStyleSheet; screenStyleSheet = document.createElement('style'); screenStyleSheet.setAttribute('media', 'screen'); document.documentElement.firstChild.insertBefore(screenStyleSheet, document.documentElement.firstChild.firstChild); if (screenStyleSheet.styleSheet) { screenStyleSheet = screenStyleSheet.styleSheet; screenStyleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}'); screenStyleSheet.addRule(this.ns + '\\:shape', 'position:absolute;'); screenStyleSheet.addRule('img.' + this.ns + '_sizeFinder', 'behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;'); /* large negative top value for avoiding vertical scrollbars for large images, suggested by James O'Brien, http://www.thanatopsic.org/hendrik/ */ this.screenStyleSheet = screenStyleSheet; /* Add a print-media stylesheet, for preventing VML artifacts from showing up in print (including preview). */ /* Thanks to R�mi Pr�vost for automating this! */ printStyleSheet = document.createElement('style'); printStyleSheet.setAttribute('media', 'print'); document.documentElement.firstChild.insertBefore(printStyleSheet, document.documentElement.firstChild.firstChild); printStyleSheet = printStyleSheet.styleSheet; printStyleSheet.addRule(this.ns + '\\:*', '{display: none !important;}'); printStyleSheet.addRule('img.' + this.ns + '_sizeFinder', '{display: none !important;}'); } }, readPropertyChange: function () { var el, display, v; el = event.srcElement; if (!el.vmlInitiated) { return; } if (event.propertyName.search('background') != -1 || event.propertyName.search('border') != -1) { DD_belatedPNG.applyVML(el); } if (event.propertyName == 'style.display') { display = (el.currentStyle.display == 'none') ? 'none' : 'block'; for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { el.vml[v].shape.style.display = display; } } } if (event.propertyName.search('filter') != -1) { DD_belatedPNG.vmlOpacity(el); } }, vmlOpacity: function (el) { if (el.currentStyle.filter.search('lpha') != -1) { var trans = el.currentStyle.filter; trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100; el.vml.color.shape.style.filter = el.currentStyle.filter; /* complete guesswork */ el.vml.image.fill.opacity = trans; /* complete guesswork */ } }, handlePseudoHover: function (el) { setTimeout(function () { /* wouldn't work as intended without setTimeout */ DD_belatedPNG.applyVML(el); }, 1); }, /** * This is the method to use in a document. * @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container' **/ fix: function (selector) { if (this.screenStyleSheet) { var selectors, i; selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */ for (i=0; i<selectors.length; i++) { this.screenStyleSheet.addRule(selectors[i], 'behavior:expression(DD_belatedPNG.fixPng(this))'); /* seems to execute the function without adding it to the stylesheet - interesting... */ } } }, applyVML: function (el) { el.runtimeStyle.cssText = ''; this.vmlFill(el); this.vmlOffsets(el); this.vmlOpacity(el); if (el.isImg) { this.copyImageBorders(el); } }, attachHandlers: function (el) { var self, handlers, handler, moreForAs, a, h; self = this; handlers = {resize: 'vmlOffsets', move: 'vmlOffsets'}; if (el.nodeName == 'A') { moreForAs = {mouseleave: 'handlePseudoHover', mouseenter: 'handlePseudoHover', focus: 'handlePseudoHover', blur: 'handlePseudoHover'}; for (a in moreForAs) { if (moreForAs.hasOwnProperty(a)) { handlers[a] = moreForAs[a]; } } } for (h in handlers) { if (handlers.hasOwnProperty(h)) { handler = function () { self[handlers[h]](el); }; el.attachEvent('on' + h, handler); } } el.attachEvent('onpropertychange', this.readPropertyChange); }, giveLayout: function (el) { el.style.zoom = 1; if (el.currentStyle.position == 'static') { el.style.position = 'relative'; } }, copyImageBorders: function (el) { var styles, s; styles = {'borderStyle':true, 'borderWidth':true, 'borderColor':true}; for (s in styles) { if (styles.hasOwnProperty(s)) { el.vml.color.shape.style[s] = el.currentStyle[s]; } } }, vmlFill: function (el) { if (!el.currentStyle) { return; } else { var elStyle, noImg, lib, v, img, imgLoaded; elStyle = el.currentStyle; } for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { el.vml[v].shape.style.zIndex = elStyle.zIndex; } } el.runtimeStyle.backgroundColor = ''; el.runtimeStyle.backgroundImage = ''; noImg = true; if (elStyle.backgroundImage != 'none' || el.isImg) { if (!el.isImg) { el.vmlBg = elStyle.backgroundImage; el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5); } else { el.vmlBg = el.src; } lib = this; if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */ img = document.createElement('img'); lib.imgSize[el.vmlBg] = img; img.className = lib.ns + '_sizeFinder'; img.runtimeStyle.cssText = 'behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */ imgLoaded = function () { this.width = this.offsetWidth; /* weird cache-busting requirement! */ this.height = this.offsetHeight; lib.vmlOffsets(el); }; img.attachEvent('onload', imgLoaded); img.src = el.vmlBg; img.removeAttribute('width'); img.removeAttribute('height'); document.body.insertBefore(img, document.body.firstChild); } el.vml.image.fill.src = el.vmlBg; noImg = false; } el.vml.image.fill.on = !noImg; el.vml.image.fill.color = 'none'; el.vml.color.shape.style.backgroundColor = elStyle.backgroundColor; el.runtimeStyle.backgroundImage = 'none'; el.runtimeStyle.backgroundColor = 'transparent'; }, /* IE can't figure out what do when the offsetLeft and the clientLeft add up to 1, and the VML ends up getting fuzzy... so we have to push/enlarge things by 1 pixel and then clip off the excess */ vmlOffsets: function (el) { var thisStyle, size, fudge, makeVisible, bg, bgR, dC, altC, b, c, v; thisStyle = el.currentStyle; size = {'W':el.clientWidth+1, 'H':el.clientHeight+1, 'w':this.imgSize[el.vmlBg].width, 'h':this.imgSize[el.vmlBg].height, 'L':el.offsetLeft, 'T':el.offsetTop, 'bLW':el.clientLeft, 'bTW':el.clientTop}; fudge = (size.L + size.bLW == 1) ? 1 : 0; /* vml shape, left, top, width, height, origin */ makeVisible = function (vml, l, t, w, h, o) { vml.coordsize = w+','+h; vml.coordorigin = o+','+o; vml.path = 'm0,0l'+w+',0l'+w+','+h+'l0,'+h+' xe'; vml.style.width = w + 'px'; vml.style.height = h + 'px'; vml.style.left = l + 'px'; vml.style.top = t + 'px'; }; makeVisible(el.vml.color.shape, (size.L + (el.isImg ? 0 : size.bLW)), (size.T + (el.isImg ? 0 : size.bTW)), (size.W-1), (size.H-1), 0); makeVisible(el.vml.image.shape, (size.L + size.bLW), (size.T + size.bTW), (size.W), (size.H), 1 ); bg = {'X':0, 'Y':0}; if (el.isImg) { bg.X = parseInt(thisStyle.paddingLeft, 10) + 1; bg.Y = parseInt(thisStyle.paddingTop, 10) + 1; } else { for (b in bg) { if (bg.hasOwnProperty(b)) { this.figurePercentage(bg, size, b, thisStyle['backgroundPosition'+b]); } } } el.vml.image.fill.position = (bg.X/size.W) + ',' + (bg.Y/size.H); bgR = thisStyle.backgroundRepeat; dC = {'T':1, 'R':size.W+fudge, 'B':size.H, 'L':1+fudge}; /* these are defaults for repeat of any kind */ altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'W'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'H'} }; if (bgR != 'repeat' || el.isImg) { c = {'T':(bg.Y), 'R':(bg.X+size.w), 'B':(bg.Y+size.h), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */ if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */ v = bgR.split('repeat-')[1].toUpperCase(); c[altC[v].b1] = 1; c[altC[v].b2] = size[altC[v].d]; } if (c.B > size.H) { c.B = size.H; } el.vml.image.shape.style.clip = 'rect('+c.T+'px '+(c.R+fudge)+'px '+c.B+'px '+(c.L+fudge)+'px)'; } else { el.vml.image.shape.style.clip = 'rect('+dC.T+'px '+dC.R+'px '+dC.B+'px '+dC.L+'px)'; } }, figurePercentage: function (bg, size, axis, position) { var horizontal, fraction; fraction = true; horizontal = (axis == 'X'); switch(position) { case 'left': case 'top': bg[axis] = 0; break; case 'center': bg[axis] = 0.5; break; case 'right': case 'bottom': bg[axis] = 1; break; default: if (position.search('%') != -1) { bg[axis] = parseInt(position, 10) / 100; } else { fraction = false; } } bg[axis] = Math.ceil( fraction ? ( (size[horizontal?'W': 'H'] * bg[axis]) - (size[horizontal?'w': 'h'] * bg[axis]) ) : parseInt(position, 10) ); if (bg[axis] % 2 === 0) { bg[axis]++; } return bg[axis]; }, fixPng: function (el) { el.style.behavior = 'none'; var lib, els, nodeStr, v, e; if (el.nodeName == 'BODY' || el.nodeName == 'TD' || el.nodeName == 'TR') { /* elements not supported yet */ return; } el.isImg = false; if (el.nodeName == 'IMG') { if(el.src.toLowerCase().search(/\.png$/) != -1) { el.isImg = true; el.style.visibility = 'hidden'; } else { return; } } else if (el.currentStyle.backgroundImage.toLowerCase().search('.png') == -1) { return; } lib = DD_belatedPNG; el.vml = {color: {}, image: {}}; els = {shape: {}, fill: {}}; for (v in el.vml) { if (el.vml.hasOwnProperty(v)) { for (e in els) { if (els.hasOwnProperty(e)) { nodeStr = lib.ns + ':' + e; el.vml[v][e] = document.createElement(nodeStr); } } el.vml[v].shape.stroked = false; el.vml[v].shape.appendChild(el.vml[v].fill); el.parentNode.insertBefore(el.vml[v].shape, el); } } el.vml.image.shape.fillcolor = 'none'; /* Don't show blank white shapeangle when waiting for image to load. */ el.vml.image.fill.type = 'tile'; /* Makes image show up. */ el.vml.color.fill.on = false; /* Actually going to apply vml element's style.backgroundColor, so hide the whiteness. */ lib.attachHandlers(el); lib.giveLayout(el); lib.giveLayout(el.offsetParent); el.vmlInitiated = true; lib.applyVML(el); /* Render! */ } }; try { document.execCommand("BackgroundImageCache", false, true); /* TredoSoft Multiple IE doesn't like this, so try{} it */ } catch(r) {} DD_belatedPNG.createVmlNameSpace(); DD_belatedPNG.createVmlStyleSheet();
JavaScript
/** * @Project NUKEVIET 3.0 * @Author VINADES.,JSC (contact@vinades.vn) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 31/05/2010, 9:36 */ function nv_is_del_cron(cronid) { if (confirm(nv_is_del_confirm[0])) { nv_ajax( 'get', window.location.href, nv_fc_variable + '=cronjobs_del&id=' + cronid, '', 'nv_is_del_cron_result' ); } return false; } function nv_is_del_cron_result(res) { if(res == 1) { alert(nv_is_del_confirm[1]); window.location.href = window.location.href; } else { alert(nv_is_del_confirm[2]); } return false; }
JavaScript
/* * * @Project NUKEVIET 3.0 * @Author VINADES ( contact@vinades.vn ) * @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2 - 10 - 2010 16 : 3 */ function nv_show_list_mods(){ if (document.getElementById('list_mods')) { nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=list&num=' + nv_randomPassword(8), 'list_mods'); } return; } // --------------------------------------- function nv_chang_in_menu(modname){ var nv_timer = nv_settimeout_disable('change_inmenu_' + modname, 5000); nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_inmenu&mod=' + modname + '&num=' + nv_randomPassword(8), '', 'nv_chang_in_menu_res'); return; } // --------------------------------------- function nv_chang_in_menu_res(res){ var r_split = res.split("_"); var sl = document.getElementById('change_inmenu_' + r_split[1]); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; return; } return; } // --------------------------------------- function nv_chang_submenu(modname){ var nv_timer = nv_settimeout_disable('change_submenu_' + modname, 5000); nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_submenu&mod=' + modname + '&num=' + nv_randomPassword(8), '', 'nv_chang_submenu_res'); return; } // --------------------------------------- function nv_chang_submenu_res(res){ var r_split = res.split("_"); var sl = document.getElementById('change_submenu_' + r_split[1]); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; return; } return; } // --------------------------------------- function nv_chang_weight(modname){ var nv_timer = nv_settimeout_disable('change_weight_' + modname, 5000); var new_weight = document.getElementById('change_weight_' + modname).options[document.getElementById('change_weight_' + modname).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_weight&mod=' + modname + '&new_weight=' + new_weight + '&num=' + nv_randomPassword(8), '', 'nv_chang_weight_res'); return; } // --------------------------------------- function nv_chang_weight_res(res){ var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_list_mods(); return; } // --------------------------------------- function nv_chang_act(modname){ if (confirm(nv_is_change_act_confirm[0])) { var nv_timer = nv_settimeout_disable('change_act_' + modname, 5000); nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_act&mod=' + modname + '&num=' + nv_randomPassword(8), '', 'nv_chang_act_res'); } else { var sl = document.getElementById('change_act_' + modname); sl.checked = (sl.checked == true) ? false : true; } return; } // --------------------------------------- function nv_chang_act_res(res){ var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_list_mods(); return; } // --------------------------------------- function nv_recreate_mod(modname){ if (confirm(nv_is_recreate_confirm[0])) { nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=recreate_mod&mod=' + modname + '&num=' + nv_randomPassword(8), '', 'nv_recreate_mod_res'); } return; } // --------------------------------------- function nv_recreate_mod_res(res){ var r_split = res.split("_"); if (r_split[0] != 'OK') { alert(nv_is_recreate_confirm[2]); } else { alert(nv_is_recreate_confirm[1]); nv_show_list_mods(); } return; } // --------------------------------------- function nv_mod_del(modname){ if (confirm(nv_is_del_confirm[0])) { nv_ajax('post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del&mod=' + modname, '', 'nv_mod_del_result'); } return false; } // --------------------------------------- function nv_mod_del_result(res){ var r_split = res.split("_"); if (r_split[0] == 'OK') { window.location.href = script_name + '?' + nv_name_variable + '=modules&' + nv_randomPassword(6) + '=' + nv_randomPassword(8); } else { alert(nv_is_del_confirm[2]); } return false; } // --------------------------------------- function nv_show_funcs(show_id){ if (document.getElementById(show_id)) { nv_ajax("get", strHref, 'aj=show_funcs&num=' + nv_randomPassword(8), show_id); } return; } // --------------------------------------- function nv_chang_func_weight(func_id){ var nv_timer = nv_settimeout_disable('change_weight_' + func_id, 5000); var new_weight = document.getElementById('change_weight_' + func_id).options[document.getElementById('change_weight_' + func_id).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_func_weight&fid=' + func_id + '&new_weight=' + new_weight + '&num=' + nv_randomPassword(8), '', 'nv_chang_func_weight_res'); return; } // --------------------------------------- function nv_chang_func_weight_res(res){ var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_show_funcs(r_split[1]); return; } // --------------------------------------- function nv_chang_func_in_submenu(func_id){ var nv_timer = nv_settimeout_disable('chang_func_in_submenu_' + func_id, 5000); nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_func_submenu&id=' + func_id + '&num=' + nv_randomPassword(8), '', 'nv_chang_func_in_submenu_res'); return; } // --------------------------------------- function nv_chang_func_in_submenu_res(res){ var r_split = res.split("_"); var sl = document.getElementById('chang_func_in_submenu_' + r_split[1]); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); if (sl.checked == true) sl.checked = false; else sl.checked = true; clearTimeout(nv_timer); sl.disabled = true; } return; } // --------------------------------------- function nv_change_custom_name(func_id, containerid){ nv_ajax("get", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_custom_name&id=' + func_id + '&num=' + nv_randomPassword(8), containerid); return; } // --------------------------------------- function nv_change_custom_name_submit(func_id, custom_name_id){ var new_custom_name = rawurlencode(document.getElementById(custom_name_id).value); nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_custom_name&id=' + func_id + '&save=1&func_custom_name=' + new_custom_name + '&num=' + nv_randomPassword(8), '', 'nv_change_custom_name_res'); return; } // --------------------------------------- function nv_change_custom_name_res(res){ var r_split = res.split("|"); var sl = document.getElementById('chang_func_in_submenu_' + r_split[1]); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } else { nv_show_funcs(r_split[1]); nv_action_cancel(r_split[2]); } return; } // --------------------------------------- function nv_action_cancel(containerid){ document.getElementById(containerid).innerHTML = ''; return; } // --------------------------------------- function nv_chang_bl_weight(bl_id){ var nv_timer = nv_settimeout_disable('change_bl_weight_' + bl_id, 5000); var new_weight = document.getElementById('change_bl_weight_' + bl_id).options[document.getElementById('change_bl_weight_' + bl_id).selectedIndex].value; nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_block_weight&id=' + bl_id + '&new_weight=' + new_weight + '&num=' + nv_randomPassword(8), '', 'nv_chang_bl_weight_res'); return; } // --------------------------------------- function nv_chang_bl_weight_res(res){ var r_split = res.split("|"); if (r_split[0] != 'OK') { alert(nv_is_change_act_confirm[2]); } clearTimeout(nv_timer); nv_bl_list(r_split[1], r_split[2], r_split[3]); return; } // --------------------------------------- function nv_show_bl(bl_id, containerid){ nv_ajax("post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=show_block&id=' + bl_id + '&num=' + nv_randomPassword(8), containerid); return; } // --------------------------------------- function nv_del_bl(bl_id){ if (confirm(nv_is_del_confirm[0])) { nv_ajax('get', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=del_block&id=' + bl_id, '', 'nv_del_bl_res'); } return false; } // --------------------------------------- function nv_del_bl_res(res){ var r_split = res.split("|"); if (r_split[0] == 'OK') { nv_bl_list(r_split[1], r_split[2], r_split[3]); } else { alert(nv_is_del_confirm[2]); } return false; }
JavaScript
/** * Flash (http://jquery.lukelutman.com/plugins/flash) * A jQuery plugin for embedding Flash movies. * * Version 1.0 * November 9th, 2006 * * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com) * Dual licensed under the MIT and GPL licenses. * http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/gpl-license.php * * Inspired by: * SWFObject (http://blog.deconcept.com/swfobject/) * UFO (http://www.bobbyvandersluis.com/ufo/) * sIFR (http://www.mikeindustries.com/sifr/) * * IMPORTANT: * The packed version of jQuery breaks ActiveX control * activation in Internet Explorer. Use JSMin to minifiy * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex). * **/ ;(function(){ var $$; /** * * @desc Replace matching elements with a flash movie. * @author Luke Lutman * @version 1.0.1 * * @name flash * @param Hash htmlOptions Options for the embed/object tag. * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional). * @param Function replace Custom block called for each matched element if flash is installed (optional). * @param Function update Custom block called for each matched if flash isn't installed (optional). * @type jQuery * * @cat plugins/flash * * @example $('#hello').flash({ src: 'hello.swf' }); * @desc Embed a Flash movie. * * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 }); * @desc Embed a Flash 8 movie. * * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true }); * @desc Embed a Flash movie using Express Install if flash isn't installed. * * @example $('#hello').flash({ src: 'hello.swf' }, { update: false }); * @desc Embed a Flash movie, don't show an update message if Flash isn't installed. * **/ $$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) { // Set the default block. var block = replace || $$.replace; // Merge the default and passed plugin options. pluginOptions = $$.copy($$.pluginOptions, pluginOptions); // Detect Flash. if(!$$.hasFlash(pluginOptions.version)) { // Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed). if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) { // Add the necessary flashvars (merged later). var expressInstallOptions = { flashvars: { MMredirectURL: location, MMplayerType: 'PlugIn', MMdoctitle: jQuery('title').text() } }; // Ask the user to update (if specified). } else if (pluginOptions.update) { // Change the block to insert the update message instead of the flash movie. block = update || $$.update; // Fail } else { // The required version of flash isn't installed. // Express Install is turned off, or flash 6,0,65 isn't installed. // Update is turned off. // Return without doing anything. return this; } } // Merge the default, express install and passed html options. htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions); // Invoke $block (with a copy of the merged html options) for each element. return this.each(function(){ block.call(this, $$.copy(htmlOptions)); }); }; /** * * @name flash.copy * @desc Copy an arbitrary number of objects into a new object. * @type Object * * @example $$.copy({ foo: 1 }, { bar: 2 }); * @result { foo: 1, bar: 2 }; * **/ $$.copy = function() { var options = {}, flashvars = {}; for(var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if(arg == undefined) continue; jQuery.extend(options, arg); // don't clobber one flash vars object with another // merge them instead if(arg.flashvars == undefined) continue; jQuery.extend(flashvars, arg.flashvars); } options.flashvars = flashvars; return options; }; /* * @name flash.hasFlash * @desc Check if a specific version of the Flash plugin is installed * @type Boolean * **/ $$.hasFlash = function() { // look for a flag in the query string to bypass flash detection if(/hasFlash\=true/.test(location)) return true; if(/hasFlash\=false/.test(location)) return false; var pv = $$.hasFlash.playerVersion().match(/\d+/g); var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g); for(var i = 0; i < 3; i++) { pv[i] = parseInt(pv[i] || 0); rv[i] = parseInt(rv[i] || 0); // player is less than required if(pv[i] < rv[i]) return false; // player is greater than required if(pv[i] > rv[i]) return true; } // major version, minor version and revision match exactly return true; }; /** * * @name flash.hasFlash.playerVersion * @desc Get the version of the installed Flash plugin. * @type String * **/ $$.hasFlash.playerVersion = function() { // ie try { try { // avoid fp6 minor version lookup issues // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); try { axo.AllowScriptAccess = 'always'; } catch(e) { return '6,0,0'; } } catch(e) {} return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1]; // other browsers } catch(e) { try { if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]; } } catch(e) {} } return '0,0,0'; }; /** * * @name flash.htmlOptions * @desc The default set of options for the object or embed tag. * **/ $$.htmlOptions = { height: 240, flashvars: {}, pluginspage: 'http://www.adobe.com/go/getflashplayer', src: '#', type: 'application/x-shockwave-flash', width: 320 }; /** * * @name flash.pluginOptions * @desc The default set of options for checking/updating the flash Plugin. * **/ $$.pluginOptions = { expressInstall: false, update: true, version: '6.0.65' }; /** * * @name flash.replace * @desc The default method for replacing an element with a Flash movie. * **/ $$.replace = function(htmlOptions) { this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>'; jQuery(this) .addClass('flash-replaced') .prepend($$.transform(htmlOptions)); }; /** * * @name flash.update * @desc The default method for replacing an element with an update message. * **/ $$.update = function(htmlOptions) { var url = String(location).split('?'); url.splice(1,0,'?hasFlash=true&'); url = url.join(''); var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>'; this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>'; jQuery(this) .addClass('flash-update') .prepend(msg); }; /** * * @desc Convert a hash of html options to a string of attributes, using Function.apply(). * @example toAttributeString.apply(htmlOptions) * @result foo="bar" foo="bar" * **/ function toAttributeString() { var s = ''; for(var key in this) if(typeof this[key] != 'function') s += key+'="'+this[key]+'" '; return s; }; /** * * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). * @example toFlashvarsString.apply(flashvarsObject) * @result foo=bar&foo=bar * **/ function toFlashvarsString() { var s = ''; for(var key in this) if(typeof this[key] != 'function') s += key+'='+encodeURIComponent(this[key])+'&'; return s.replace(/&$/, ''); }; /** * * @name flash.transform * @desc Transform a set of html options into an embed tag. * @type String * * @example $$.transform(htmlOptions) * @result <embed src="foo.swf" ... /> * * Note: The embed tag is NOT standards-compliant, but it * works in all current browsers. flash.transform can be * overwritten with a custom function to generate more * standards-compliant markup. * **/ $$.transform = function(htmlOptions) { htmlOptions.toString = toAttributeString; if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString; return '<embed ' + String(htmlOptions) + '/>'; }; /** * * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/) * **/ if (window.attachEvent) { window.attachEvent("onbeforeunload", function(){ __flash_unloadHandler = function() {}; __flash_savedUnloadHandler = function() {}; }); } })();
JavaScript
/*jslint browser: true */ /*global jQuery: true */ /** * jQuery Cookie plugin * * Copyright (c) 2010 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ // TODO JsDoc /** * Create a cookie with the given key and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String key The key of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given key. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String key The key of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function (key, value, options) { // key and value given, set cookie... if (arguments.length > 1 && (value === null || typeof value !== "object")) { options = jQuery.extend({}, options); if (value === null) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } return (document.cookie = [ encodeURIComponent(key), '=', options.raw ? String(value) : encodeURIComponent(String(value)), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // key and possibly options given, get cookie... options = value || {}; var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; };
JavaScript
/* * jQuery.upload v1.0.2 * * Copyright (c) 2010 lagos * Dual licensed under the MIT and GPL licenses. * * http://lagoscript.org */ (function($) { var uuid = 0; $.fn.upload = function(url, data, callback, type) { var self = this, inputs, checkbox, checked, iframeName = 'jquery_upload' + ++uuid, iframe = $('<iframe name="' + iframeName + '" style="position:absolute;top:-9999px" />').appendTo('body'), form = '<form target="' + iframeName + '" method="post" enctype="multipart/form-data" />'; if ($.isFunction(data)) { type = callback; callback = data; data = {}; } checkbox = $('input:checkbox', this); checked = $('input:checked', this); form = self.wrapAll(form).parent('form').attr('action', url); // Make sure radios and checkboxes keep original values // (IE resets checkd attributes when appending) checkbox.removeAttr('checked'); checked.attr('checked', true); inputs = createInputs(data); inputs = inputs ? $(inputs).appendTo(form) : null; form.submit(function() { iframe.load(function() { var data = handleData(this, type), checked = $('input:checked', self); form.after(self).remove(); checkbox.removeAttr('checked'); checked.attr('checked', true); if (inputs) { inputs.remove(); } setTimeout(function() { iframe.remove(); if (type === 'script') { $.globalEval(data); } if (callback) { callback.call(self, data); } }, 0); }); }).submit(); return this; }; function createInputs(data) { return $.map(param(data), function(param) { return '<input type="hidden" name="' + param.name + '" value="' + param.value + '"/>'; }).join(''); } function param(data) { if ($.isArray(data)) { return data; } var params = []; function add(name, value) { params.push({name:name, value:value}); } if (typeof data === 'object') { $.each(data, function(name) { if ($.isArray(this)) { $.each(this, function() { add(name, this); }); } else { add(name, $.isFunction(this) ? this() : this); } }); } else if (typeof data === 'string') { $.each(data.split('&'), function() { var param = $.map(this.split('='), function(v) { return decodeURIComponent(v.replace(/\+/g, ' ')); }); add(param[0], param[1]); }); } return params; } function handleData(iframe, type) { var data, contents = $(iframe).contents().get(0); if ($.isXMLDoc(contents) || contents.XMLDocument) { return contents.XMLDocument || contents; } data = $(contents).find('body').html(); switch (type) { case 'xml': data = parseXml(data); break; case 'json': data = window.eval('(' + data + ')'); break; } return data; } function parseXml(text) { if (window.DOMParser) { return new DOMParser().parseFromString(text, 'application/xml'); } else { var xml = new ActiveXObject('Microsoft.XMLDOM'); xml.async = false; xml.loadXML(text); return xml; } } })(jQuery);
JavaScript
jQuery.autocomplete = function(input, options) { // Create a link to self var me = this; // Create jQuery object for input element var $input = $(input).attr("autocomplete", "off"); // Apply inputClass if necessary if (options.inputClass) $input.addClass(options.inputClass); // Create results var results = document.createElement("div"); // Create jQuery object for results var $results = $(results); $results.hide().addClass(options.resultsClass).css("position", "absolute"); if( options.width > 0 ) $results.css("width", options.width); // Add to body element $("body").append(results); input.autocompleter = me; var timeout = null; var prev = ""; var active = -1; var cache = {}; var keyb = false; var hasFocus = false; var lastKeyPressCode = null; // flush cache function flushCache(){ cache = {}; cache.data = {}; cache.length = 0; }; // flush cache flushCache(); // if there is a data array supplied if( options.data != null ){ var sFirstChar = "", stMatchSets = {}, row = []; // no url was specified, we need to adjust the cache length to make sure it fits the local data store if( typeof options.url != "string" ) options.cacheLength = 1; // loop through the array and create a lookup structure for( var i=0; i < options.data.length; i++ ){ // if row is a string, make an array otherwise just reference the array row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]); // if the length is zero, don't add to list if( row[0].length > 0 ){ // get the first character sFirstChar = row[0].substring(0, 1).toLowerCase(); // if no lookup array for this character exists, look it up now if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = []; // if the match is a string stMatchSets[sFirstChar].push(row); } } // add the data items to the cache for( var k in stMatchSets ){ // increase the cache size options.cacheLength++; // add to the cache addToCache(k, stMatchSets[k]); } } $input .keydown(function(e) { // track last key pressed lastKeyPressCode = e.keyCode; switch(e.keyCode) { case 38: // up e.preventDefault(); moveSelect(-1); break; case 40: // down e.preventDefault(); moveSelect(1); break; case 9: // tab case 13: // return if( selectCurrent() ){ // make sure to blur off the current field $input.get(0).blur(); e.preventDefault(); } break; default: active = -1; if (timeout) clearTimeout(timeout); timeout = setTimeout(function(){onChange();}, options.delay); break; } }) .focus(function(){ // track whether the field has focus, we shouldn't process any results if the field no longer has focus hasFocus = true; }) .blur(function() { // track whether the field has focus hasFocus = false; hideResults(); }); hideResultsNow(); function onChange() { // ignore if the following keys are pressed: [del] [shift] [capslock] if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide(); var v = $input.val(); if (v == prev) return; prev = v; if (v.length >= options.minChars) { $input.addClass(options.loadingClass); requestData(v); } else { $input.removeClass(options.loadingClass); $results.hide(); } }; function moveSelect(step) { var lis = $("li", results); if (!lis) return; active += step; if (active < 0) { active = 0; } else if (active >= lis.size()) { active = lis.size() - 1; } lis.removeClass("ac_over"); $(lis[active]).addClass("ac_over"); // Weird behaviour in IE // if (lis[active] && lis[active].scrollIntoView) { // lis[active].scrollIntoView(false); // } }; function selectCurrent() { var li = $("li.ac_over", results)[0]; if (!li) { var $li = $("li", results); if (options.selectOnly) { if ($li.length == 1) li = $li[0]; } else if (options.selectFirst) { li = $li[0]; } } if (li) { selectItem(li); return true; } else { return false; } }; function selectItem(li) { if (!li) { li = document.createElement("li"); li.extra = []; li.selectValue = ""; } var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML); input.lastSelected = v; prev = v; $results.html(""); $input.val(v); hideResultsNow(); if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1); }; // selects a portion of the input string function createSelection(start, end){ // get a reference to the input element var field = $input.get(0); if( field.createTextRange ){ var selRange = field.createTextRange(); selRange.collapse(true); selRange.moveStart("character", start); selRange.moveEnd("character", end); selRange.select(); } else if( field.setSelectionRange ){ field.setSelectionRange(start, end); } else { if( field.selectionStart ){ field.selectionStart = start; field.selectionEnd = end; } } field.focus(); }; // fills in the input box w/the first match (assumed to be the best match) function autoFill(sValue){ // if the last user key pressed was backspace, don't autofill if( lastKeyPressCode != 8 ){ // fill in the value (keep the case the user has typed) $input.val($input.val() + sValue.substring(prev.length)); // select the portion of the value not typed by the user (so the next character will erase) createSelection(prev.length, sValue.length); } }; function showResults() { // get the position of the input field right now (in case the DOM is shifted) var pos = findPos(input); // either use the specified width, or autocalculate based on form element var iWidth = (options.width > 0) ? options.width : $input.width(); // reposition $results.css({ width: parseInt(iWidth) + "px", top: (pos.y + input.offsetHeight) + "px", left: pos.x + "px" }).show(); }; function hideResults() { if (timeout) clearTimeout(timeout); timeout = setTimeout(hideResultsNow, 200); }; function hideResultsNow() { if (timeout) clearTimeout(timeout); $input.removeClass(options.loadingClass); if ($results.is(":visible")) { $results.hide(); } if (options.mustMatch) { var v = $input.val(); if (v != input.lastSelected) { selectItem(null); } } }; function receiveData(q, data) { if (data) { $input.removeClass(options.loadingClass); results.innerHTML = ""; // if the field no longer has focus or if there are no matches, do not display the drop down if( !hasFocus || data.length == 0 ) return hideResultsNow(); if ($.browser.msie) { // we put a styled iframe behind the calendar so HTML SELECT elements don't show through $results.append(document.createElement('iframe')); } results.appendChild(dataToDom(data)); // autofill in the complete box w/the first match as long as the user hasn't entered in more data if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]); showResults(); } else { hideResultsNow(); } }; function parseData(data) { if (!data) return null; var parsed = []; var rows = data.split(options.lineSeparator); for (var i=0; i < rows.length; i++) { var row = $.trim(rows[i]); if (row) { parsed[parsed.length] = row.split(options.cellSeparator); } } return parsed; }; function dataToDom(data) { var ul = document.createElement("ul"); var num = data.length; // limited results to a max number if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow; for (var i=0; i < num; i++) { var row = data[i]; if (!row) continue; var li = document.createElement("li"); if (options.formatItem) { li.innerHTML = options.formatItem(row, i, num); li.selectValue = row[0]; } else { li.innerHTML = row[0]; li.selectValue = row[0]; } var extra = null; if (row.length > 1) { extra = []; for (var j=1; j < row.length; j++) { extra[extra.length] = row[j]; } } li.extra = extra; ul.appendChild(li); $(li).hover( function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); }, function() { $(this).removeClass("ac_over"); } ).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) }); } return ul; }; function requestData(q) { if (!options.matchCase) q = q.toLowerCase(); var data = options.cacheLength ? loadFromCache(q) : null; // recieve the cached data if (data) { receiveData(q, data); // if an AJAX url has been supplied, try loading the data now } else if( (typeof options.url == "string") && (options.url.length > 0) ){ $.get(makeUrl(q), function(data) { data = parseData(data); addToCache(q, data); receiveData(q, data); }); // if there's been no data found, remove the loading class } else { $input.removeClass(options.loadingClass); } }; function makeUrl(q) { var url = options.url + "&q=" + encodeURI(q); for (var i in options.extraParams) { url += "&" + i + "=" + encodeURI(options.extraParams[i]); } return url; }; function loadFromCache(q) { if (!q) return null; if (cache.data[q]) return cache.data[q]; if (options.matchSubset) { for (var i = q.length - 1; i >= options.minChars; i--) { var qs = q.substr(0, i); var c = cache.data[qs]; if (c) { var csub = []; for (var j = 0; j < c.length; j++) { var x = c[j]; var x0 = x[0]; if (matchSubset(x0, q)) { csub[csub.length] = x; } } return csub; } } } return null; }; function matchSubset(s, sub) { if (!options.matchCase) s = s.toLowerCase(); var i = s.indexOf(sub); if (i == -1) return false; return i == 0 || options.matchContains; }; this.flushCache = function() { flushCache(); }; this.setExtraParams = function(p) { options.extraParams = p; }; this.findValue = function(){ var q = $input.val(); if (!options.matchCase) q = q.toLowerCase(); var data = options.cacheLength ? loadFromCache(q) : null; if (data) { findValueCallback(q, data); } else if( (typeof options.url == "string") && (options.url.length > 0) ){ $.get(makeUrl(q), function(data) { data = parseData(data) addToCache(q, data); findValueCallback(q, data); }); } else { // no matches findValueCallback(q, null); } } function findValueCallback(q, data){ if (data) $input.removeClass(options.loadingClass); var num = (data) ? data.length : 0; var li = null; for (var i=0; i < num; i++) { var row = data[i]; if( row[0].toLowerCase() == q.toLowerCase() ){ li = document.createElement("li"); if (options.formatItem) { li.innerHTML = options.formatItem(row, i, num); li.selectValue = row[0]; } else { li.innerHTML = row[0]; li.selectValue = row[0]; } var extra = null; if( row.length > 1 ){ extra = []; for (var j=1; j < row.length; j++) { extra[extra.length] = row[j]; } } li.extra = extra; } } if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1); } function addToCache(q, data) { if (!data || !q || !options.cacheLength) return; if (!cache.length || cache.length > options.cacheLength) { flushCache(); cache.length++; } else if (!cache[q]) { cache.length++; } cache.data[q] = data; }; function findPos(obj) { var curleft = obj.offsetLeft || 0; var curtop = obj.offsetTop || 0; while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } return {x:curleft,y:curtop}; } } jQuery.fn.autocomplete = function(url, options, data) { // Make sure options exists options = options || {}; // Set url as option options.url = url; // set some bulk local data options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null; // Set default values for required options options.inputClass = options.inputClass || "ac_input"; options.resultsClass = options.resultsClass || "ac_results"; options.lineSeparator = options.lineSeparator || "\n"; options.cellSeparator = options.cellSeparator || "|"; options.minChars = options.minChars || 1; options.delay = options.delay || 400; options.matchCase = options.matchCase || 0; options.matchSubset = options.matchSubset || 1; options.matchContains = options.matchContains || 0; options.cacheLength = options.cacheLength || 1; options.mustMatch = options.mustMatch || 0; options.extraParams = options.extraParams || {}; options.loadingClass = options.loadingClass || "ac_loading"; options.selectFirst = options.selectFirst || false; options.selectOnly = options.selectOnly || false; options.maxItemsToShow = options.maxItemsToShow || -1; options.autoFill = options.autoFill || false; options.width = parseInt(options.width, 10) || 0; this.each(function() { var input = this; new jQuery.autocomplete(input, options); }); // Don't break the chain return this; } jQuery.fn.autocompleteArray = function(data, options) { return this.autocomplete(null, options, data); } jQuery.fn.indexOf = function(e){ for( var i=0; i<this.length; i++ ){ if( this[i] == e ) return i; } return -1; };
JavaScript
/* * jQuery selectbox plugin * * Copyright (c) 2007 Sadri Sahraoui (brainfault.com) * Licensed under the GPL license and MIT: * http://www.opensource.org/licenses/GPL-license.php * http://www.opensource.org/licenses/mit-license.php * * The code is inspired from Autocomplete plugin (http://www.dyve.net/jquery/?autocomplete) * * Revision: $Id$ * Version: 1.2 * * Changelog : * Version 1.2 By Guillaume Vergnolle (web-opensource.com) * - Add optgroup support * - possibility to choose between span or input as replacement of the select box * - support for jquery change event * - add a max height option for drop down list * Version 1.1 * - Fix IE bug * Version 1.0 * - Support jQuery noConflict option * - Add callback for onChange event, thanks to Jason * - Fix IE8 support * - Fix auto width support * - Fix focus on firefox dont show the carret * Version 0.6 * - Fix IE scrolling problem * Version 0.5 * - separate css style for current selected element and hover element which solve the highlight issue * Version 0.4 * - Fix width when the select is in a hidden div @Pawel Maziarz * - Add a unique id for generated li to avoid conflict with other selects and empty values @Pawel Maziarz */ jQuery.fn.extend({ selectbox: function(options) { return this.each(function() { new jQuery.SelectBox(this, options); }); } }); /* pawel maziarz: work around for ie logging */ if (!window.console) { var console = { log: function(msg) { } } } /* */ jQuery.SelectBox = function(selectobj, options) { var opt = options || {}; opt.inputType = opt.inputType || "input"; opt.inputClass = opt.inputClass || "selectbox"; opt.containerClass = opt.containerClass || "selectbox-wrapper"; opt.hoverClass = opt.hoverClass || "current"; opt.currentClass = opt.currentClass || "selected"; opt.groupClass = opt.groupClass || "groupname"; //css class for group opt.maxHeight = opt.maxHeight || 200; // max height of dropdown list opt.loopnoStep = opt.loopnoStep || false; // to remove the step in list moves loop opt.onChangeCallback = opt.onChangeCallback || false; opt.onChangeParams = opt.onChangeParams || false; opt.debug = opt.debug || false; var elm_id = selectobj.id; var active = 0; var inFocus = false; var hasfocus = 0; //jquery object for select element var $select = jQuery(selectobj); // jquery container object var $container = setupContainer(opt); //jquery input object var $input = setupInput(opt); // hide select and append newly created elements $select.hide().before($input).before($container); init(); $input .click(function(){ if (!inFocus) { $container.toggle(); } }) .focus(function(){ if ($container.not(':visible')) { inFocus = true; $container.show(); } }) .keydown(function(event) { switch(event.keyCode) { case 38: // up event.preventDefault(); moveSelect(-1); break; case 40: // down event.preventDefault(); moveSelect(1); break; //case 9: // tab case 13: // return event.preventDefault(); // seems not working in mac ! $('li.'+opt.hoverClass).trigger('click'); break; case 27: //escape hideMe(); break; } }) .blur(function() { if ($container.is(':visible') && hasfocus > 0 ) { if(opt.debug) console.log('container visible and has focus') } else { // Workaround for ie scroll - thanks to Bernd Matzner if((jQuery.browser.msie && jQuery.browser.version.substr(0,1) < 8) || jQuery.browser.safari){ // check for safari too - workaround for webkit if(document.activeElement.getAttribute('id').indexOf('_container')==-1){ hideMe(); } else { $input.focus(); } } else { hideMe(); } } }); function hideMe() { hasfocus = 0; $container.hide(); } function init() { $container.append(getSelectOptions($input.attr('id'))).hide(); var width = $input.css('width'); if($container.height() > opt.maxHeight){ $container.width(parseInt(width)+parseInt($input.css('paddingRight'))+parseInt($input.css('paddingLeft'))); $container.height(opt.maxHeight); } else $container.width(width); } function setupContainer(options) { var container = document.createElement("div"); $container = jQuery(container); $container.attr('id', elm_id+'_container'); $container.addClass(options.containerClass); $container.css('display', 'none'); return $container; } function setupInput(options) { if(opt.inputType == "span"){ var input = document.createElement("span"); var $input = jQuery(input); $input.attr("id", elm_id+"_input"); $input.addClass(options.inputClass); $input.attr("tabIndex", $select.attr("tabindex")); } else { var input = document.createElement("input"); var $input = jQuery(input); $input.attr("id", elm_id+"_input"); $input.attr("type", "text"); $input.addClass(options.inputClass); $input.attr("autocomplete", "off"); $input.attr("readonly", "readonly"); $input.attr("tabIndex", $select.attr("tabindex")); // "I" capital is important for ie $input.css("width", $select.css("width")); } return $input; } function moveSelect(step) { var lis = jQuery("li", $container); if (!lis || lis.length == 0) return false; // find the first non-group (first option) firstchoice = 0; while($(lis[firstchoice]).hasClass(opt.groupClass)) firstchoice++; active += step; // if we are on a group step one more time if($(lis[active]).hasClass(opt.groupClass)) active += step; //loop through list from the first possible option if (active < firstchoice) { (opt.loopnoStep ? active = lis.size()-1 : active = lis.size() ); } else if (opt.loopnoStep && active > lis.size()-1) { active = firstchoice; } else if (active > lis.size()) { active = firstchoice; } scroll(lis, active); lis.removeClass(opt.hoverClass); jQuery(lis[active]).addClass(opt.hoverClass); } function scroll(list, active) { var el = jQuery(list[active]).get(0); var list = $container.get(0); if (el.offsetTop + el.offsetHeight > list.scrollTop + list.clientHeight) { list.scrollTop = el.offsetTop + el.offsetHeight - list.clientHeight; } else if(el.offsetTop < list.scrollTop) { list.scrollTop = el.offsetTop; } } function setCurrent() { var li = jQuery("li."+opt.currentClass, $container).get(0); var ar = (''+li.id).split('_'); var el = ar[ar.length-1]; if (opt.onChangeCallback){ $select.get(0).selectedIndex = $('li', $container).index(li); opt.onChangeParams = { selectedVal : $select.val() }; opt.onChangeCallback(opt.onChangeParams); } else { $select.val(el); $select.change(); } if(opt.inputType == 'span') $input.html($(li).html()); else $input.val($(li).html()); return true; } // select value function getCurrentSelected() { return $select.val(); } // input value function getCurrentValue() { return $input.val(); } function getSelectOptions(parentid) { var select_options = new Array(); var ul = document.createElement('ul'); select_options = $select.children('option'); if(select_options.length == 0) { var select_optgroups = new Array(); select_optgroups = $select.children('optgroup'); for(x=0;x<select_optgroups.length;x++){ select_options = $("#"+select_optgroups[x].id).children('option'); var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); li.innerHTML = $("#"+select_optgroups[x].id).attr('label'); li.className = opt.groupClass; ul.appendChild(li); select_options.each(function() { var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); li.innerHTML = $(this).html(); if ($(this).is(':selected')) { $input.html($(this).html()); $(li).addClass(opt.currentClass); } ul.appendChild(li); $(li) .mouseover(function(event) { hasfocus = 1; if (opt.debug) console.log('over on : '+this.id); jQuery(event.target, $container).addClass(opt.hoverClass); }) .mouseout(function(event) { hasfocus = -1; if (opt.debug) console.log('out on : '+this.id); jQuery(event.target, $container).removeClass(opt.hoverClass); }) .click(function(event) { var fl = $('li.'+opt.hoverClass, $container).get(0); if (opt.debug) console.log('click on :'+this.id); $('li.'+opt.currentClass, $container).removeClass(opt.currentClass); $(this).addClass(opt.currentClass); setCurrent(); $select.get(0).blur(); hideMe(); }); }); } } else select_options.each(function() { var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); li.innerHTML = $(this).html(); if ($(this).is(':selected')) { $input.val($(this).html()); $(li).addClass(opt.currentClass); } ul.appendChild(li); $(li) .mouseover(function(event) { hasfocus = 1; if (opt.debug) console.log('over on : '+this.id); jQuery(event.target, $container).addClass(opt.hoverClass); }) .mouseout(function(event) { hasfocus = -1; if (opt.debug) console.log('out on : '+this.id); jQuery(event.target, $container).removeClass(opt.hoverClass); }) .click(function(event) { var fl = $('li.'+opt.hoverClass, $container).get(0); if (opt.debug) console.log('click on :'+this.id); $('li.'+opt.currentClass, $container).removeClass(opt.currentClass); $(this).addClass(opt.currentClass); setCurrent(); $select.get(0).blur(); hideMe(); }); }); return ul; } };
JavaScript