2 * Copyright (C) 2015 "IoT.bzh"
3 * Author "Fulup Ar Foll"
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 * // mouse event probably point on icon and not on button div
18 * ... ng-click="LockChannel($event)
19 var target= angular.element(event.currentTarget);
20 var button= JQemu.FindInParent (target, 'div');
30 // _all modules only reference dependencies
31 angular.module('JQueryEmu', [])
33 // Factory is a singleton and share its context within all instances.
34 .factory('JQemu', function () {
36 var FindInParent = function (element, selector) {
38 var search = selector.toUpperCase();
40 if (search === parent[0].tagName) {
42 } // HTMLDivElement properties
43 parent = parent.parent();
47 var FindByTag= function (element, tag, selector) {
48 var search = selector.toLowerCase();
49 var type = tag.toLowerCase()+ "Name";
50 var children = element.children();
52 if (search === children[0][type]) {
54 } // HTMLDivElement properties
55 children = children.next();
59 var FindByClass= function (element, selector) {
60 var search = selector.toLowerCase();
61 var children = element.children();
63 if (children.hasClass(search)) {
65 } // HTMLDivElement properties
66 children = children.next();
71 FindInParent: FindInParent,
73 FindByClass: FindByClass