[Pkg-mozext-commits] [itsalltext] 144/459: * renamed rebuildOptionMenu() to rebuildMenu() * fixed bug with not getting the right cache object in menu items
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit cbad1363536204b3b916aa0b1b7e7c886217d0ea
Author: docwhat at gerf.org <docwhat at gerf.org>
Date: Thu Feb 15 11:18:56 2007 -0500
* renamed rebuildOptionMenu() to rebuildMenu()
* fixed bug with not getting the right cache object in menu items
---
chrome/content/cacheobj.js | 8 +++++---
chrome/content/itsalltext.js | 32 +++++++++++++++++++-------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/chrome/content/cacheobj.js b/chrome/content/cacheobj.js
index 7b5db7f..945058b 100644
--- a/chrome/content/cacheobj.js
+++ b/chrome/content/cacheobj.js
@@ -113,6 +113,7 @@ CacheObj.prototype.setExtension = function(ext) {
* @returns {String} the unique identifier.
*/
CacheObj.prototype.getNodeIdentifier = function(node) {
+ ItsAllText.debug('getNodeIdentifier',node);
var id = node.getAttribute('id');
if (!id) {
var name = node.getAttribute('name');
@@ -312,8 +313,9 @@ CacheObj.prototype.fadeStep = function(background_pallet, color_pallet, step, de
var that = this;
return function() {
if (step < background_pallet.length) {
- that.node.style.backgroundColor = background_pallet[step++].hex();
- that.node.style.color = color_pallet[step++].hex();
+ that.node.style.backgroundColor = background_pallet[step].hex();
+ that.node.style.color = color_pallet[step].hex();
+ step++;
setTimeout(that.fadeStep(background_pallet, color_pallet, step, delay),delay);
} else {
that.node.style.backgroundColor = that.initial_background;
@@ -399,7 +401,7 @@ CacheObj.prototype.addGumDrop = function() {
var use_context = event.ctrlKey || event.altKey;
var use_cutpaste = event.shiftKey;
if (use_context) {
- var target = ItsAllText.rebuildOptionMenu(cache_object.uid);
+ var target = ItsAllText.rebuildMenu(cache_object.uid);
target.showPopup(document.documentElement,
event.screenX, event.screenY,
"bottomleft", "topleft");
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 5e1c98a..c83752c 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -341,16 +341,21 @@ var ItsAllText = function() {
/**
* Returns a cache object
* Note: These UIDs are only unique for Its All Text.
- * @param {Object} node A dom object node.
+ * @param {Object} node A dom object node or ID to one.
* @returns {String} the UID or null.
*/
that.getCacheObj = function(node) {
var cobj = null;
- if (node && node.hasAttribute(that.MYSTRING+"_UID")) {
- cobj = that.tracker[node.getAttribute(that.MYSTRING+"_UID")];
- }
- if (!cobj) {
- cobj = new ItsAllText.CacheObj(node);
+ var str = that.MYSTRING+"_UID";
+ if (typeof(node) == 'string') {
+ cobj = that.tracker[node];
+ } else {
+ if (node && node.hasAttribute(str)) {
+ cobj = that.tracker[node.getAttribute(str)];
+ }
+ if (!cobj) {
+ cobj = new ItsAllText.CacheObj(node);
+ }
}
return cobj;
};
@@ -547,6 +552,7 @@ var ItsAllText = function() {
if(event.target && event.target.id) {
var id = event.target.id;
var node = document.popupNode;
+ var cobj = that.getCacheObj(node);
var tag = node.nodeName.toLowerCase();
if(id == "contentAreaContextMenu") {
var menu = document.getElementById("itsalltext-contextmenu");
@@ -554,9 +560,9 @@ var ItsAllText = function() {
tag != "textbox"));
}
if(id == "itsalltext-context-popup" &&
- (tag == 'textarea' || tag == 'textbox') &&
- node.id) {
- that.rebuildOptionMenu(node.id, 'itsalltext-context-popup');
+ (tag == 'textarea' || tag == 'textbox')) {
+ that.rebuildMenu(cobj.uid,
+ 'itsalltext-context-popup');
}
}
return true;
@@ -605,7 +611,7 @@ var ItsAllText = function() {
ItsAllText.prototype.menuNewExtEdit = function(event) {
var that = this;
var uid = this._current_uid;
- var cobj = that.tracker[uid];
+ var cobj = that.getCacheObj(uid);
var params = {out:null};
window.openDialog("chrome://itsalltext/chrome/newextension.xul", "",
@@ -625,9 +631,9 @@ ItsAllText.prototype.menuNewExtEdit = function(event) {
*/
ItsAllText.prototype.menuExtEdit = function(event) {
var that = this;
- var uid = this._current_uid;
+ var uid = that._current_uid;
var ext = event.target.getAttribute('label');
- var cobj = that.tracker[uid];
+ var cobj = that.getCacheObj(uid);
cobj.edit(ext);
};
@@ -636,7 +642,7 @@ ItsAllText.prototype.menuExtEdit = function(event) {
* @private
* @param {String} uid The UID to show in the option menu.
*/
-ItsAllText.prototype.rebuildOptionMenu = function(uid, menu_id) {
+ItsAllText.prototype.rebuildMenu = function(uid, menu_id) {
menu_id = typeof(menu_id) == 'string'?menu_id:'itsalltext-optionmenu';
var i;
var that = this;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list