Repository: madrobby/dom-monster Branch: master Commit: 405c86aaad73 Files: 7 Total size: 61.8 KB Directory structure: gitextract_psp5f26d/ ├── .gitignore ├── MIT-LICENSE ├── README.rdoc ├── Rakefile ├── bookmarklet-local.html ├── bookmarklet.html └── src/ └── dommonster.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store dist/ ================================================ FILE: MIT-LICENSE ================================================ Copyright (c) 2009-2011 Amy Hoy & Thomas Fuchs http://mir.aculo.us/dom-monster Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.rdoc ================================================ == DOM Monster: a cross-platform, cross-browser bookmarklet that will analyze the DOM & other features of the page you're on, and give you its bill of health Just install the DOM Monster bookmarklet, and use it on any web page or app. If there are problems, DOM Monster will point them out and even make suggestions on how to fix 'em. Learn more about the DOM Monster at http://mir.aculo.us/dom-monster = License DOM Monster is is licensed under the terms of the MIT License, see the included MIT-LICENSE file. ================================================ FILE: Rakefile ================================================ require 'rake' DOMMONSTER_VERSION = "1.3.0" DOMMONSTER_ROOT = File.expand_path(File.dirname(__FILE__)) DOMMONSTER_SRC_DIR = File.join(DOMMONSTER_ROOT, 'src') DOMMONSTER_DIST_DIR = File.join(DOMMONSTER_ROOT, 'dist') DOMMONSTER_FILES = [ File.join(DOMMONSTER_SRC_DIR,'dommonster.js'), ] task :default => [:clean, :concat, :dist] desc "Clean the distribution directory." task :clean do rm_rf DOMMONSTER_DIST_DIR mkdir DOMMONSTER_DIST_DIR end def normalize_whitespace(filename) contents = File.readlines(filename) contents.each { |line| line.sub!(/\s+$/, "") } File.open(filename, "w") do |file| file.write contents.join("\n").sub(/(\n+)?\Z/m, "\n") end end desc "Strip trailing whitespace and ensure each file ends with a newline" task :whitespace do Dir["*", "src/**/*", "test/**/*", "examples/**/*"].each do |filename| normalize_whitespace(filename) if File.file?(filename) end end desc "Concatenate DOM Monster files to build a distributable dommonster.js file" task :concat => :whitespace do File.open(File.join(DOMMONSTER_DIST_DIR,'dommonster.js'),"w") do |f| f.puts DOMMONSTER_FILES.map{ |s| IO.read(s) } end end def uglifyjs(src, target) begin require 'uglifier' rescue LoadError => e if verbose puts "\nYou'll need the 'uglifier' gem for minification. Just run:\n\n" puts " $ gem install uglifier" puts "\nand you should be all set.\n\n" exit end return false end puts "Minifying #{src} with UglifyJS..." File.open(target, "w"){|f| f.puts Uglifier.new.compile(File.read(src))} end def process_minified(src, target) cp target, File.join(DOMMONSTER_DIST_DIR,'temp.js') msize = File.size(File.join(DOMMONSTER_DIST_DIR,'temp.js')) `gzip -9 #{File.join(DOMMONSTER_DIST_DIR,'temp.js')}` osize = File.size(src) dsize = File.size(File.join(DOMMONSTER_DIST_DIR,'temp.js.gz')) rm_rf File.join(DOMMONSTER_DIST_DIR,'temp.js.gz') puts "Original version: %.3fk" % (osize/1024.0) puts "Minified: %.3fk" % (msize/1024.0) puts "Minified and gzipped: %.3fk, compression factor %.3f" % [dsize/1024.0, osize/dsize.to_f] end desc "Generates a minified version for distribution." task :dist do src, target = File.join(DOMMONSTER_DIST_DIR,'dommonster.js'), File.join(DOMMONSTER_DIST_DIR,'dommonster.min.js') uglifyjs src, target process_minified src, target end ================================================ FILE: bookmarklet-local.html ================================================ DOM Monster Bookmarklet

