Committer: vvasin
LJSUP-13657: not working JS when Expand new lj-cut. Fix lj-likes and contextual popup.U trunk/htdocs/js/jquery_fn.js
Modified: trunk/htdocs/js/jquery_fn.js =================================================================== --- trunk/htdocs/js/jquery_fn.js 2012-09-18 07:43:26 UTC (rev 22913) +++ trunk/htdocs/js/jquery_fn.js 2012-09-18 08:17:57 UTC (rev 22914) @@ -445,4 +445,26 @@ return (el.bottom > win.top && el.top < win.bottom) && (el.right > win.left && el.left < win.right); }; +}(jQuery)); + +/** + * Parse lj-likes plugin + * It parse all elements with class 'lj-like', uncomment their content + * and parse with LiveJournal.parseLikeButtons() + */ +;(function ($) { + 'use strict'; + + $.fn.ljLikes = function () { + + return $(this).each(function () { + $(this).find('.lj-like').each(function () { + $(this).html(function (html) { + // remove comments node + return $.trim( $(this).html().replace(/<!--([\s\S]*?)-->/mig, '$1') ); + }); + LiveJournal.parseLikeButtons($(this)); + }); + }); + }; }(jQuery)); \ No newline at end of file