# HG changeset patch # User wycc # Date 1236733898 -28800 # Node ID 83cae12cf4288363174299851919484b880ed19e # Parent 8c4456190d9a5706669aaaa1b8384901c9820945 Load scene and source in different way. diff -r 8c4456190d9a -r 83cae12cf428 inkscape/firefox/content/inkscape.js --- a/inkscape/firefox/content/inkscape.js Wed Mar 11 08:51:11 2009 +0800 +++ b/inkscape/firefox/content/inkscape.js Wed Mar 11 09:11:38 2009 +0800 @@ -3,7 +3,11 @@ var MAX_DUMP_DEPTH = 10; var inkscape; - + +function endsWith(str, s){ + var reg = new RegExp (s + "$"); + return reg.test(str); +} function dumpObj(obj, name, indent, depth) { if (depth > MAX_DUMP_DEPTH) { @@ -63,9 +67,9 @@ * */ -function Inkscape(file) +function TextEditor(file) { - var editor = document.getElementById('editor'); + var editor = document.getElementById('inkscape'); editor.innerHTML = ""; this.isInProgress = 0; } @@ -450,21 +454,27 @@ } +function project_showFile(node) +{ + var file = node.textContent; + if (endsWith(file,"mbsvg")) { + project_loadScene(node); + } else { + project_loadEditor(node); + } + +} function project_loadScene(node) { var file = node.textContent; inkscape = new Inkscape("file://"+file); - $('#inkscape').show('slow'); - $('#editor').hide('slow'); } function project_loadEditor(node) { var file = node.textContent; - editor = new TextEditor(file); - $('#inkscape').hide('slow'); - $('#editor').show('slow'); + editor = new TextEditor("file://"+file); } function project_parse(xml) @@ -526,7 +536,7 @@ ], }, callback : { - ondblclk : function(NODE,TREE_OBJ) { project_loadScene(NODE); TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE); TREE_OBJ.select_branch.call(TREE_OBJ, NODE);} + ondblclk : function(NODE,TREE_OBJ) { project_showFile(NODE); TREE_OBJ.toggle_branch.call(TREE_OBJ, NODE); TREE_OBJ.select_branch.call(TREE_OBJ, NODE);} }, ui : { context : [