Sha256: 5f0aec8f13bea2b541058600418348a007ae1f00e3d132b7c366869b5ab0ab79
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
var rgUtils = {}; var uniqueIds = []; rgUtils.query = jQuery; rgUtils.toInt = function(n){ return Math.round(Number(n)); }; rgUtils.hasText = function($thing){ var isTxt = true; if($thing.text() == ""){ isTxt = false; } return isTxt; }; rgUtils.isVisible = function($thing) { return $thing.is(':visible'); }; function RecurseDomJSON($item, domJSON) { $item.each(function() { try{ domJSON += '{"tagName":' + '"' + rgUtils.query(this).get(0).tagName + '"' + ',' + '"id":' + '"' + rgUtils.query(this).attr("id") + '"' + ',' + '"top":' + '"' + rgUtils.toInt(rgUtils.query(this).offset().top) + '"' + ',' + '"left":' + '"' + rgUtils.toInt(rgUtils.query(this).offset().left) + '"' + ',' + '"xpath":' + '"' + rgUtils.query(this).ellocate(uniqueIds).xpath + '"' + ',' + '"width":' + '"' + rgUtils.toInt(rgUtils.query(this).width()) + '"' + ',' + '"height":' + '"' + rgUtils.toInt(rgUtils.query(this).height()) + '"' + ',' + '"isVisible":' + '"' + rgUtils.isVisible(rgUtils.query(this)) + '"' + ',' + '"hasText":' + '"' + rgUtils.hasText(rgUtils.query(this)) +'"},\n\t' ; } catch(err){ } // Perhaps errors could be thrown in a configurable "strict" mode. }); uniqueIds = []; return domJSON; }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
red-glass-0.1.4 | lib/red-glass/red-glass-js/serialize-dom.js |
red-glass-0.1.3 | lib/red-glass/red-glass-js/serialize-dom.js |
red-glass-0.1.2 | lib/red-glass/red-glass-js/serialize-dom.js |