diff options
| author | dsc <xmrdsc@protonmail.com> | 2019-03-18 00:12:51 +0100 |
|---|---|---|
| committer | dsc <xmrdsc@protonmail.com> | 2019-04-08 21:28:51 +0200 |
| commit | 7611e826aa2be305e2bfcc22361deb4d03d76c8d (patch) | |
| tree | d1fd3396a5bf336cde2e66e4e3b7d28cf000e9a9 /js | |
| parent | 98a7a9e66335c463b7a12d32f84bdf83ba75c925 (diff) | |
| download | monzero-gui-7611e826aa2be305e2bfcc22361deb4d03d76c8d.tar.gz monzero-gui-7611e826aa2be305e2bfcc22361deb4d03d76c8d.tar.xz monzero-gui-7611e826aa2be305e2bfcc22361deb4d03d76c8d.zip | |
History redesign
Diffstat (limited to 'js')
| -rw-r--r-- | js/Utils.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/Utils.js b/js/Utils.js index f02303c5..ec3a6851 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -125,4 +125,31 @@ function isUpperLock(shift, letter){ else return true; } + +function qmlEach(item, properties, ignoredObjectNames, arr){ + // Traverse QML object tree and return components that match + // via property names. Similar to jQuery("myclass").each(... + // item: root QML object + // properties: list of strings + // ignoredObjectNames: list of strings + if(typeof(arr) == 'undefined') arr = []; + if(item.hasOwnProperty('data') && item['data'].length > 0){ + for(var i = 0; i < item['data'].length; i += 1){ + arr = qmlEach(item['data'][i], properties, ignoredObjectNames, arr); + } + } + + // ignore QML objects on .objectName + for(var a = 0; a < ignoredObjectNames.length; a += 1){ + if(item.objectName === ignoredObjectNames[a]){ + return arr; + } + } + + for(var u = 0; u < properties.length; u += 1){ + if(item.hasOwnProperty(properties[u])) arr.push(item); + else break; + } + + return arr; } |