Meet the DOM Monster!

DOM Monster is our answer to JavaScript performance tools that just don’t give you the full picture.

DOM Monster is a cross-platform, cross-browser bookmarklet that will analyze the DOM & other features of the page you’re on, and give you its bill of health.

If there are problems, DOM Monster will point them out — and even make suggestions on how to fix ’em.

Drag the to your bookmarks bar! This version of the DOM Monster is loaded from your local development folder.

DOM Monster! is the brainchild of Amy Hoy and was programmed by Thomas Fuchs.

We'll keep the DOM Monster! up to date and feed it with the latest in page analyzing features for you! You don't have to update or reinstall the bookmarklet to always get the latest and greatest version! Be sure to drag the DOM Monster! to your bookmarks bar in all browsers you want to test in!

The DOM Monster is open source. Contribute your own tips and tests. Visit the DOM Monster repository on GitHub.

JavaScript Rocks! Learn more about the DOM Monster! and how to deal with DOM and JavaScript performance issues! Grab a copy of our
JavaScript Rocks! performance ebook.

================================================ FILE: bookmarklet.html ================================================ DOM Monster Bookmarklet

Meet the DOM Monster!

DOM Monster is our answer to JavaScript performance tools that just don’t give you the full picture.

DOM Monster is a cross-platform, cross-browser bookmarklet that will analyze the DOM & other features of the page you’re on, and give you its bill of health.

If there are problems, DOM Monster will point them out — and even make suggestions on how to fix ’em.

Drag the DOM Monster! to your bookmarks bar!

DOM Monster! is the brainchild of Amy Hoy and was programmed by Thomas Fuchs.

We'll keep the DOM Monster! up to date and feed it with the latest in page analyzing features for you! You don't have to update or reinstall the bookmarklet to always get the latest and greatest version! Be sure to drag the DOM Monster! to your bookmarks bar in all browsers you want to test in!

The DOM Monster is open source. Contribute your own tips and tests. Visit the DOM Monster repository on GitHub.

JavaScript Rocks! Learn more about the DOM Monster! and how to deal with DOM and JavaScript performance issues! Grab a copy of our
JavaScript Rocks! performance ebook.

================================================ FILE: src/dommonster.js ================================================ /* * DOM MONSTER * Copyright (c) 2009-2013 Amy Hoy & Thomas Fuchs * This code is licensed under the terms of the MIT LICENSE * http://mir.aculo.us/dom-monster * * includes JAVASCRIPT STACKTRACE * see https://github.com/emwendelin/javascript-stacktrace * for license information */ (function(){ var JR = { Version: '1.3.2' }; // IE does not seem to properly define the indexOf for arrays. if ("undefined" === typeof(Array.prototype.indexOf)) { Array.prototype.indexOf = function (object, index) { var length = this.length; index = index || 0; if (index < 0) { index += length; } for (; index < length; ++index) { if (this[index] === object) { return index; } } return -1; }; } function $(id){ return document.getElementById(id); } function $tagname(tagname) { var nodes = document.getElementsByTagName(tagname), retValue = []; for (var i = nodes.length - 1; i >= 0; i = i - 1) { retValue[i] = nodes[i]; } return retValue; // This is yields undefined behavior according to the ECMA spec // since this is returns a NodeList which is a host object. // This causes a break in IE. //return [].slice.call(document.getElementsByTagName(tagname)); } JR._lines = { info:[], tip:[], warn:[] }; JR._console = ('console' in window && 'log' in console && 'warn' in console && 'info' in console); JR.reset = " margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align: baseline;color:inherit;line-height:inherit;"; function html(str){ return str.replace(//g,'>'); } function dmlink(str, url){ return ''+html(str)+''; } function unique(arr){ var hash={}, result=[]; for (var i=0, l=arr.length; i