From 89ba802b23bf1fd22afbc5e9a4b3b732264e3c18 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 4 Nov 2014 15:57:23 +0000 Subject: Move webclient to a python module so that it can be installed --- webclient/js/autofill-event.js | 117 ----------------------------------------- 1 file changed, 117 deletions(-) delete mode 100755 webclient/js/autofill-event.js (limited to 'webclient/js/autofill-event.js') diff --git a/webclient/js/autofill-event.js b/webclient/js/autofill-event.js deleted file mode 100755 index 006f83e1be..0000000000 --- a/webclient/js/autofill-event.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Autofill event polyfill ##version:1.0.0## - * (c) 2014 Google, Inc. - * License: MIT - */ -(function(window) { - var $ = window.jQuery || window.angular.element; - var rootElement = window.document.documentElement, - $rootElement = $(rootElement); - - addGlobalEventListener('change', markValue); - addValueChangeByJsListener(markValue); - - $.prototype.checkAndTriggerAutoFillEvent = jqCheckAndTriggerAutoFillEvent; - - // Need to use blur and not change event - // as Chrome does not fire change events in all cases an input is changed - // (e.g. when starting to type and then finish the input by auto filling a username) - addGlobalEventListener('blur', function(target) { - // setTimeout needed for Chrome as it fills other - // form fields a little later... - window.setTimeout(function() { - findParentForm(target).find('input').checkAndTriggerAutoFillEvent(); - }, 20); - }); - - window.document.addEventListener('DOMContentLoaded', function() { - // The timeout is needed for Chrome as it auto fills - // login forms some time after DOMContentLoaded! - window.setTimeout(function() { - $rootElement.find('input').checkAndTriggerAutoFillEvent(); - }, 200); - }, false); - - return; - - // ---------- - - function jqCheckAndTriggerAutoFillEvent() { - var i, el; - for (i=0; i 0) { - forEach(this, function(el) { - listener(el, newValue); - }); - } - return res; - } - } - - function addGlobalEventListener(eventName, listener) { - // Use a capturing event listener so that - // we also get the event when it's stopped! - // Also, the blur event does not bubble. - rootElement.addEventListener(eventName, onEvent, true); - - function onEvent(event) { - var target = event.target; - listener(target); - } - } - - function findParentForm(el) { - while (el) { - if (el.nodeName === 'FORM') { - return $(el); - } - el = el.parentNode; - } - return $(); - } - - function forEach(arr, listener) { - if (arr.forEach) { - return arr.forEach(listener); - } - var i; - for (i=0; i