52 _microsummaries:
null,
54 _observersAdded:
false,
55 _staticFoldersListBuilt:
false,
60 _firstEditedField:
"",
71 return this._multiEdit;
77 _determineInfo:
function EIO__determineInfo(aInfo) {
79 if (aInfo && aInfo.hiddenRows)
80 this._hiddenRows = aInfo.hiddenRows;
82 this._hiddenRows.splice(0);
84 this._readOnly = aInfo && aInfo.forceReadOnly;
87 _showHideRows:
function EIO__showHideRows() {
88 var isBookmark = this._itemId != -1 &&
89 this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK;
92 isQuery = this._uri.schemeIs(
"place");
94 this._element(
"nameRow").collapsed = this._hiddenRows.indexOf(
"name") != -1;
95 this._element(
"folderRow").collapsed =
96 this._hiddenRows.indexOf(
"folderPicker") != -1 || this._readOnly;
97 this._element(
"tagsRow").collapsed = !this._uri ||
98 this._hiddenRows.indexOf(
"tags") != -1 || isQuery;
100 if (!this._element(
"tagsSelectorRow").collapsed &&
101 this._element(
"tagsRow").collapsed)
102 this.toggleTagsSelector();
103 this._element(
"descriptionRow").collapsed =
104 this._hiddenRows.indexOf(
"description") != -1 || this._readOnly;
105 this._element(
"keywordRow").collapsed = !isBookmark || this._readOnly ||
106 this._hiddenRows.indexOf(
"keyword") != -1 || isQuery;
107 this._element(
"locationRow").collapsed = !(this._uri && !isQuery) ||
108 this._hiddenRows.indexOf(
"location") != -1;
109 this._element(
"loadInSidebarCheckbox").collapsed = !isBookmark || isQuery ||
110 this._readOnly || this._hiddenRows.indexOf(
"loadInSidebar") != -1;
111 this._element(
"feedLocationRow").collapsed = !this._isLivemark ||
112 this._hiddenRows.indexOf(
"feedLocation") != -1;
113 this._element(
"siteLocationRow").collapsed = !this._isLivemark ||
114 this._hiddenRows.indexOf(
"siteLocation") != -1;
115 this._element(
"selectionCount").hidden = !this._multiEdit;
134 initPanel:
function EIO_initPanel(aFor, aInfo) {
137 if (this._initialized)
138 this.uninitPanel(
false);
143 aFor = aItemIdList[0];
145 else if (this._multiEdit) {
146 this._multiEdit =
false;
151 this._element(
"selectionCount").hidden =
true;
154 this._folderMenuList = this._element(
"folderMenuList");
155 this._folderTree = this._element(
"folderTree");
157 this._determineInfo(aInfo);
158 if (aFor instanceof
Ci.nsIURI) {
161 this._readOnly =
true;
165 var containerId = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId);
166 this._itemType = PlacesUtils.bookmarks.getItemType(this._itemId);
167 if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
168 this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
170 this._readOnly = PlacesUtils.itemIsLivemark(containerId);
171 this._initTextField(
"keywordField",
172 PlacesUtils.bookmarks
173 .getKeywordForBookmark(
this._itemId));
175 this._element(
"loadInSidebarCheckbox").checked =
176 PlacesUtils.annotations.itemHasAnnotation(this._itemId,
181 this._readOnly =
false;
184 this._isLivemark = PlacesUtils.itemIsLivemark(this._itemId);
185 if (this._isLivemark) {
186 var feedURI = PlacesUtils.livemarks.getFeedURI(this._itemId);
187 var siteURI = PlacesUtils.livemarks.getSiteURI(this._itemId);
188 this._initTextField(
"feedLocationField", feedURI.spec);
189 this._initTextField(
"siteLocationField", siteURI ? siteURI.spec :
"");
194 this._initFolderMenuList(containerId);
197 this._initTextField(
"descriptionField",
201 if (this._itemId == -1 ||
202 this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
203 this._isLivemark =
false;
205 this._initTextField(
"locationField", this._uri.spec);
207 var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(
", ");
208 this._initTextField(
"tagsField", tags,
false);
211 this._multiEdit =
true;
213 this._itemIds = aItemIdList;
215 for (var
i = 0;
i < aItemIdList.length;
i++) {
216 if (aItemIdList[
i] instanceof
Ci.nsIURI) {
217 this._uris[
i] = aItemIdList[
i];
218 this._itemIds[
i] = -1;
221 this._uris[
i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[
i], {});
222 this._tags[
i] = PlacesUtils.tagging.getTagsForURI(this._uris[i], {});
223 if (this._tags[i].length < this._tags[nodeToCheck].length)
226 this._getCommonTags(nodeToCheck);
227 this._initTextField(
"tagsField", this._allTags.join(
", "),
false);
228 this._element(
"itemsCountText").value =
229 PlacesUIUtils.getFormattedString(
"detailsPane.multipleItems",
230 [this._itemIds.length]);
234 this._rebuildTagsSelectorList();
238 this._initNamePicker();
240 this._showHideRows();
243 if (!this._observersAdded) {
244 if (this._itemId != -1)
245 PlacesUtils.bookmarks.addObserver(
this,
false);
246 window.addEventListener(
"unload",
this,
false);
247 this._observersAdded =
true;
250 this._initialized =
true;
253 _getCommonTags:
function(aArrIndex) {
254 var tempArray = this._tags[aArrIndex];
256 for (var k = 0; k < tempArray.length; k++) {
258 for (var j = 0; j < this._tags.length; j++) {
261 if (this._tags[j].
indexOf(tempArray[k]) == -1) {
267 this._allTags.push(tempArray[k]);
271 _initTextField:
function(aTextFieldId,
aValue, aReadOnly) {
272 var field = this._element(aTextFieldId);
273 field.readOnly = aReadOnly !== undefined ? aReadOnly : this._readOnly;
275 if (field.value != aValue) {
279 var editor = field.editor;
281 editor.transactionManager.clear();
293 _appendFolderItemToMenupopup:
294 function EIO__appendFolderItemToMenuList(aMenupopup, aFolderId) {
296 this._element(
"foldersSeparator").hidden =
false;
298 var folderMenuItem = document.createElement(
"menuitem");
299 var folderTitle = PlacesUtils.bookmarks.getItemTitle(aFolderId)
300 folderMenuItem.folderId = aFolderId;
301 folderMenuItem.setAttribute(
"label", folderTitle);
302 folderMenuItem.className =
"menuitem-iconic folder-icon";
303 aMenupopup.appendChild(folderMenuItem);
304 return folderMenuItem;
307 _initFolderMenuList:
function EIO__initFolderMenuList(aSelectedFolder) {
309 var menupopup = this._folderMenuList.menupopup;
310 while (menupopup.childNodes.length > 6)
311 menupopup.removeChild(menupopup.lastChild);
313 const bms = PlacesUtils.bookmarks;
314 const annos = PlacesUtils.annotations;
317 var unfiledItem = this._element(
"unfiledRootItem");
318 if (!this._staticFoldersListBuilt) {
319 unfiledItem.label = bms.getItemTitle(PlacesUtils.unfiledBookmarksFolderId);
320 unfiledItem.folderId = PlacesUtils.unfiledBookmarksFolderId;
321 var bmMenuItem = this._element(
"bmRootItem");
322 bmMenuItem.label = bms.getItemTitle(PlacesUtils.bookmarksMenuFolderId);
323 bmMenuItem.folderId = PlacesUtils.bookmarksMenuFolderId;
324 var toolbarItem = this._element(
"toolbarFolderItem");
325 toolbarItem.label = bms.getItemTitle(PlacesUtils.toolbarFolderId);
326 toolbarItem.folderId = PlacesUtils.toolbarFolderId;
327 this._staticFoldersListBuilt =
true;
331 var folderIds = annos.getItemsWithAnnotation(
LAST_USED_ANNO, { });
341 this._recentFolders = [];
342 for (var
i = 0;
i < folderIds.length;
i++) {
344 this._recentFolders.push({ folderId: folderIds[
i], lastUsed: lastUsed });
346 this._recentFolders.sort(
function(a, b) {
347 if (b.lastUsed < a.lastUsed)
349 if (b.lastUsed > a.lastUsed)
355 this._recentFolders.length);
356 for (var
i = 0;
i < numberOfItems;
i++) {
357 this._appendFolderItemToMenupopup(menupopup,
358 this._recentFolders[
i].folderId);
361 var defaultItem = this._getFolderMenuItem(aSelectedFolder);
362 this._folderMenuList.selectedItem = defaultItem;
365 this._folderMenuList.setAttribute(
"selectedIndex",
366 this._folderMenuList.selectedIndex);
369 this._element(
"foldersSeparator").hidden = (menupopup.childNodes.length <= 6);
370 this._folderMenuList.disabled = this._readOnly;
374 if (aIID.equals(
Ci.nsIMicrosummaryObserver) ||
375 aIID.equals(
Ci.nsIDOMEventListener) ||
376 aIID.equals(
Ci.nsINavBookmarkObserver) ||
377 aIID.equals(
Ci.nsISupports))
380 throw Cr.NS_ERROR_NO_INTERFACE;
383 _element:
function EIO__element(aID) {
384 return document.getElementById(
"editBMPanel_" + aID);
387 _createMicrosummaryMenuItem:
388 function EIO__createMicrosummaryMenuItem(aMicrosummary) {
389 var
menuItem = document.createElement(
"menuitem");
394 menuItem.microsummary = aMicrosummary;
405 if (aMicrosummary.content)
406 menuItem.setAttribute(
"label", aMicrosummary.content);
408 menuItem.setAttribute(
"label", aMicrosummary.generator.name ||
409 aMicrosummary.generator.uri.spec);
410 aMicrosummary.update();
416 _getItemStaticTitle:
function EIO__getItemStaticTitle() {
417 if (this._itemId == -1)
418 return PlacesUtils.history.getPageTitle(this._uri);
420 const annos = PlacesUtils.annotations;
424 return PlacesUtils.bookmarks.getItemTitle(this._itemId);
427 _initNamePicker:
function EIO_initNamePicker() {
428 var userEnteredNameField = this._element(
"userEnteredName");
429 var namePicker = this._element(
"namePicker");
430 var droppable =
false;
432 userEnteredNameField.label = this._getItemStaticTitle();
435 var menupopup = namePicker.menupopup;
436 while (menupopup.childNodes.length > 2)
437 menupopup.removeChild(menupopup.lastChild);
439 if (this._microsummaries) {
440 this._microsummaries.removeObserver(
this);
441 this._microsummaries =
null;
444 var itemToSelect = userEnteredNameField;
446 if (this._itemId != -1 &&
447 this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK &&
450 .getMicrosummaries(this._uri, -1);
459 this._microsummaries =
null;
461 if (this._microsummaries) {
462 var enumerator = this._microsummaries.Enumerate();
464 if (enumerator.hasMoreElements()) {
467 while (enumerator.hasMoreElements()) {
468 var microsummary = enumerator.getNext()
469 .QueryInterface(
Ci.nsIMicrosummary);
470 var
menuItem = this._createMicrosummaryMenuItem(microsummary);
472 .isMicrosummary(
this._itemId, microsummary))
473 itemToSelect = menuItem;
475 menupopup.appendChild(menuItem);
479 this._microsummaries.addObserver(
this);
482 if (namePicker.selectedItem == itemToSelect)
483 namePicker.value = itemToSelect.label;
485 namePicker.selectedItem = itemToSelect;
487 namePicker.setAttribute(
"droppable", droppable);
488 namePicker.readOnly = this._readOnly;
491 var editor = namePicker.editor;
493 editor.transactionManager.clear();
497 onContentLoaded:
function EIO_onContentLoaded(aMicrosummary) {
498 var namePicker = this._element(
"namePicker");
499 var childNodes = namePicker.menupopup.childNodes;
502 for (var
i = 2;
i < childNodes.length;
i++) {
503 if (childNodes[
i].microsummary == aMicrosummary) {
504 var newLabel = aMicrosummary.content;
512 if (namePicker.selectedItem == childNodes[
i])
513 namePicker.value = newLabel;
515 childNodes[
i].label = newLabel;
521 onElementAppended:
function EIO_onElementAppended(aMicrosummary) {
522 var namePicker = this._element(
"namePicker");
524 .appendChild(this._createMicrosummaryMenuItem(aMicrosummary));
527 namePicker.setAttribute(
"droppable",
"true");
530 uninitPanel:
function EIO_uninitPanel(aHideCollapsibleElements) {
531 if (aHideCollapsibleElements) {
533 var folderTreeRow = this._element(
"folderTreeRow");
534 if (!folderTreeRow.collapsed)
535 this.toggleFolderTreeVisibility();
538 var tagsSelectorRow = this._element(
"tagsSelectorRow");
539 if (!tagsSelectorRow.collapsed)
540 this.toggleTagsSelector();
543 if (this._observersAdded) {
544 if (this._itemId != -1)
545 PlacesUtils.bookmarks.removeObserver(
this);
547 this._observersAdded =
false;
549 if (this._microsummaries) {
550 this._microsummaries.removeObserver(
this);
551 this._microsummaries =
null;
559 this._multiEdit =
false;
560 this._firstEditedField =
"";
561 this._initialized =
false;
564 onTagsFieldBlur:
function EIO_onTagsFieldBlur() {
565 if (this._updateTags())
566 this._mayUpdateFirstEditField(
"tagsField");
569 _updateTags:
function EIO__updateTags() {
571 return this._updateMultipleTagsForItems();
572 return this._updateSingleTagForItem();
575 _updateSingleTagForItem:
function EIO__updateSingleTagForItem() {
576 var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri, { });
577 var tags = this._getTagsArrayFromTagField();
578 if (tags.length > 0 || currentTags.length > 0) {
579 var tagsToRemove = [];
582 for (var
i = 0;
i < currentTags.length;
i++) {
583 if (tags.indexOf(currentTags[
i]) == -1)
584 tagsToRemove.push(currentTags[i]);
586 for (var
i = 0;
i < tags.length;
i++) {
587 if (currentTags.indexOf(tags[
i]) == -1)
588 tagsToAdd.push(tags[i]);
591 if (tagsToRemove.length > 0)
592 txns.push(
PlacesUIUtils.ptm.untagURI(
this._uri, tagsToRemove));
593 if (tagsToAdd.length > 0)
596 if (txns.length > 0) {
597 var aggregate =
PlacesUIUtils.ptm.aggregateTransactions(
"Update tags",
602 var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(
", ");
603 this._initTextField(
"tagsField", tags,
false);
617 _mayUpdateFirstEditField:
function EIO__mayUpdateFirstEditField(aNewField) {
621 if (this._multiEdit || this._firstEditedField)
624 this._firstEditedField = aNewField;
627 var
prefs =
Cc[
"@mozilla.org/preferences-service;1"].
629 prefs.setCharPref(
"browser.bookmarks.editDialog.firstEditField", aNewField);
632 _updateMultipleTagsForItems:
function EIO__updateMultipleTagsForItems() {
633 var tags = this._getTagsArrayFromTagField();
634 if (tags.length > 0 ||
this._allTags.length > 0) {
635 var tagsToRemove = [];
638 for (var
i = 0;
i < this._allTags.length;
i++) {
639 if (tags.indexOf(
this._allTags[
i]) == -1)
640 tagsToRemove.push(
this._allTags[
i]);
642 for (var
i = 0;
i < this._tags.length;
i++) {
644 for (var j = 0; j < tags.length; j++) {
645 if (this._tags[
i].
indexOf(tags[j]) == -1)
646 tagsToAdd[
i].push(tags[j]);
650 if (tagsToAdd.length > 0) {
651 for (
i = 0;
i < this._uris.length;
i++) {
652 if (tagsToAdd[
i].length > 0)
656 if (tagsToRemove.length > 0) {
657 for (var
i = 0;
i < this._uris.length;
i++)
658 txns.push(
PlacesUIUtils.ptm.untagURI(
this._uris[
i], tagsToRemove));
661 if (txns.length > 0) {
662 var aggregate =
PlacesUIUtils.ptm.aggregateTransactions(
"Update tags",
666 this._allTags = tags;
668 for (
i = 0;
i < this._uris.length;
i++)
669 this._tags[
i] = PlacesUtils.tagging.getTagsForURI(
this._uris[
i], {});
672 this._initTextField(
"tagsField", tags,
false);
679 onNamePickerInput:
function EIO_onNamePickerInput() {
680 var title = this._element(
"namePicker").value;
681 this._element(
"userEnteredName").label = title;
684 onNamePickerChange:
function EIO_onNamePickerChange() {
685 if (this._itemId == -1)
688 var namePicker = this._element(
"namePicker")
693 var newTitle =
this._element("userEnteredName").
label;
694 if (
this._getItemStaticTitle() != newTitle) {
695 this._mayUpdateFirstEditField(
"namePicker");
696 if (
PlacesUIUtils.microsummaries.hasMicrosummary(
this._itemId)) {
702 PlacesUtils.setAnnotationsForItem(this._itemId,
707 txns.push(ptm.editItemTitle(
this._itemId, newTitle));
710 var newMicrosummary = namePicker.selectedItem.microsummary;
716 if ((newMicrosummary ==
null &&
717 PlacesUIUtils.microsummaries.hasMicrosummary(
this._itemId)) ||
718 (newMicrosummary !=
null &&
720 .isMicrosummary(
this._itemId, newMicrosummary))) {
721 txns.push(ptm.editBookmarkMicrosummary(
this._itemId, newMicrosummary));
724 var aggregate = ptm.aggregateTransactions(
"Edit Item Title", txns);
725 ptm.doTransaction(aggregate);
728 onDescriptionFieldBlur:
function EIO_onDescriptionFieldBlur() {
729 var description = this._element(
"descriptionField").value;
730 if (description !=
PlacesUIUtils.getItemDescription(
this._itemId)) {
732 .editItemDescription(this._itemId, description);
737 onLocationFieldBlur:
function EIO_onLocationFieldBlur() {
742 catch(ex) {
return; }
744 if (!this._uri.equals(uri)) {
745 var txn =
PlacesUIUtils.ptm.editBookmarkURI(this._itemId, uri);
751 onKeywordFieldBlur:
function EIO_onKeywordFieldBlur() {
752 var keyword = this._element(
"keywordField").value;
753 if (keyword != PlacesUtils.bookmarks.getKeywordForBookmark(
this._itemId)) {
754 var txn =
PlacesUIUtils.ptm.editBookmarkKeyword(this._itemId, keyword);
759 onFeedLocationFieldBlur:
function EIO_onFeedLocationFieldBlur() {
764 catch(ex) {
return; }
766 var currentFeedURI = PlacesUtils.livemarks.getFeedURI(this._itemId);
767 if (!currentFeedURI.equals(uri)) {
768 var txn =
PlacesUIUtils.ptm.editLivemarkFeedURI(this._itemId, uri);
773 onSiteLocationFieldBlur:
function EIO_onSiteLocationFieldBlur() {
780 var currentSiteURI = PlacesUtils.livemarks.getSiteURI(this._itemId);
781 if (!uri || !currentSiteURI.equals(uri)) {
782 var txn =
PlacesUIUtils.ptm.editLivemarkSiteURI(this._itemId, uri);
787 onLoadInSidebarCheckboxCommand:
788 function EIO_onLoadInSidebarCheckboxCommand() {
789 var loadInSidebarChecked = this._element(
"loadInSidebarCheckbox").checked;
791 loadInSidebarChecked);
795 toggleFolderTreeVisibility:
function EIO_toggleFolderTreeVisibility() {
796 var expander = this._element(
"foldersExpander");
797 var folderTreeRow = this._element(
"folderTreeRow");
798 if (!folderTreeRow.collapsed) {
799 expander.className =
"expander-down";
800 expander.setAttribute(
"tooltiptext",
801 expander.getAttribute(
"tooltiptextdown"));
802 folderTreeRow.collapsed =
true;
803 this._element(
"chooseFolderSeparator").hidden =
804 this._element(
"chooseFolderMenuItem").hidden =
false;
807 expander.className =
"expander-up"
808 expander.setAttribute(
"tooltiptext",
809 expander.getAttribute(
"tooltiptextup"));
810 folderTreeRow.collapsed =
false;
815 const FOLDER_TREE_PLACE_URI =
816 "place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" +
818 this._folderTree.place = FOLDER_TREE_PLACE_URI;
820 this._element(
"chooseFolderSeparator").hidden =
821 this._element(
"chooseFolderMenuItem").hidden =
true;
822 var currentFolder = this._getFolderIdFromMenuList();
823 this._folderTree.selectItems([currentFolder]);
824 this._folderTree.focus();
828 _getFolderIdFromMenuList:
829 function EIO__getFolderIdFromMenuList() {
832 "Invalid menuitem in the folders-menulist");
833 return selectedItem.folderId;
845 function EIO__getFolderMenuItem(aFolderId) {
846 var menupopup = this._folderMenuList.menupopup;
848 for (var
i=0;
i < menupopup.childNodes.length;
i++) {
849 if (menupopup.childNodes[
i].folderId &&
850 menupopup.childNodes[
i].folderId == aFolderId)
851 return menupopup.childNodes[
i];
856 menupopup.removeChild(menupopup.lastChild);
858 return this._appendFolderItemToMenupopup(menupopup, aFolderId);
861 onFolderMenuListCommand:
function EIO_onFolderMenuListCommand(aEvent) {
863 this._folderMenuList.setAttribute(
"selectedIndex",
864 this._folderMenuList.selectedIndex);
866 if (aEvent.target.id ==
"editBMPanel_chooseFolderMenuItem") {
869 var container = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId);
870 var item = this._getFolderMenuItem(container);
871 this._folderMenuList.selectedItem = item;
874 setTimeout(
function(
self)
self.toggleFolderTreeVisibility(), 100,
this);
879 var container = this._getFolderIdFromMenuList();
880 if (PlacesUtils.bookmarks.getFolderIdForItem(
this._itemId) != container) {
881 var txn =
PlacesUIUtils.ptm.moveItem(this._itemId, container, -1);
886 if (container != PlacesUtils.unfiledBookmarksFolderId &&
887 container != PlacesUtils.toolbarFolderId &&
888 container != PlacesUtils.bookmarksMenuFolderId)
889 this._markFolderAsRecentlyUsed(container);
893 var folderTreeRow = this._element(
"folderTreeRow");
894 if (!folderTreeRow.collapsed) {
895 var selectedNode = this._folderTree.selectedNode;
897 PlacesUtils.getConcreteItemId(selectedNode) != container)
898 this._folderTree.selectItems([container]);
902 onFolderTreeSelect:
function EIO_onFolderTreeSelect() {
903 var selectedNode = this._folderTree.selectedNode;
906 this._element(
"newFolderButton")
907 .disabled = !this._folderTree.insertionPoint || !selectedNode;
912 var folderId = PlacesUtils.getConcreteItemId(selectedNode);
913 if (this._getFolderIdFromMenuList() == folderId)
916 var folderItem = this._getFolderMenuItem(folderId);
917 this._folderMenuList.selectedItem = folderItem;
918 folderItem.doCommand();
921 _markFolderAsRecentlyUsed:
922 function EIO__markFolderAsRecentlyUsed(aFolderId) {
926 var anno = this._getLastUsedAnnotationObject(
false);
928 var folderId = this._recentFolders.pop().folderId;
929 txns.push(
PlacesUIUtils.ptm.setItemAnnotation(folderId, anno));
933 anno = this._getLastUsedAnnotationObject(
true);
934 txns.push(
PlacesUIUtils.ptm.setItemAnnotation(aFolderId, anno));
936 var aggregate =
PlacesUIUtils.ptm.aggregateTransactions(
"Update last used folders", txns);
949 _getLastUsedAnnotationObject:
950 function EIO__getLastUsedAnnotationObject(aLastUsed) {
952 type:
Ci.nsIAnnotationService.TYPE_INT32,
954 value: aLastUsed ?
new Date().getTime() :
null,
955 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
960 _rebuildTagsSelectorList:
function EIO__rebuildTagsSelectorList() {
961 var tagsSelector = this._element(
"tagsSelector");
962 var tagsSelectorRow = this._element(
"tagsSelectorRow");
963 if (tagsSelectorRow.collapsed)
966 while (tagsSelector.hasChildNodes())
967 tagsSelector.removeChild(tagsSelector.lastChild);
969 var tagsInField = this._getTagsArrayFromTagField();
970 var allTags = PlacesUtils.tagging.allTags;
971 for (var
i = 0;
i < allTags.length;
i++) {
972 var
tag = allTags[
i];
973 var elt = document.createElement(
"listitem");
974 elt.setAttribute(
"type",
"checkbox");
975 elt.setAttribute(
"label", tag);
976 if (tagsInField.indexOf(tag) != -1)
977 elt.setAttribute(
"checked",
"true");
979 tagsSelector.appendChild(elt);
983 toggleTagsSelector:
function EIO_toggleTagsSelector() {
984 var tagsSelector = this._element(
"tagsSelector");
985 var tagsSelectorRow = this._element(
"tagsSelectorRow");
986 var expander = this._element(
"tagsSelectorExpander");
987 if (tagsSelectorRow.collapsed) {
988 expander.className =
"expander-up";
989 expander.setAttribute(
"tooltiptext",
990 expander.getAttribute(
"tooltiptextup"));
991 tagsSelectorRow.collapsed =
false;
992 this._rebuildTagsSelectorList();
995 tagsSelector.addEventListener(
"CheckboxStateChange",
this,
false);
998 expander.className =
"expander-down";
999 expander.setAttribute(
"tooltiptext",
1000 expander.getAttribute(
"tooltiptextdown"));
1001 tagsSelectorRow.collapsed =
true;
1005 _getTagsArrayFromTagField:
function EIO__getTagsArrayFromTagField() {
1007 var tags = this._element(
"tagsField").value.split(
",");
1008 for (var
i=0;
i < tags.length;
i++) {
1010 tags[
i] = tags[
i].replace(/^\s+/,
"").replace(/\s+$/,
"");
1013 if (tags[
i] ==
"") {
1021 newFolder:
function EIO_newFolder() {
1022 var ip = this._folderTree.insertionPoint;
1025 if (!ip || ip.itemId ==
PlacesUIUtils.allBookmarksFolderId) {
1027 PlacesUtils.bookmarks.DEFAULT_INDEX,
1028 Ci.nsITreeView.DROP_ON);
1032 var defaultLabel = this._element(
"newFolderButton").label;
1033 var txn =
PlacesUIUtils.ptm.createFolder(defaultLabel, ip.itemId, ip.index);
1035 this._folderTree.focus();
1036 this._folderTree.selectItems([this._lastNewItem]);
1037 this._folderTree.startEditing(this._folderTree.view.selection.currentIndex,
1038 this._folderTree.columns.getFirstColumn());
1042 handleEvent:
function EIO_nsIDOMEventListener(aEvent) {
1043 switch (aEvent.type) {
1044 case "CheckboxStateChange":
1046 var tags = this._getTagsArrayFromTagField();
1048 if (aEvent.target.checked) {
1049 if (tags.indexOf(aEvent.target.label) == -1)
1050 tags.push(aEvent.target.label);
1053 var indexOfItem = tags.indexOf(aEvent.target.label);
1054 if (indexOfItem != -1)
1055 tags.splice(indexOfItem, 1);
1057 this._element(
"tagsField").value = tags.join(
", ");
1061 this.uninitPanel(
false);
1067 onItemChanged:
function EIO_onItemChanged(aItemId, aProperty,
1068 aIsAnnotationProperty,
aValue,
1069 aLastModified, aItemType) {
1070 if (this._itemId != aItemId) {
1071 if (aProperty ==
"title") {
1075 var menupopup = this._folderMenuList.menupopup;
1076 for (var
i=0;
i < menupopup.childNodes.length;
i++) {
1077 if (menupopup.childNodes[
i].folderId == aItemId) {
1078 menupopup.childNodes[
i].label =
aValue;
1087 switch (aProperty) {
1089 if (PlacesUtils.annotations.itemHasAnnotation(
this._itemId,
1093 var userEnteredNameField = this._element(
"userEnteredName");
1094 if (userEnteredNameField.value !=
aValue) {
1095 userEnteredNameField.value =
aValue;
1096 var namePicker = this._element(
"namePicker");
1097 if (namePicker.selectedItem == userEnteredNameField) {
1098 namePicker.label =
aValue;
1101 namePicker.editor.transactionManager.clear();
1106 var locationField = this._element(
"locationField");
1107 if (locationField.value !=
aValue) {
1108 this._uri =
Cc[
"@mozilla.org/network/io-service;1"].
1111 this._initTextField(
"locationField", this._uri.spec);
1112 this._initNamePicker();
1113 this._initTextField(
"tagsField",
1115 .getTagsForURI(
this._uri, { }).join(
", "),
1117 this._rebuildTagsSelectorList();
1121 this._initTextField(
"keywordField",
1122 PlacesUtils.bookmarks
1123 .getKeywordForBookmark(
this._itemId));
1126 this._initTextField(
"descriptionField",
1130 this._element(
"loadInSidebarCheckbox").checked =
1131 PlacesUtils.annotations.itemHasAnnotation(this._itemId,
1135 var feedURISpec = PlacesUtils.livemarks.getFeedURI(this._itemId).spec;
1136 this._initTextField(
"feedLocationField", feedURISpec);
1139 var siteURISpec =
"";
1140 var siteURI = PlacesUtils.livemarks.getSiteURI(this._itemId);
1142 siteURISpec = siteURI.spec;
1143 this._initTextField(
"siteLocationField", siteURISpec);
1148 onItemMoved:
function EIO_onItemMoved(aItemId, aOldParent, aOldIndex,
1149 aNewParent, aNewIndex, aItemType) {
1150 if (aItemId != this._itemId ||
1151 aNewParent == this._getFolderIdFromMenuList())
1154 var folderItem = this._getFolderMenuItem(aNewParent);
1158 this._folderMenuList.selectedItem = folderItem;
1161 onItemAdded:
function EIO_onItemAdded(aItemId, aFolder, aIndex, aItemType) {
1162 this._lastNewItem = aItemId;
1167 onBeforeItemRemoved:
function() { },
1168 onItemRemoved:
function() { },
1169 onItemVisited:
function() { },
const MAX_FOLDER_ITEM_IN_MENU_LIST
onPageChanged onEndUpdateBatch
sbDeviceFirmwareAutoCheckForUpdate prototype flags
sbOSDControlService prototype QueryInterface
getService(Ci.sbIFaceplateManager)
return elem filter &&elem filter indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity
this _contentSandbox label
aWindow setTimeout(function(){_this.restoreHistory(aWindow, aTabs, aTabData, aIdMap);}, 0)
onPageChanged onBeginUpdateBatch
function newURI(aURLString)
function NS_ASSERT(cond, msg)
#define LOAD_IN_SIDEBAR_ANNO
dataSBGenres SBProperties tag
function InsertionPoint(aItemId, aIndex, aOrientation, aIsTag, aDropNearItemId)
_getSelectedPageStyle s i