[Pkg-mozext-commits] [autofill-forms] 01/07: better onchange event is sent to elements once their value is changed
David Prévot
taffit at moszumanska.debian.org
Wed May 11 22:54:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository autofill-forms.
commit 3cc7d1450f9689fbc7946793b5d36335e9d2beb2
Author: Sarah Avilov <sarah.avilov at gmail.com>
Date: Sat May 7 11:34:44 2016 +0430
better onchange event is sent to elements once their value is changed
---
aff.xpi | Bin 153846 -> 152640 bytes
chrome/content/autofillForms.js | 21 +++++++++++----------
chrome/content/autofillFormsOptions.xul | 2 +-
chrome/content/inject.js | 15 +++++++--------
chrome/skin/autofillFormsOptions.css | 1 +
install.rdf | 2 +-
install.sh | 1 +
7 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/aff.xpi b/aff.xpi
index 9f3f445..712d2c7 100644
Binary files a/aff.xpi and b/aff.xpi differ
diff --git a/chrome/content/autofillForms.js b/chrome/content/autofillForms.js
index 2e2dbe8..eff2aff 100644
--- a/chrome/content/autofillForms.js
+++ b/chrome/content/autofillForms.js
@@ -92,7 +92,7 @@ var autofillForms = {
version: "1.0.4",
action: function (elem, cmd, val) {
- elem.setAttribute('data-aff-' + cmd, val || true);
+ elem.setAttribute('data-aff-' + cmd, val);
var wm = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
var browser = wm.getMostRecentWindow('navigator:browser').gBrowser.selectedBrowser;
@@ -104,7 +104,7 @@ var autofillForms = {
mm.sendAsyncMessage(cmd);
},
- initialize: function() {
+ initialize: function () {
// Save the reference to the Autofill Forms preferences branch:
this.autofillFormsPrefs = this.getPrefManager().getBranch('extensions.autofillForms at blueimp.net.');
@@ -114,9 +114,9 @@ var autofillForms = {
this.autofillFormsPrefs.addObserver('', this, false);
// Implement the event listener for the content area context menu:
- this.contentAreaContextMenuEventListener = function(event) {
+ this.contentAreaContextMenuEventListener = function (event) {
autofillForms.initContentAreaContextMenu(event);
- }
+ };
// Initialize the preferences settings:
this.initializePrefs();
@@ -910,7 +910,7 @@ var autofillForms = {
optionsIndex: null,
element: null,
getValue: function() {
- if(this.fieldRuleValue === null) {
+ if(!this.fieldRuleValue) {
// Replace dynamic tags if enabled:
if(this.af.autofillFormsPrefs.getBoolPref('enableDynamicTags'))
this.fieldRuleValue = this.af.replaceDynamicTags(this.fieldRule['fieldRuleValue']);
@@ -1264,17 +1264,17 @@ var autofillForms = {
if(!element.value || rule.isOverwrite()) {
if(element.type == 'textarea') {
// Replace control character placeholders:
- element.value = this.replaceControlCharacterPlaceholders(rule.getValue());
+ //element.value = this.replaceControlCharacterPlaceholders(rule.getValue());
+ autofillForms.action(element, 'value', this.replaceControlCharacterPlaceholders(rule.getValue()))
} else {
- element.value = rule.getValue();
+ //element.value = rule.getValue();
+ autofillForms.action(element, 'value', rule.getValue());
}
}
}
if(this.autofillFormsPrefs.getBoolPref('callOnChangeAfterFillingFields')) {
this.fireEvent(element,'change')
}
-
-
}
//remove the div, not needed anymore
@@ -1687,7 +1687,8 @@ var autofillForms = {
} catch(e) {
// This input field does not support selections - just try to set the value:
try {
- this.targetFormField.value = value;
+ //this.targetFormField.value = value;
+ autofillForms.action(this.targetFormField, 'value', value);
} catch(e) {
// Catch errors if value could not be set on the form field
}
diff --git a/chrome/content/autofillFormsOptions.xul b/chrome/content/autofillFormsOptions.xul
index b3e9470..71c01e7 100644
--- a/chrome/content/autofillFormsOptions.xul
+++ b/chrome/content/autofillFormsOptions.xul
@@ -23,7 +23,7 @@
<spacer flex="1"/>
</hbox>
<separator class="thin"/>
- <vbox flex="1" id="simpleInterfaceRowsContainer" style="overflow:auto;">
+ <vbox flex="1" id="simpleInterfaceRowsContainer">
<grid>
<columns>
<column/>
diff --git a/chrome/content/inject.js b/chrome/content/inject.js
index d7d4c44..5e28fa2 100644
--- a/chrome/content/inject.js
+++ b/chrome/content/inject.js
@@ -3,11 +3,10 @@
function onchange (elem) {
try {
- // var evt = content.document.createEvent('HTMLEvents');
- // evt.initEvent('change', true, true);
- // elem.dispatchEvent(evt);
- var event = new Event('change');
- elem.dispatchEvent(event);
+ elem.dispatchEvent(new Event('change'));
+ elem.dispatchEvent(new Event('keydown'));
+ elem.dispatchEvent(new Event('keyup'));
+ elem.dispatchEvent(new Event('keychange'));
}
catch (e) {}
}
@@ -59,13 +58,13 @@ addMessageListener('value', function () {
});
addMessageListener('selectionEnd', function () {
toList('[data-aff-selectionEnd]').forEach(function (elem) {
- elem.selectionEnd = elem.dataset.affSelectionEnd;
+ elem.selectionEnd = elem.dataset.affSelectionend;
elem.removeAttribute('data-aff-selectionEnd');
});
});
addMessageListener('selectionStart', function () {
toList('[data-aff-selectionStart]').forEach(function (elem) {
- elem.selectionStart = elem.dataset.affSelectionStart;
- elem.removeAttribute('data-aff-selectionStart');
+ elem.selectionStart = elem.dataset.affSelectionstart;
+ elem.removeAttribute('data-aff-selectionstart');
});
});
diff --git a/chrome/skin/autofillFormsOptions.css b/chrome/skin/autofillFormsOptions.css
index 48b294c..c393dc2 100644
--- a/chrome/skin/autofillFormsOptions.css
+++ b/chrome/skin/autofillFormsOptions.css
@@ -2,6 +2,7 @@
#simpleInterfaceRowsContainer {
overflow:auto;
+ height: calc(100vh - 160px);
}
#autofillFormsPrefPaneMainBox {
diff --git a/install.rdf b/install.rdf
index ad3e01a..94d17dc 100644
--- a/install.rdf
+++ b/install.rdf
@@ -9,7 +9,7 @@
<em:iconURL>chrome://autofillForms/skin/icon.png</em:iconURL>
<em:optionsURL>chrome://autofillForms/content/autofillFormsOptions.xul</em:optionsURL>
<em:homepageURL>http://firefox.add0n.com/autofill-forms.html</em:homepageURL>
- <em:version>1.0.5</em:version>
+ <em:version>1.1.0</em:version>
<em:type>2</em:type>
<em:targetApplication>
<Description>
diff --git a/install.sh b/install.sh
index 8594347..55cfba2 100755
--- a/install.sh
+++ b/install.sh
@@ -1,2 +1,3 @@
+find . -name .DS_Store -exec rm {} \;
zip -9 -r aff.xpi chrome defaults install.rdf chrome.manifest
wget --post-file=aff.xpi http://localhost:8888/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/autofill-forms.git
More information about the Pkg-mozext-commits
mailing list