Skip to content

Instantly share code, notes, and snippets.

@judell
Created January 7, 2015 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judell/632cc730c689e1c3572a to your computer and use it in GitHub Desktop.
Save judell/632cc730c689e1c3572a to your computer and use it in GitHub Desktop.
first step towards a wiki page inspector
(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