Created
January 7, 2015 03:13
-
-
Save judell/632cc730c689e1c3572a to your computer and use it in GitHub Desktop.
first step towards a wiki page inspector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function getParas($item) { | |
debugger; | |
var s = ''; | |
var href = $item.parent('.story').prev('.header').find('a').attr('href') | |
var id = href.match(/[^\/]+$/)[0]; | |
var paras = $('#' + id).find('.paragraph p'); | |
for ( var i = 0; i < paras.length; i++ ) { | |
var p = paras[i].innerText.substr(0,50) + ' ...'; | |
s += '<p><b>' + i + '</b>: ' + p + '</p>'; | |
} | |
return s; | |
} | |
window.plugins.inspector = { | |
emit: function($item, item) {}, | |
bind: function($item, item) { | |
return $('body').on('dom-change', function(e, site) { | |
var _results = []; | |
_results.push($item.append(getParas($item))); | |
return _results; | |
}); | |
} | |
}; | |
}).call(this); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment