2009-06-11 17:43:45 +00:00
/ *
2011-07-30 05:22:57 -03:00
* Copyright [ 2011 ] [ wisemapping ]
*
* Licensed under WiseMapping Public License , Version 1.0 ( the "License" ) .
* It is basically the Apache License , Version 2.0 ( the "License" ) plus the
* "powered by wisemapping" text requirement on every single page ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the license at
*
* http : //www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
2009-06-11 17:43:45 +00:00
* /
2011-07-30 05:22:57 -03:00
Asset . javascript ( '../js/mindplot.svg.js' , {
id : 'MindplotSVGLib' ,
onLoad : function ( ) {
afterMindpotLibraryLoading ( ) ;
}
} ) ;
2009-06-07 18:59:43 +00:00
var designer = null ;
/* JavaScript tabs changer */
// CSS helper functions
CSS = {
// Adds a class to an element.
AddClass : function ( e , c ) {
if ( ! e . className . match ( new RegExp ( "\\b" + c + "\\b" , "i" ) ) )
e . className += ( e . className ? " " : "" ) + c ;
} ,
// Removes a class from an element.
RemoveClass : function ( e , c ) {
e . className = e . className . replace ( new RegExp ( " \\b" + c + "\\b|\\b" + c + "\\b ?" , "gi" ) , "" ) ;
}
} ;
// Functions for handling tabs.
Tabs = {
// Changes to the tab with the specified ID.
GoTo : function ( contentId , skipReplace ) {
// This variable will be true if a tab for the specified
// content ID was found.
var foundTab = false ;
// Get the TOC element.
var toc = $ ( "toc" ) ;
if ( toc ) {
var lis = toc . getElementsByTagName ( "li" ) ;
for ( var j = 0 ; j < lis . length ; j ++ ) {
var li = lis [ j ] ;
// Give the current tab link the class "current" and
// remove the class from any other TOC links.
var anchors = li . getElementsByTagName ( "a" ) ;
var anchors = li . getElementsByTagName ( "a" ) ;
for ( var k = 0 ; k < anchors . length ; k ++ ) {
if ( anchors [ k ] . hash == "#" + contentId ) {
CSS . AddClass ( li , "current" ) ;
foundTab = true ;
break ;
} else {
CSS . RemoveClass ( li , "current" ) ;
}
}
}
}
// Show the content with the specified ID.
var divsToHide = [ ] ;
var divs = document . getElementsByTagName ( "div" ) ;
for ( var i = 0 ; i < divs . length ; i ++ ) {
var div = divs [ i ] ;
if ( div . className . match ( /\btabContent\b/i ) ) {
if ( div . id == "_" + contentId )
div . style . display = "block" ;
2011-07-30 05:22:57 -03:00
else {
2009-06-07 18:59:43 +00:00
divsToHide . push ( div ) ;
}
}
}
// Hide the other content boxes.
for ( var i = 0 ; i < divsToHide . length ; i ++ )
divsToHide [ i ] . style . display = "none" ;
// Change the address bar.
if ( ! skipReplace ) window . location . replace ( "#" + contentId ) ;
} ,
OnClickHandler : function ( e ) {
// Stop the event (to stop it from scrolling or
// making an entry in the history).
if ( ! e ) e = window . event ;
if ( e . preventDefault ) e . preventDefault ( ) ; else e . returnValue = false ;
// Get the name of the anchor of the link that was clicked.
Tabs . GoTo ( this . hash . substring ( 1 ) ) ;
} ,
Init : function ( ) {
2011-07-30 05:22:57 -03:00
if ( ! document . getElementsByTagName ) {
2009-06-07 18:59:43 +00:00
return ;
}
// Attach an onclick event to all the anchor links on the page.
var anchors = document . getElementsByTagName ( "a" ) ;
for ( var i = 0 ; i < anchors . length ; i ++ ) {
var a = anchors [ i ] ;
if ( a . hash ) {
a . onclick = Tabs . OnClickHandler ;
}
}
var contentId ;
if ( window . location . hash )
contentId = window . location . hash . substring ( 1 ) ;
var divs = document . getElementsByTagName ( "div" ) ;
for ( var i = 0 ; i < divs . length ; i ++ ) {
var div = divs [ i ] ;
if ( div . className . match ( /\btabContent\b/i ) ) {
if ( ! contentId ) contentId = div . id ;
div . id = "_" + div . id ;
}
}
if ( contentId )
Tabs . GoTo ( contentId , true ) ;
}
} ;
if ( document . createStyleSheet ) {
var style = document . createStyleSheet ( ) ;
style . addRule ( "div.tabContent" , "display: none;" ) ;
style . addRule ( "div" + contentId , "display: block;" ) ;
} else {
var head = document . getElementsByTagName ( "head" ) [ 0 ] ;
if ( head ) {
var style = document . createElement ( "style" ) ;
style . setAttribute ( "type" , "text/css" ) ;
style . appendChild ( document . createTextNode ( "div.tabContent { display: none; }" ) ) ;
style . appendChild ( document . createTextNode ( "div" + contentId + " { display: block; }" ) ) ;
head . appendChild ( style ) ;
}
}
// Hook up the OnLoad event to the tab initialization function.
Tabs . Init ( ) ;
// Hide the content while waiting for the onload event to trigger.
var contentId = window . location . hash || "#Introduction" ;
var iconPanel = null ;
2011-07-30 05:22:57 -03:00
function afterMindpotLibraryLoading ( ) {
2009-06-07 18:59:43 +00:00
buildMindmapDesigner ( ) ;
2011-07-30 05:22:57 -03:00
if ( $ ( 'helpButton' ) != null ) {
2009-06-07 18:59:43 +00:00
var helpPanel = new Panel ( { panelButton : $ ( 'helpButton' ) , backgroundColor : 'black' } ) ;
helpPanel . setContent ( Help . buildHelp ( helpPanel ) ) ;
}
2011-07-30 05:22:57 -03:00
if ( $ ( 'helpButtonFirstSteps' ) != null ) {
2009-06-07 18:59:43 +00:00
var firstStepsPanel = $ ( 'helpButtonFirstSteps' )
firstStepsPanel . addEvent ( 'click' , function ( event ) {
var firstStepWindow = window . open ( "firststeps.htm" , "WiseMapping" , "width=100px, height=100px" ) ;
firstStepWindow . focus ( ) ;
firstStepWindow . moveTo ( 0 , 0 ) ;
firstStepWindow . resizeTo ( screen . availWidth , screen . availHeight ) ;
} ) ;
2011-03-28 01:33:16 -03:00
}
2009-06-07 18:59:43 +00:00
2011-07-30 05:22:57 -03:00
if ( $ ( 'helpButtonKeyboard' ) != null ) {
2009-06-07 18:59:43 +00:00
var keyboardPanel = $ ( 'helpButtonKeyboard' )
keyboardPanel . addEvent ( 'click' , function ( event ) {
MOOdalBox . open ( 'keyboard.htm' , 'KeyBoard Shortcuts' , '500px 400px' , false )
} ) ;
}
2011-08-07 18:59:20 -03:00
// Crate icon panel dialog ...
iconPanel = new mindplot . widget . IconPanel ( { button : $ ( 'topicIcon' ) , onStart : cleanScreenEvent } ) ;
iconPanel . addEvent ( "selected" , function ( event ) {
designer . addIconType2SelectedNode ( event . iconType ) ;
} ) ;
2009-06-07 18:59:43 +00:00
// Register Events ...
$ ( document ) . addEvent ( 'keydown' , designer . keyEventHandler . bindWithEvent ( designer ) ) ;
$ ( "ffoxWorkarroundInput" ) . addEvent ( 'keydown' , designer . keyEventHandler . bindWithEvent ( designer ) ) ;
//
$ ( 'zoomIn' ) . addEvent ( 'click' , function ( event ) {
designer . zoomIn ( ) ;
} ) ;
$ ( 'zoomOut' ) . addEvent ( 'click' , function ( event ) {
designer . zoomOut ( ) ;
} ) ;
$ ( 'undoEdition' ) . addEvent ( 'click' , function ( event ) {
designer . undo ( ) ;
} ) ;
$ ( 'redoEdition' ) . addEvent ( 'click' , function ( event ) {
designer . redo ( ) ;
} ) ;
2011-08-04 22:12:53 -03:00
designer . addEventListener ( "modelUpdate" , function ( event ) {
2011-07-30 05:22:57 -03:00
if ( event . undoSteps > 0 ) {
2009-06-07 18:59:43 +00:00
$ ( "undoEdition" ) . setStyle ( "background-image" , "url(../images/file_undo.png)" ) ;
2011-07-30 05:22:57 -03:00
} else {
2009-06-07 18:59:43 +00:00
$ ( "undoEdition" ) . setStyle ( "background-image" , "url(../images/file_undo_dis.png)" ) ;
}
2011-07-30 05:22:57 -03:00
if ( event . redoSteps > 0 ) {
2009-06-07 18:59:43 +00:00
$ ( "redoEdition" ) . setStyle ( "background-image" , "url(../images/file_redo.png)" ) ;
2011-07-30 05:22:57 -03:00
} else {
2009-06-07 18:59:43 +00:00
$ ( "redoEdition" ) . setStyle ( "background-image" , "url(../images/file_redo_dis.png)" ) ;
}
} ) ;
$ ( 'addTopic' ) . addEvent ( 'click' , function ( event ) {
designer . createSiblingForSelectedNode ( ) ;
} ) ;
2011-08-04 22:12:53 -03:00
2009-06-07 18:59:43 +00:00
$ ( 'deleteTopic' ) . addEvent ( 'click' , function ( event ) {
designer . deleteCurrentNode ( ) ;
} ) ;
2011-08-05 01:06:56 -03:00
2009-06-07 18:59:43 +00:00
var context = this ;
2011-01-23 17:27:03 -03:00
var colorPicker1 = new MooRainbow ( 'topicColor' , {
2009-06-07 18:59:43 +00:00
id : 'topicColor' ,
imgPath : '../images/' ,
startColor : [ 255 , 255 , 255 ] ,
onInit : function ( color ) {
cleanScreenEvent . bind ( context ) . attempt ( ) ;
setCurrentColorPicker . attempt ( colorPicker1 , context ) ;
} ,
onChange : function ( color ) {
designer . setBackColor2SelectedNode ( color . hex ) ;
} ,
onComplete : function ( color ) {
removeCurrentColorPicker . attempt ( colorPicker1 , context ) ;
}
} ) ;
2011-08-05 01:06:56 -03:00
2009-06-07 18:59:43 +00:00
var colorPicker2 = new MooRainbow ( 'topicBorder' , {
id : 'topicBorder' ,
imgPath : '../images/' ,
startColor : [ 255 , 255 , 255 ] ,
onInit : function ( color ) {
cleanScreenEvent . bind ( context ) . attempt ( ) ;
setCurrentColorPicker . attempt ( colorPicker2 , context ) ;
} ,
onChange : function ( color ) {
designer . setBorderColor2SelectedNode ( color . hex ) ;
} ,
onComplete : function ( color ) {
removeCurrentColorPicker . attempt ( colorPicker2 , context ) ;
}
2011-01-23 17:27:03 -03:00
} ) ;
2011-08-05 01:06:56 -03:00
2009-06-07 18:59:43 +00:00
$ ( 'topicLink' ) . addEvent ( 'click' , function ( event ) {
designer . addLink2SelectedNode ( ) ;
} ) ;
2010-12-13 11:07:20 -03:00
$ ( 'topicRelation' ) . addEvent ( 'click' , function ( event ) {
designer . addRelationShip2SelectedNode ( event ) ;
} ) ;
2009-06-07 18:59:43 +00:00
$ ( 'topicNote' ) . addEvent ( 'click' , function ( event ) {
designer . addNote2SelectedNode ( ) ;
} ) ;
$ ( 'fontBold' ) . addEvent ( 'click' , function ( event ) {
designer . setWeight2SelectedNode ( ) ;
} ) ;
$ ( 'fontItalic' ) . addEvent ( 'click' , function ( event ) {
designer . setStyle2SelectedNode ( ) ;
} ) ;
2011-01-23 17:27:03 -03:00
var colorPicker3 = new MooRainbow ( 'fontColor' , {
2009-06-07 18:59:43 +00:00
id : 'fontColor' ,
imgPath : '../images/' ,
startColor : [ 255 , 255 , 255 ] ,
onInit : function ( color ) {
cleanScreenEvent . bind ( context ) . attempt ( ) ;
setCurrentColorPicker . attempt ( colorPicker3 , context ) ;
} ,
onChange : function ( color ) {
designer . setFontColor2SelectedNode ( color . hex ) ;
} ,
onComplete : function ( color ) {
removeCurrentColorPicker . attempt ( colorPicker3 , context ) ;
}
2011-01-23 17:27:03 -03:00
} ) ;
2009-06-07 18:59:43 +00:00
// Save event handler ....
var saveButton = $ ( 'saveButton' ) ;
saveButton . addEvent ( 'click' , function ( event ) {
2011-07-30 05:22:57 -03:00
if ( ! isTryMode ) {
2009-06-07 18:59:43 +00:00
saveButton . setStyle ( 'cursor' , 'wait' ) ;
2011-07-30 05:22:57 -03:00
var saveFunc = function ( ) {
designer . save ( function ( ) {
2009-06-07 18:59:43 +00:00
var monitor = core . Monitor . getInstance ( ) ;
monitor . logMessage ( 'Save completed successfully' ) ;
saveButton . setStyle ( 'cursor' , 'pointer' ) ;
} , true ) ;
}
saveFunc . delay ( 1 ) ;
2011-07-30 05:22:57 -03:00
} else {
2011-04-06 11:20:15 +01:00
new Windoo . Confirm ( 'This option is not enabled in try mode. You must by signed in order to execute this action.<br/> to create an account click <a href="userRegistration.htm">here</a>' ,
2011-07-30 05:22:57 -03:00
{
'window' : { theme : Windoo . Themes . wise ,
title : ''
}
} ) ;
2009-06-07 18:59:43 +00:00
}
} ) ;
var discardButton = $ ( 'discardButton' ) ;
discardButton . addEvent ( 'click' , function ( event ) {
2011-07-30 05:22:57 -03:00
if ( ! isTryMode ) {
2009-06-07 18:59:43 +00:00
displayLoading ( ) ;
window . document . location = "mymaps.htm" ;
2011-07-30 05:22:57 -03:00
} else {
2011-04-06 11:20:15 +01:00
displayLoading ( ) ;
window . document . location = "home.htm" ;
2011-07-30 05:22:57 -03:00
}
} ) ;
2009-06-07 18:59:43 +00:00
2011-07-30 05:22:57 -03:00
if ( isTryMode ) {
$ ( 'tagIt' ) . addEvent ( 'click' , function ( event ) {
2009-06-07 18:59:43 +00:00
new Windoo . Confirm ( 'This option is not enabled in try mode. You must by signed in order to execute this action.' ,
2011-07-30 05:22:57 -03:00
{
'window' : { theme : Windoo . Themes . wise ,
title : ''
}
} ) ;
2009-06-07 18:59:43 +00:00
} ) ;
2011-07-30 05:22:57 -03:00
$ ( 'shareIt' ) . addEvent ( 'click' , function ( event ) {
2009-06-07 18:59:43 +00:00
new Windoo . Confirm ( 'This option is not enabled in try mode. You must by signed in order to execute this action.' ,
2011-07-30 05:22:57 -03:00
{
'window' : { theme : Windoo . Themes . wise ,
title : ''
}
} ) ;
2009-06-07 18:59:43 +00:00
} ) ;
2011-07-30 05:22:57 -03:00
$ ( 'publishIt' ) . addEvent ( 'click' , function ( event ) {
2009-06-07 18:59:43 +00:00
new Windoo . Confirm ( 'This option is not enabled in try mode. You must by signed in order to execute this action.' ,
2011-07-30 05:22:57 -03:00
{
'window' : { theme : Windoo . Themes . wise ,
title : ''
}
} ) ;
2009-06-07 18:59:43 +00:00
} ) ;
2011-07-30 05:22:57 -03:00
$ ( 'history' ) . addEvent ( 'click' , function ( event ) {
2009-06-07 18:59:43 +00:00
new Windoo . Confirm ( 'This option is not enabled in try mode. You must by signed in order to execute this action.' ,
2011-07-30 05:22:57 -03:00
{
'window' : { theme : Windoo . Themes . wise ,
title : ''
}
} ) ;
2009-06-07 18:59:43 +00:00
} ) ;
}
// Autosave ...
2011-07-30 05:22:57 -03:00
if ( ! isTryMode ) {
2009-06-07 18:59:43 +00:00
var autosave = function ( ) {
2011-07-30 05:22:57 -03:00
if ( designer . needsSave ( ) ) {
designer . save ( function ( ) {
2009-06-07 18:59:43 +00:00
var monitor = core . Monitor . getInstance ( ) ;
} , false ) ;
}
} ;
autosave . periodical ( 30000 ) ;
// To prevent the user from leaving the page with changes ...
2011-08-05 01:06:56 -03:00
window . onbeforeunload = function ( ) {
2011-07-30 05:22:57 -03:00
if ( designer . needsSave ( ) ) {
2009-06-07 18:59:43 +00:00
designer . save ( null , false )
}
}
}
// Build panels ...
2011-08-07 18:59:20 -03:00
var fontPanel = new mindplot . widget . FontFamilyPanel ( ) ;
// shapeTypePanel();
// fontSizePanel();
2009-06-07 18:59:43 +00:00
2009-06-11 17:43:45 +00:00
// If not problem has occured, I close the dialod ...
2011-07-30 05:22:57 -03:00
var closeDialog = function ( ) {
2009-06-11 17:43:45 +00:00
2011-07-30 05:22:57 -03:00
if ( ! window . hasUnexpectedErrors ) {
2009-06-11 17:43:45 +00:00
waitDialog . deactivate ( ) ;
}
} . delay ( 500 ) ;
2009-06-07 18:59:43 +00:00
}
2011-07-30 05:22:57 -03:00
function setCurrentColorPicker ( colorPicker ) {
2009-06-07 18:59:43 +00:00
this . currentColorPicker = colorPicker ;
}
2011-07-30 05:22:57 -03:00
function removeCurrentColorPicker ( colorPicker ) {
2009-06-07 18:59:43 +00:00
$clear ( this . currentColorPicker ) ;
}
2011-07-30 05:22:57 -03:00
function buildMindmapDesigner ( ) {
2009-06-07 18:59:43 +00:00
// Initialize message logger ...
var monitor = new core . Monitor ( $ ( 'msgLoggerContainer' ) , $ ( 'msgLogger' ) ) ;
core . Monitor . setInstance ( monitor ) ;
var container = $ ( 'mindplot' ) ;
// Initialize Editor ...
var screenWidth = window . getWidth ( ) ;
var screenHeight = window . getHeight ( ) ;
2009-06-11 17:43:45 +00:00
// Positionate node ...
2009-06-07 18:59:43 +00:00
// header - footer
screenHeight = screenHeight - 90 - 61 ;
// body margin ...
editorProperties . width = screenWidth ;
editorProperties . height = screenHeight ;
2010-12-13 11:07:20 -03:00
designer = new mindplot . MindmapDesigner ( editorProperties , container ) ;
2009-06-07 18:59:43 +00:00
designer . loadFromXML ( mapId , mapXml ) ;
// If a node has focus, focus can be move to another node using the keys.
designer . _cleanScreen = cleanScreenEvent . bind ( this ) ;
// Save map on load ....
2011-07-30 05:22:57 -03:00
if ( editorProperties . saveOnLoad ) {
2009-06-07 18:59:43 +00:00
var saveOnLoad = function ( ) {
designer . save ( function ( ) {
} , false ) ;
} . delay ( 1000 )
}
2011-08-07 18:59:20 -03:00
} ;
2009-06-07 18:59:43 +00:00
2011-07-30 05:22:57 -03:00
function createColorPalette ( container , onSelectFunction , event ) {
2009-06-07 18:59:43 +00:00
cleanScreenEvent ( ) ;
_colorPalette = new core . ColorPicker ( ) ;
_colorPalette . onSelect = function ( color ) {
onSelectFunction . call ( this , color ) ;
cleanScreenEvent ( ) ;
} ;
// dojo.event.kwConnect({srcObj: this._colorPalette,srcFunc:"onColorSelect",targetObj:this._colorPalette, targetFunc:"onSelect", once:true});
var mouseCoords = core . Utils . getMousePosition ( event ) ;
var colorPaletteElement = $ ( "colorPalette" ) ;
colorPaletteElement . setStyle ( 'left' , ( mouseCoords . x - 80 ) + "px" ) ;
colorPaletteElement . setStyle ( 'display' , "block" ) ;
}
;
2011-07-30 05:22:57 -03:00
function cleanScreenEvent ( ) {
if ( this . currentColorPicker ) {
2009-06-07 18:59:43 +00:00
this . currentColorPicker . hide ( ) ;
}
$ ( "fontFamilyPanel" ) . setStyle ( 'display' , "none" ) ;
$ ( "fontSizePanel" ) . setStyle ( 'display' , "none" ) ;
$ ( "topicShapePanel" ) . setStyle ( 'display' , "none" ) ;
iconPanel . close ( ) ;
}
2011-07-30 05:22:57 -03:00
function shapeTypePanel ( ) {
2011-03-28 20:53:18 -03:00
var shapeTypePanel = [ 'rectagle' , 'rounded_rectagle' , 'line' , 'elipse' ] ;
2011-07-30 05:22:57 -03:00
var updateFunction = function ( value ) {
designer . setShape2SelectedNode ( value . replace ( '_' , ' ' ) ) ;
2009-06-07 18:59:43 +00:00
} ;
2011-07-30 05:22:57 -03:00
var onFocusValue = function ( selectedNode ) {
2011-03-28 20:53:18 -03:00
2011-07-30 05:22:57 -03:00
return selectedNode . getShapeType ( ) . replace ( ' ' , '_' ) ;
2009-06-07 18:59:43 +00:00
} ;
buildPanel ( 'topicShape' , 'topicShapePanel' , shapeTypePanel , updateFunction , onFocusValue ) ;
}
2011-07-30 05:22:57 -03:00
function fontSizePanel ( ) {
2009-06-07 18:59:43 +00:00
var shapeTypePanel = [ 'small' , 'normal' , 'large' , 'huge' ] ;
var map = { small : '6' , normal : '8' , large : '10' , huge : '15' } ;
2011-07-30 05:22:57 -03:00
var updateFunction = function ( value ) {
2009-06-07 18:59:43 +00:00
var nodes = designer . getSelectedNodes ( ) ;
var value = map [ value ] ;
designer . setFontSize2SelectedNode ( value ) ;
} ;
2011-07-30 05:22:57 -03:00
var onFocusValue = function ( selectedNode ) {
2009-06-07 18:59:43 +00:00
var fontSize = selectedNode . getFontSize ( ) ;
var result = "" ;
2011-07-30 05:22:57 -03:00
if ( fontSize <= 6 ) {
2009-06-07 18:59:43 +00:00
result = 'small' ;
2011-07-30 05:22:57 -03:00
} else if ( fontSize <= 8 ) {
2009-06-07 18:59:43 +00:00
result = 'normal' ;
2011-07-30 05:22:57 -03:00
} else if ( fontSize <= 10 ) {
2009-06-07 18:59:43 +00:00
result = 'large' ;
2011-07-30 05:22:57 -03:00
} else if ( fontSize >= 15 ) {
2009-06-07 18:59:43 +00:00
result = 'huge' ;
}
return result ;
} ;
buildPanel ( 'fontSize' , 'fontSizePanel' , shapeTypePanel , updateFunction , onFocusValue ) ;
}
2011-07-30 05:22:57 -03:00
function buildPanel ( buttonElemId , elemLinksContainer , elemLinkIds , updateFunction , onFocusValue ) {
2009-06-07 18:59:43 +00:00
// Font family event handling ....
2011-07-30 05:22:57 -03:00
$ ( buttonElemId ) . addEvent ( 'click' , function ( event ) {
2009-06-07 18:59:43 +00:00
var container = $ ( elemLinksContainer ) ;
var isRendered = container . getStyle ( 'display' ) == 'block' ;
cleanScreenEvent ( ) ;
// Restore default css.
2011-07-30 05:22:57 -03:00
for ( var i = 0 ; i < elemLinkIds . length ; i ++ ) {
2009-06-07 18:59:43 +00:00
var elementId = elemLinkIds [ i ] ;
$ ( elementId ) . className = 'toolbarPanelLink' ;
}
// Select current element ...
var nodes = designer . getSelectedNodes ( ) ;
var lenght = nodes . length ;
2011-07-30 05:22:57 -03:00
if ( lenght == 1 ) {
2009-06-07 18:59:43 +00:00
var selectedNode = nodes [ 0 ] ;
var selectedElementId = onFocusValue ( selectedNode ) ;
selectedElementId = selectedElementId . toLowerCase ( ) ;
var selectedElement = $ ( selectedElementId ) ;
selectedElement . className = 'toolbarPanelLinkSelectedLink' ;
}
container . setStyle ( 'display' , 'block' ) ;
var mouseCoords = core . Utils . getMousePosition ( event ) ;
2011-07-30 05:22:57 -03:00
if ( ! isRendered ) {
2009-06-07 18:59:43 +00:00
container . setStyle ( 'left' , ( mouseCoords . x - 10 ) + "px" ) ;
}
} ) ;
2011-07-30 05:22:57 -03:00
var fontOnClick = function ( event ) {
2009-06-07 18:59:43 +00:00
var value = this . getAttribute ( 'id' ) ;
updateFunction ( value ) ;
cleanScreenEvent ( ) ;
} ;
// Register event listeners on elements ...
2011-07-30 05:22:57 -03:00
for ( var i = 0 ; i < elemLinkIds . length ; i ++ ) {
2009-06-07 18:59:43 +00:00
var elementId = elemLinkIds [ i ] ;
$ ( elementId ) . addEvent ( 'click' , fontOnClick . bind ( $ ( elementId ) ) ) ;
}
2011-07-26 15:07:53 -03:00
}