From e301ea416ec3d484a5345f21dc533c6ba08c128b Mon Sep 17 00:00:00 2001 From: piro Date: Tue, 11 Aug 2009 07:06:04 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=BC=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=92=E6=8A=BC=E3=81=97=E3=81=9F=E6=99=82=E3=81=AE?= =?UTF-8?q?=E3=83=9D=E3=83=83=E3=83=97=E3=82=A2=E3=83=83=E3=83=97=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=83=84=E3=83=AA=E3=83=BC=E6=A7=8B=E9=80=A0=E3=81=AE?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E3=81=8C=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4935 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- .../treestyletab/bookmarksOverlayEditable.js | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/content/treestyletab/bookmarksOverlayEditable.js b/content/treestyletab/bookmarksOverlayEditable.js index 499e5afd..e32b247e 100644 --- a/content/treestyletab/bookmarksOverlayEditable.js +++ b/content/treestyletab/bookmarksOverlayEditable.js @@ -1,6 +1,7 @@ var TreeStyleTabBookmarksServiceEditable = { instantApply : false, + canceled : false, get parentRow() { @@ -27,21 +28,47 @@ var TreeStyleTabBookmarksServiceEditable = { init : function() { + // main browser window if ('StarUI' in window) { if ('_doShowEditBookmarkPanel' in StarUI) { eval('StarUI._doShowEditBookmarkPanel = '+StarUI._doShowEditBookmarkPanel.toSource().replace( '{', - '{ TreeStyleTabBookmarksServiceEditable.initUI();' + '{ TreeStyleTabBookmarksServiceEditable.initEditUI();' + )); + } + if ('quitEditMode' in StarUI) { + eval('StarUI.quitEditMode = '+StarUI.quitEditMode.toSource().replace( + '{', + '{ TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);' + )); + } + if ('cancelButtonOnCommand' in StarUI) { + eval('StarUI.cancelButtonOnCommand = '+StarUI.cancelButtonOnCommand.toSource().replace( + '{', + '{ TreeStyleTabBookmarksServiceEditable.canceled = true;' )); } } - this.initUI(); + // Bookmarks Property dialog + if ('BookmarkPropertiesPanel' in window) { + eval('BookmarkPropertiesPanel._endBatch = '+BookmarkPropertiesPanel._endBatch.toSource().replace( + 'PlacesUIUtils.ptm.endBatch();', + '$& TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);' + )); + } + + // Places Organizer (Library) + if ('PlacesOrganizer' in window) { + this.instantApply = true; + } + + this.initEditUI(); }, - initUI : function() + initEditUI : function() { - if (this.UIInitialized || !('gEditItemOverlay' in window)) return; + if (this.editUIInitialized || !('gEditItemOverlay' in window)) return; var container = document.getElementById('editBookmarkPanelGrid'); if (!container) return; @@ -87,22 +114,9 @@ var TreeStyleTabBookmarksServiceEditable = { '$& if (aNewParent == this._getFolderIdFromMenuList()) TreeStyleTabBookmarksServiceEditable.initParentMenuList();' )); - // Bookmarks Property dialog - if ('BookmarkPropertiesPanel' in window) { - eval('BookmarkPropertiesPanel._endBatch = '+BookmarkPropertiesPanel._endBatch.toSource().replace( - 'PlacesUIUtils.ptm.endBatch();', - '$& TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);' - )); - } - - // Places Organizer (Library) - if ('PlacesOrganizer' in window) { - this.instantApply = true; - } - - this.UIInitialized = true; + this.editUIInitialized = true; }, - UIInitialized : false, + editUIInitialized : false, initParentMenuList : function() { @@ -123,6 +137,8 @@ var TreeStyleTabBookmarksServiceEditable = { var selected = popup.getElementsByAttribute('selected', 'true')[0]; this.menulist.value = (selected || this.blankItem).getAttribute('value'); + + this.canceled = false; }, _createSiblingsFragment : function(aCurrentItem) { @@ -187,7 +203,7 @@ var TreeStyleTabBookmarksServiceEditable = { saveParentFor : function(aId) { var newParentId = parseInt(this.menulist.value || -1); - if (newParentId == this.getParentItem(aId)) return; + if (this.canceled || newParentId == this.getParentItem(aId)) return; var items = this._getSiblingItems(aId); var treeStructure = this.getTreeStructureFromItems(items);