jacobwb / hashover-next

This branch will be HashOver 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS Minification Cause JS Error on Medium & High Level

seinshah opened this issue · comments

Hi JB and thank you for your work here.

After integrating Hashover-Next with my weblog and setting minification level to medium and high levels, hashover won't be loaded on my website due to an error in comments.php. If it matters, I'm using remote request.
The error is look like as below:

image

Also the code that triggers the error is as below:

// Copyright (C) 2010-2019 Jacob Barkdull
// Under the terms of the GNU Affero General Public License.
// This program source code has been minified.
//
// Unminified version:
// https://comment.hossein.blog/comments.php?unminified

"use strict";var HashOver = HashOver || function HashOver (id, options, instance) {this.createThread.apply (this, arguments);};HashOver.frontendReady = true;HashOver.backendReady = false;HashOver.instanceCount = 1;var HashOverConstructor = HashOver;HashOverConstructor.onReady = function (callback){var state = document.readyState;if (state === 'interactive' || state === 'complete') {callback ();} else {document.addEventListener ('DOMContentLoaded', function () {callback ();}, false);}};HashOverConstructor.script = (function () {var loaderScript = document.getElementById ('hashover-loader');var scripts = document.getElementsByTagName ('script');var currentScript = document.currentScript || loaderScript;return currentScript || scripts[scripts.length - 1];}) ();HashOverConstructor.getCanonical = function (){if (typeof (document.querySelector) === 'function') {var canonical = document.querySelector ('link[rel="canonical"]');if (canonical !== null && canonical.href) {return canonical.href;}}var head = document.head || document.getElementsByTagName ('head')[0];var links = head.getElementsByTagName ('link');for (var i = 0, il = links.length; i < il; i++) {if (links[i].rel === 'canonical' && links[i].href) {return links[i].href;}}return window.location.href.split ('#')[0];};HashOverConstructor.getURL = function (canonical){if (canonical === false) {return window.location.href.split ('#')[0];}return HashOverConstructor.getCanonical ();};HashOverConstructor.getTitle = function (){return document.title;};HashOverConstructor.cfgQueries = function (value, name, queries){name = name || [];queries = queries || [];if (typeof (value) !== 'object') {var matrix = '[' + name.join ('][') + ']';var value = encodeURIComponent (value);queries.push ('cfg' + matrix + '=' + value);return;}for (var key in value) {HashOverConstructor.cfgQueries (value[key], name.concat (key), queries);}return queries;};HashOverConstructor.getClientTime = function (){var datetime = new Date ();var hours = datetime.getHours ();var minutes = datetime.getMinutes ();var time = hours + ':' + minutes;return time;}HashOver.getBackendQueries = function (options, instance){options = options || {};var data = {};var loaderOptions = HashOver.loaderOptions;var queries = [];if (loaderOptions && loaderOptions.constructor === Object) {for (var key in loaderOptions) {if (options[key] === undefined) {options[key] = loaderOptions[key];}}}data.instance = instance;data.url = options.url || this.getURL (options.canonical);data.title = options.title || this.getTitle ();if (typeof (options.website) === 'string') {data.website = options.website;}if (typeof (options.thread) === 'string') {data.thread = options.thread;}for (var name in data) {if (data.hasOwnProperty (name) === true) {queries.push (name + '=' + encodeURIComponent (data[name]));}}if (options.settings && options.settings.constructor === Object) {var cfgQueries = HashOver.cfgQueries (loaderOptions.settings);queries = queries.concat (cfgQueries);}if (HashOver.backendReady !== true) {queries.push ('prepare=true');}return queries;};HashOverConstructor.jsonp = [function (json) { alert (json.message); }];HashOverConstructor.prototype.jsonp = function (method, path, data, callback, async){var source = this.constructor.toString ();var constructor = source.match (/function (\w+)/)[1];this.constructor.jsonp.push (callback);data.push ('jsonp=' + (this.constructor.jsonp.length - 1));data.push ('jsonp_object=' + constructor || 'HashOver');var script = document.createElement ('script');script.src = path + '?' + data.join ('&');script.async = async;document.body.appendChild (script);};HashOverConstructor.prototype.ajax = function (method, path, data, callback, async){var hashover = this;var args = arguments;var onSuccess = function (){var json = JSON.parse (this.responseText);callback.apply (this, [ json ]);};var onError = function (){hashover.jsonp.apply (hashover, args);hashover.ajax = hashover.jsonp;};if ('withCredentials' in new XMLHttpRequest ()) {var xhr = new XMLHttpRequest ();xhr.onreadystatechange = function (){if (this.readyState !== 4) {return;}if (this.status === 200) {return onSuccess.apply (this);}if (this.status === 0) {return onError ();}};xhr.open (method, path, async);xhr.setRequestHeader ('Content-type', 'application/x-www-form-urlencoded');xhr.withCredentials = true;xhr.send (data.join ('&'));return;}if (typeof (XDomainRequest) !== 'undefined') {var xdr = new XDomainRequest ();xdr.open (method, path);xdr.onload = onSuccess;xdr.onerror = onError;setTimeout (xdr.send, 0);return;}onError ();};HashOverConstructor.rootPath = (function () {var scriptSrc = HashOverConstructor.script.getAttribute ('src');var root = scriptSrc.replace (/\/[^\/]*\/?$/, '');return root;}) ();HashOverConstructor.backendPath = (function () {return HashOverConstructor.rootPath + '/backend';}) ();HashOver.instantiator = function (id, options, instance){var hashover = this;var specific = this.rx.integer.test (instance);var instance = specific ? instance : HashOver.instanceCount;var requestPath = HashOver.backendPath + '/comments-ajax.php';var backendQueries = HashOver.getBackendQueries (options, instance);var queries = backendQueries.concat (['time=' + HashOver.getClientTime ()]);this.instanceNumber = instance;this.options = options;this.queries = backendQueries;this.ajax ('POST', requestPath, queries, function (json) {if (json.message !== undefined) {hashover.displayError (json);return;}if (HashOver.backendReady !== true) {HashOver.prototype.locale = json.locale;HashOver.prototype.setup = json.setup;HashOver.prototype.ui = hashover.strings.templatify (json.ui);HashOver.backendReady = true;}hashover.instance = json.instance;hashover.instance.collapseLimit = 0;hashover.statistics = json.statistics;console.log (hashover.strings.sprintf ('HashOver: backend %d ms, %s', [json.statistics['execution-time'],json.statistics['script-memory']]));hashover.init (id);}, true);if (specific === false) {HashOver.instanceCount++;}};HashOver.prototype.createThread = function (id, options, instance){var hashover = this;var args = arguments;if (HashOver.backendReady === true || HashOver.instanceCount === 1) {HashOver.onReady (function () {HashOver.instantiator.apply (hashover, args);});} else {setTimeout (function () {hashover.createThread.apply (hashover, args);}, 10);}};HashOverConstructor.prototype.addProperties = function (element, properties){if (!element || !properties || properties.constructor !== Object) {return element;}for (var property in properties) {if (properties.hasOwnProperty (property) === false) {continue;}var value = properties[property];if (!!value && value.constructor === Object) {this.addProperties (element[property], value);continue;}element[property] = value;}return element;};HashOverConstructor.prototype.createElement = function (name, attr){var element = document.createElement (name || 'span');if (attr && attr.constructor === Object) {element = this.addProperties (element, attr);}return element;};HashOverConstructor.prototype.classes = new (function () {if (document.documentElement.classList) {this.contains = function (element, name) {return element.classList.contains (name);};this.add = function (element, name) {element.classList.add (name);};this.remove = function (element, name) {element.classList.remove (name);};return;}this.contains = function (element, name){if (element && element.className) {var rx = new RegExp ('(^|\\s)' + name + '(\\s|$)');return rx.test (element.className);}return false;};this.add = function (element, name){if (element && !this.contains (element, name)) {element.className += (element.className ? ' ' : '') + name;}};this.remove = function (element, name){if (element && element.className) {var rx = new RegExp ('(^|\\s)' + name + '(\\s|$)', 'g');element.className = element.className.replace (rx, '$2');}};}) ();HashOverConstructor.prototype.getMainElement = function (id){id = id || this.prefix ();var element = document.getElementById (id);if (element === null) {var script = this.constructor.script;element = this.createElement ('div', { id: id });if (document.body.contains (script) === true) {script.parentNode.insertBefore (element, script);} else {document.body.appendChild (element);}}this.classes.add (element, 'hashover');if (this.constructor.backendReady === true) {this.classes.add (element, 'hashover-' + this.setup['device-type']);if (this.setup['image-format'] === 'svg') {this.classes.add (element, 'hashover-vector');} else {this.classes.add (element, 'hashover-raster');}if (this.setup['user-is-logged-in'] === true) {this.classes.add (element, 'hashover-logged-in');} else {this.classes.add (element, 'hashover-logged-out');}}return element;};HashOverConstructor.prototype.displayError = function (json, id){var mainElement = this.getMainElement (id);var messageHTML = '<b>HashOver</b>: ' + json.message;mainElement.innerHTML = messageHTML;};HashOverConstructor.prototype.prefix = function (id){var prefix = 'hashover';if (this.instanceNumber > 1) {prefix += '-' + this.instanceNumber;}if (id) {return prefix + '-' + id;}return prefix;};HashOverConstructor.prototype.rx = new (function () {this.urls = '((http|https|ftp):\/\/[a-z0-9-@:;%_\+.~#?&\/=]+)',this.links = new RegExp (this.urls + '( {0,1})', 'ig'),this.thread = /^(c[0-9r]+)r[0-9\-pop]+$/,this.imageTags = new RegExp ('\\[img\\](<a.*?>' + this.urls + '</a>)\\[/img\\]', 'ig'),this.EOLTrim = /^[\r\n]+|[\r\n]+$/g,this.paragraphs = /(?:\r\n|\r|\n){2}/g,this.email = /\S+@\S+/,this.integer = /^\d+$/}) ();HashOverConstructor.prototype.EOLTrim = function (string){return string.replace (this.rx.EOLTrim, '');};HashOverConstructor.prototype.strings = {specifiers: /%([cdfs])/g,curlyBraces: /(\{.+?\})/g,curlyNames: /\{(.+?)\}/,sprintf: function (string, args){var string = string || '';var args = args || [];var count = 0;return string.replace (this.specifiers, function (match, type){if (args[count] === undefined) {return match;}switch (type) {case 'c': {return args[count++][0];}case 'd': {return parseInt (args[count++]);}case 'f': {return parseFloat (args[count++]);}case 's': {return args[count++];}}});},templatifier: function (text){var template = text.split (this.curlyBraces);var indexes = {};for (var i = 0, il = template.length; i < il; i++) {var curly = template[i].match (this.curlyNames);if (curly !== null && curly[1] !== undefined) {var name = curly[1];if (indexes[name] !== undefined) {indexes[name].push (i);} else {indexes[name] = [ i ];}template[i] = '';}}return {template: template,indexes: indexes}},templatify: function (ui){var template = {};for (var name in ui) {if (ui.hasOwnProperty (name) === true) {template[name] = this.templatifier (ui[name]);}}return template;},parseTemplate: function (template, data){var textClone = template.template.slice ();for (var name in data) {var indexes = template.indexes[name];if (indexes === undefined) {continue;}for (var i = 0, il = indexes.length; i < il; i++) {textClone[(indexes[i])] = data[name];}}var text = textClone.join ('');return text;}};HashOverConstructor.prototype.permalinkParent = function (permalink){var parent = permalink.split ('r');var length = parent.length - 1;if (this.setup['stream-mode'] === true) {length = Math.min (this.setup['stream-depth'], length);}if (length > 0) {parent = parent.slice (0, length);return parent.join ('r');}return null;};HashOverConstructor.prototype.permalinkComment = function (permalink, comments){for (var i = 0, il = comments.length; i < il; i++) {var comment = comments[i];if (comment.permalink === permalink) {return comment;}if (comment.replies !== undefined) {var reply = this.permalinkComment (permalink, comment.replies);if (reply !== null) {return reply;}}}return null;};HashOver.prototype.addRatings = function (comment, template, action, commentKey){var opposite = (action === 'like') ? 'dislike' : 'like';var prefix = this.prefix ();if (comment['user-owned'] === undefined) {if (comment[action + 'd'] !== undefined) {var className = 'hashover-' + action + 'd';var title = this.locale[action + 'd-comment'];var text = this.locale[action + 'd'];} else {var className = 'hashover-' + action;var title = this.locale[action + '-comment'];var text = this.locale[action];}if (this.setup['allows-' + opposite + 's'] === true) {className += ' hashover-' + opposite + 's-enabled';}template[action + '-link'] = this.strings.parseTemplate (this.ui[action + '-link'], {hashover: prefix,permalink: commentKey,class: className,title: title,text: text});}if (comment[action + 's'] !== undefined) {template[action + 's'] = comment[action + 's'];if (comment[action + 's'] !== 1) {var count = comment[action + 's'] + ' ' + this.locale[action + 's'];} else {var count = comment[action + 's'] + ' ' + this.locale[action];}}template[action + '-count'] = this.strings.parseTemplate (this.ui[action + '-count'], {hashover: prefix,permalink: commentKey,text: count || ''});};HashOverConstructor.prototype.optionalMethod = function (name, args, object){var method = object ? this[object][name] : this[name];var context = object ? this[object] : this;if (method && typeof (method) === 'function') {return method.apply (context, args);}};HashOverConstructor.prototype.rx.md = {blockCode: /```([\s\S]+?)```/g,inlineCode: /(^|[^a-z0-9`])`((?!`)[\s\S]+?)`([^a-z0-9`]|$)/ig,blockMarker: /CODE_BLOCK\[([0-9]+)\]/g,inlineMarker: /CODE_INLINE\[([0-9]+)\]/g,search: [/\*\*([^ *])([\s\S]+?)([^ *])\*\*/g,/\*([^ *])([\s\S]+?)([^ *])\*/g,/(^|\W)_((?!_)[\s\S]+?)_(\W|$)/g,/__([^ _])([\s\S]+?)([^ _])__/g,/~~([^ ~])([\s\S]+?)([^ ~])~~/g],replace: ['<strong>$1$2$3</strong>','<em>$1$2$3</em>','$1<u>$2</u>$3','<u>$1$2$3</u>','<s>$1$2$3</s>']};HashOverConstructor.prototype.parseMarkdown = function (string){var hashover = this;var block = { marks: [], count: 0 };var inline = { marks: [], count: 0 };var inlineReplacer = function (m, first, code, third){var markCount = inline.count++;var marker = 'CODE_INLINE[' + markCount + ']';inline.marks[markCount] = hashover.EOLTrim (code);return first + marker + third;};string = string.replace (this.rx.md.blockCode, function (m, code) {var markCount = block.count++;block.marks[markCount] = hashover.EOLTrim (code);return 'CODE_BLOCK[' + markCount + ']';});var ps = string.split (this.rx.paragraphs);for (var i = 0, il = ps.length; i < il; i++) {ps[i] = ps[i].replace (this.rx.md.inlineCode, inlineReplacer);for (var r = 0, rl = this.rx.md.search.length; r < rl; r++) {ps[i] = ps[i].replace (this.rx.md.search[r], this.rx.md.replace[r]);}ps[i] = ps[i].replace (this.rx.md.inlineMarker, function (marker, number) {return '<code class="hashover-inline">' + inline.marks[number] + '</code>';});}string = ps.join (this.setup['server-eol'] + this.setup['server-eol']);string = string.replace (this.rx.md.blockMarker, function (marker, number) {return '<code>' + block.marks[number] + '</code>';});return string;};HashOverConstructor.prototype.closeEmbeddedImage = function (image){image.onload = function (){this.title = hashover.locale['external-image-tip'];hashover.classes.remove (this.parentNode, 'hashover-loading');hashover.classes.remove (this.parentNode, 'hashover-embedded-image-open');this.onload = null;};image.src = image.dataset.placeholder;};HashOverConstructor.prototype.openEmbeddedImage = function (image){var hashover = this;if (image.src === image.dataset.url) {this.closeEmbeddedImage (image);return;}image.title = this.locale['loading'];this.classes.add (image.parentNode, 'hashover-loading');image.onload = function (){this.title = hashover.locale['click-to-close'];hashover.classes.remove (this.parentNode, 'hashover-loading');hashover.classes.add (this.parentNode, 'hashover-embedded-image-open');this.onload = null;};image.onerror = function () {hashover.closeEmbeddedImage (this);};image.src = image.dataset.url;};HashOverConstructor.prototype.embedImage = function (m, link, url){var hashover = this;var urlExtension = url.split ('#')[0];urlExtension = urlExtension.split ('?')[0];urlExtension = urlExtension.split ('.');urlExtension = urlExtension.pop ();if (this.setup['image-extensions'].indexOf (urlExtension) > -1) {var embeddedImage = this.createElement ('span', {className: 'hashover-embedded-image-wrapper'});embeddedImage.appendChild (this.createElement ('img', {className: 'hashover-embedded-image',src: this.setup['image-placeholder'],title: this.locale['external-image-tip'],alt: 'External Image',dataset: {placeholder: hashover.setup['image-placeholder'],url: url}}));return embeddedImage.outerHTML;}return link;};HashOverConstructor.prototype.rx.html = {linksReplace: '<a href="$1" rel="noopener noreferrer" target="_blank">$1</a>',lines: /(?:\r\n|\r|\n)/g,code: {open: /<code>/i,replace: /(<code>)([\s\S]*?)(<\/code>)/ig,marker: /CODE_TAG\[([0-9]+)\]/g},pre: {open: /<pre>/i,replace: /(<pre>)([\s\S]*?)(<\/pre>)/ig,marker: /PRE_TAG\[([0-9]+)\]/g},trimTags: {open: /<(blockquote|ul|ol)>/,replace: /(<(blockquote|ul|ol)>)([\s\S]*?)(<\/\2>)/ig}};HashOverConstructor.prototype.parseComment = function (comment, parent, collapse, popular){parent = parent || null;var hashover = this;var commentKey = comment.permalink;var permalink = this.prefix (commentKey);var nameClass = 'hashover-name-plain';var commentDate = comment.date;var codeTagCount = 0;var codeTags = [];var preTagCount = 0;var preTags = [];var classes = '';var replies = '';var prefix = this.prefix ();var template = {hashover: prefix,permalink: commentKey};var permatext = commentKey.slice(1).split('r').pop();if (popular === true) {parent = this.permalinkParent (commentKey);if (parent !== null) {parent = this.permalinkComment (parent, this.instance.comments.primary);}permatext = permatext.replace ('-pop', '');} else {if (parent !== null) {classes += ' hashover-reply';}if (collapse === true && this.instance['total-count'] > 0) {if (this.instance.collapseLimit >= this.setup['collapse-limit']) {classes += ' hashover-hidden';} else {this.instance.collapseLimit++;}}}template.avatar = this.strings.parseTemplate (this.ui['user-avatar'], {src: comment.avatar,href: permalink,text: permatext});if (comment.notice === undefined) {var name = comment.name || this.setup['default-name'];var website = comment.website;var isTwitter = (name.charAt (0) === '@');if (isTwitter === true) {name = name.slice (1);nameClass = 'hashover-name-twitter';var nameLength = name.length;if (nameLength > 1 && nameLength <= 30) {if (website === undefined) {website = 'http://twitter.com/' + name;}}}if (website !== undefined) {if (isTwitter === false) {nameClass = 'hashover-name-website';}var nameElement = this.strings.parseTemplate (this.ui['name-link'], {hashover: prefix,href: website,permalink: commentKey,name: name});} else {var nameElement = this.strings.parseTemplate (this.ui['name-span'], {hashover: prefix,permalink: commentKey,name: name});}if ((comment.url && comment.title) !== undefined) {template['thread-link'] = this.strings.parseTemplate (this.ui['thread-link'], {url: comment.url,title: comment.title});}if (parent !== null && this.ui['parent-link'] !== undefined) {var parentThread = 'hashover-' + parent.permalink;var parentName = parent.name || this.setup['default-name'];template['parent-link'] = this.strings.parseTemplate (this.ui['parent-link'], {hashover: prefix,href: comment.url || this.instance['file-path'],parent: parentThread,permalink: commentKey,name: parentName});}if (comment['user-owned'] !== undefined) {classes += ' hashover-user-owned';var replyTitle = this.locale['commenter-tip'];var replyClass = 'hashover-no-email';} else {if (comment.subscribed === true) {var replyTitle = name + ' ' + this.locale['subscribed-tip'];var replyClass = 'hashover-has-email';} else{var replyTitle = name + ' ' + this.locale['unsubscribed-tip'];var replyClass = 'hashover-no-email';}}if ((comment['editable'] && this.ui['edit-link']) !== undefined) {template['edit-link'] = this.strings.parseTemplate (this.ui['edit-link'], {hashover: prefix,href: comment.url || this.instance['file-path'],permalink: commentKey});}if (this.setup['allows-likes'] !== false) {this.optionalMethod ('addRatings', [comment, template, 'like', commentKey]);}if (this.setup['allows-dislikes'] !== false) {this.optionalMethod ('addRatings', [comment, template, 'dislike', commentKey]);}template.name = this.strings.parseTemplate (this.ui['name-wrapper'], {class: nameClass,link: nameElement});if (comment['status-text'] !== undefined) {commentDate += ' (' + comment['status-text'] + ')';}template.date = this.strings.parseTemplate (this.ui['date-link'], {hashover: prefix,href: comment.url || this.instance['file-path'],permalink: 'hashover-' + commentKey,title: comment['date-time'],date: commentDate});template['reply-link'] = this.strings.parseTemplate (this.ui['reply-link'], {hashover: prefix,href: comment.url || this.instance['file-path'],permalink: commentKey,class: replyClass,title: replyTitle});if (comment.replies !== undefined) {template['reply-count'] = comment.replies.length;if (template['reply-count'] > 0) {if (template['reply-count'] !== 1) {template['reply-count'] += ' ' + this.locale['replies'];} else {template['reply-count'] += ' ' + this.locale['reply'];}}}var body = comment.body.replace (this.rx.links, this.rx.html.linksReplace);if (hashover.setup['allows-images'] !== false) {body = body.replace (this.rx.imageTags, function (m, link, url) {return hashover.optionalMethod ('embedImage', arguments);});}if (this.parseMarkdown !== undefined) {body = this.parseMarkdown (body);}if (this.rx.html.code.open.test (body) === true) {var codeReplacer = function (fullTag, open, html, close) {var codeMarker = open + 'CODE_TAG[' + codeTagCount + ']' + close;codeTags[codeTagCount] = hashover.EOLTrim (html);codeTagCount++;return codeMarker;};body = body.replace (this.rx.html.code.replace, codeReplacer);}if (this.rx.html.pre.open.test (body) === true) {var preReplacer = function (fullTag, open, html, close) {var preMarker = open + 'PRE_TAG[' + preTagCount + ']' + close;preTags[preTagCount] = hashover.EOLTrim (html);preTagCount++;return preMarker;};body = body.replace (this.rx.html.pre.replace, preReplacer);}if (this.rx.html.trimTags.open.test (body) === true) {var tagTrimmer = function (fullTag, open, name, html, close) {return open + hashover.EOLTrim (html) + close;};body = body.replace (this.rx.html.trimTags.replace, tagTrimmer);}var paragraphs = body.split (this.rx.paragraphs);var pdComment = '';for (var i = 0, il = paragraphs.length; i < il; i++) {var lines = paragraphs[i].replace (this.rx.html.lines, '<br>');pdComment += '<p>' + lines + '</p>' + this.setup['server-eol'];}if (codeTagCount > 0) {pdComment = pdComment.replace (this.rx.html.code.marker, function (m, i) {return codeTags[i];});}if (preTagCount > 0) {pdComment = pdComment.replace (this.rx.html.pre.marker, function (m, i) {return preTags[i];});}template.comment = pdComment;} else {classes += ' hashover-notice ' + comment['notice-class'];template.comment = comment.notice;template.name = this.strings.parseTemplate (this.ui['name-wrapper'], {class: nameClass,link: comment.title});}var html = this.strings.parseTemplate (this.ui['theme'], template);if (comment.replies !== undefined) {classes += ' hashover-has-replies';for (var i = 0, il = comment.replies.length; i < il; i++) {replies += this.parseComment (comment.replies[i], comment, collapse);}}var wrapper = this.strings.parseTemplate (this.ui['comment-wrapper'], {hashover: prefix,permalink: commentKey,class: classes,html: html + replies});return wrapper;};HashOverConstructor.prototype.getElement = function (id, asIs){id = (asIs === true) ? id : this.prefix (id);var element = document.getElementById (id);return element;};HashOverConstructor.prototype.elementExists = function (id, callback, asIs){var element = this.getElement (id, asIs);if (element !== null) {return callback (element);}return false;};HashOverConstructor.prototype.eachClass = function (element, className, callback){var elements = element.getElementsByClassName (className);for (var i = elements.length - 1; i >= 0; i--) {callback (elements[i], elements, i, className);}};HashOver.prototype.parseAll = function (comments, element, collapse, popular){var html = '';for (var i = 0, il = comments.length; i < il; i++) {html += this.parseComment (comments[i], null, collapse, popular);}var htmlStart = Date.now ();if ('insertAdjacentHTML' in element) {element.textContent = '';element.insertAdjacentHTML ('beforeend', html);} else {element.innerHTML = html;}var htmlTime = Date.now () - htmlStart;for (var i = 0, il = comments.length; i < il; i++) {this.addControls (comments[i]);}return htmlTime;};HashOver.prototype.cloneObject = function (object){return JSON.parse (JSON.stringify (object));};HashOver.prototype.getAllComments = function (comments){var output = [];var tmpArray = this.cloneObject (comments);function descend (comment){output.push (comment);if (comment.replies !== undefined) {for (var i = 0, il = comment.replies.length; i < il; i++) {descend (comment.replies[i]);}delete comment.replies;}}for (var i = 0, il = tmpArray.length; i < il; i++) {descend (tmpArray[i]);}return output;};HashOver.prototype.sortComments = function (comments, method){method = method || this.setup['default-sorting'];var defaultName = this.setup['default-name'];function sortByDate (a, b){if (b.timestamp !== a.timestamp) {return b.timestamp - a.timestamp;}return 1;}function netLikes (comment){var likes = comment.likes || 0;var dislikes = comment.dislikes || 0;return likes - dislikes;}function replyCounter (comment){return comment.replies ? comment.replies.length : 0;}function replySum (comment, callback){var sum = 0;if (comment.replies !== undefined) {for (var i = 0, il = comment.replies.length; i < il; i++) {sum += replySum (comment.replies[i], callback);}}sum += callback (comment);return sum;}function sortByCommenter (a, b){var nameA = (a.name || defaultName).toLowerCase ();var nameB = (b.name || defaultName).toLowerCase ();nameA = (nameA.charAt (0) === '@') ? nameA.slice (1) : nameA;nameB = (nameB.charAt (0) === '@') ? nameB.slice (1) : nameB;if (nameA !== nameB) {return (nameA > nameB) ? 1 : -1;}return 0;}switch (method) {case 'descending': {var sortArray = this.getAllComments (comments);return sortArray.reverse ();}case 'by-date': {var sortArray = this.getAllComments (comments);return sortArray.sort (sortByDate);}case 'by-likes': {var sortArray = this.getAllComments (comments);return sortArray.sort (function (a, b) {return netLikes (b) - netLikes (a);});}case 'by-replies': {var sortArray = this.cloneObject (comments);return sortArray.sort (function (a, b) {return replyCounter (b) - replyCounter (a);});}case 'by-discussion': {var sortArray = this.cloneObject (comments);return sortArray.sort (function (a, b) {var replyCountA = replySum (a, replyCounter);var replyCountB = replySum (b, replyCounter);return replyCountB - replyCountA;});}case 'by-popularity': {var sortArray = this.cloneObject (comments);return sortArray.sort (function (a, b) {var likeCountA = replySum (a, netLikes);var likeCountB = replySum (b, netLikes);return likeCountB - likeCountA;});}case 'by-name': {var sortArray = this.getAllComments (comments);return sortArray.sort (sortByCommenter);}case 'threaded-descending': {var sortArray = this.cloneObject (comments);return sortArray.reverse ();}case 'threaded-by-date': {var sortArray = this.cloneObject (comments);return sortArray.sort (sortByDate);}case 'threaded-by-likes': {var sortArray = this.cloneObject (comments);return sortArray.sort (function (a, b) {return netLikes (b) - netLikes (a);});}case 'threaded-by-name': {var sortArray = this.cloneObject (comments);return sortArray.sort (sortByCommenter);}}return comments;};HashOver.prototype.sortPrimary = function (method, collapse){var dest = this.instance['sort-section'];var sortStart = Date.now ();var sorted = this.sortComments (this.instance.comments.primary, method);if (collapse === true) {this.instance.collapseLimit = 0;}var sortTime = Date.now () - sortStart;var htmlTime = this.parseAll (sorted, dest, collapse);console.log (this.strings.sprintf ('HashOver: sorting %d ms, HTML %d ms', [ sortTime, htmlTime ]));};HashOver.prototype.htmlChildren = function (html){var div = this.createElement ('div', {innerHTML: html});return div.children;};HashOver.prototype.appendComments = function (comments, dest, parent){dest = dest || this.instance['sort-section'];var htmlTime = 0;for (var i = 0, il = comments.length; i < il; i++) {var comment = comments[i];var element = this.getElement (comment.permalink);if (element !== null) {element.parentNode.appendChild (element);if (comment.replies !== undefined) {this.appendComments (comment.replies, element, comment);}continue;}var html = this.parseComment (comment, parent);var htmlStart = Date.now ();if ('insertAdjacentHTML' in dest) {dest.insertAdjacentHTML ('beforeend', html);} else {var element = this.htmlChildren (html);dest.appendChild (element[0]);}var htmlEnd = Date.now ();htmlTime += htmlEnd - htmlStart;this.addControls (comment);}this.reappendMoreLink ();return htmlTime;};HashOver.prototype.messageTimeouts = {};HashOver.prototype.computeStyle = function (element, property, type){if (window.getComputedStyle !== undefined) {var computedStyle = window.getComputedStyle (element, null);computedStyle = computedStyle.getPropertyValue (property);} else {var computedStyle = element.currentStyle[property];}switch (type) {case 'int': {computedStyle = computedStyle.replace (/px|em/, '');computedStyle = parseInt (computedStyle) || 0;break;}case 'float': {computedStyle = computedStyle.replace (/px|em/, '');computedStyle = parseFloat (computedStyle) || 0.0;break;}}return computedStyle;};HashOver.prototype.getHeight = function (element, setChild){var firstChild = element.children[0];firstChild.style.maxHeight = 'initial';var borderTop = this.computeStyle (firstChild, 'border-top-width', 'int');var borderBottom = this.computeStyle (firstChild, 'border-bottom-width', 'int');var marginBottom = this.computeStyle (firstChild, 'margin-bottom', 'int');var border = borderTop + borderBottom;var maxHeight = firstChild.clientHeight + border + marginBottom;if (setChild === true) {firstChild.style.maxHeight = maxHeight + 'px';} else {firstChild.style.maxHeight = '';}return maxHeight;};HashOver.prototype.openMessage = function (element){var hashover = this;this.classes.remove (element, 'hashover-message-animated');this.classes.add (element, 'hashover-message-open');var maxHeight = this.getHeight (element);var firstChild = element.children[0];this.classes.remove (element, 'hashover-message-open');setTimeout (function () {hashover.classes.add (element, 'hashover-message-open');hashover.classes.add (element, 'hashover-message-animated');element.style.maxHeight = maxHeight + 'px';firstChild.style.maxHeight = maxHeight + 'px';setTimeout (function () {element.style.maxHeight = 'initial';firstChild.style.maxHeight = 'initial';}, 150);}, 150);};HashOver.prototype.closeMessage = function (element){var hashover = this;element.style.maxHeight = this.getHeight (element, true) + 'px';setTimeout (function () {element.children[0].style.maxHeight = '';element.style.maxHeight = '';hashover.classes.remove (element, 'hashover-message-open');hashover.classes.remove (element, 'hashover-message-error');}, 150);};HashOver.prototype.showMessage = function (messageText, type, permalink, error){var hashover = this;if (type === 'edit') {var container = this.getElement ('edit-message-container-' + permalink);var message = this.getElement ('edit-message-' + permalink);} else {if (type !== 'reply') {var container = this.getElement ('message-container');var message = this.getElement ('message');} else {var container = this.getElement ('reply-message-container-' + permalink);var message = this.getElement ('reply-message-' + permalink);}}if (messageText !== undefined && messageText !== '') {message.textContent = messageText;if (error === true) {this.classes.add (container, 'hashover-message-error');}}this.openMessage (container);var key = this.prefix (permalink);if (this.messageTimeouts[key] === undefined) {this.messageTimeouts[key] = {};}if (this.messageTimeouts[key][type] !== undefined) {clearTimeout (this.messageTimeouts[key][type]);}this.messageTimeouts[key][type] = setTimeout (function () {hashover.closeMessage (container);}, 10000);};HashOver.prototype.emailValidator = function (form, subscribe, type, permalink){if (form.email === undefined) {return true;}if (form.email.value === '') {if (this.getElement(subscribe).checked === false) {return true;}var notifications = confirm (this.locale['no-email-warning']);if (notifications === false) {form.email.focus ();return false;}} else {if (this.rx.email.test (form.email.value) === false) {if (this.getElement(subscribe).checked === false) {form.email.value = '';return true;}var message = this.locale['invalid-email'];this.showMessage (message, type, permalink, true);form.email.focus ();return false;}}return true;};HashOver.prototype.validateEmail = function (type, permalink, form){var subscribe = type + '-subscribe';if (type === 'reply' || type === 'edit') {subscribe += '-' + permalink;}var valid = this.emailValidator (form, subscribe, type, permalink);return valid;};HashOver.prototype.commentValidator = function (form, type, skipComment){for (var field in this.setup['form-fields']) {if (this.setup['form-fields'].hasOwnProperty (field) !== true) {continue;}if (this.setup['form-fields'][field] === 'required' && form[field] !== undefined) {if (form[field].value === '') {this.classes.add (form[field], 'hashover-emphasized-input');form[field].focus ();return this.strings.sprintf (this.locale['field-needed'], [this.locale[field]]);}this.classes.remove (form[field], 'hashover-emphasized-input');}}if (skipComment !== true && form.comment.value === '') {this.classes.add (form.comment, 'hashover-emphasized-input');form.comment.focus ();var localeKey = (type === 'reply') ? 'reply-needed' : 'comment-needed';var errorMessage = this.locale[localeKey];return errorMessage;}return true;};HashOver.prototype.validateComment = function (form, type, permalink, skipComment){var message = this.commentValidator (form, type, skipComment);if (message !== true) {this.showMessage (message, type, permalink, true);return false;}if (this.setup['user-is-logged-in'] === false || type === 'edit') {if (this.validateEmail (type, permalink, form) === false) {return false;}}return true;};HashOver.prototype.addComments = function (comment, type){if (type === 'reply') {var parent = this.permalinkComment (this.permalinkParent (comment.permalink),this.instance.comments.primary);if (parent !== null) {if (parent.replies !== undefined) {parent.replies.push (comment);} else {parent.replies = [ comment ];}return;}}this.instance.comments.primary.push (comment);};HashOver.prototype.incrementCounts = function (type){if (type !== 'reply') {this.instance['primary-count']++;}this.instance['total-count']++;};HashOver.prototype.AJAXPost = function (json, permalink, type){var hashover = this;if (type === 'reply') {var dest = this.getElement (permalink);} else {var dest = this.instance['sort-section'];}var comments = this.instance.comments.primary;if (this.instance['total-count'] === 0) {this.instance.comments.primary[0] = json.comment;dest.innerHTML = this.parseComment (json.comment);} else {this.addComments (json.comment, type);this.elementExists ('sort-select', function (sortSelect) {comments = hashover.sortComments (comments, sortSelect.value);});this.appendComments (comments);}this.addControls (json.comment);this.getElement('count').textContent = json.count;this.incrementCounts (type);};HashOver.prototype.AJAXEdit = function (json, permalink){var comment = this.getElement (permalink);var oldItem = this.permalinkComment (permalink, this.instance.comments.primary);var newComment = this.htmlChildren (this.parseComment (json.comment));var newElements = newComment[0].children;var oldElements = comment.children;for (var i = newElements.length - 1; i >= 0; i--) {comment.replaceChild (newElements[i], oldElements[i]);}this.addControls (json.comment);for (var attribute in json.comment) {if (json.comment.hasOwnProperty (attribute) === true) {oldItem[attribute] = json.comment[attribute];}}};HashOver.prototype.postRequest = function (form, button, type, permalink, callback){var hashover = this;var inputs = form.elements;var queries = [];function commentHandler (json){if (json.comment !== undefined) {if (type !== 'edit') {hashover.AJAXPost.apply (hashover, [ json, permalink, type ]);} else {hashover.AJAXEdit.apply (hashover, [ json, permalink ]);}if (typeof (callback) === 'function') {callback ();}var scrollToElement = hashover.getElement (json.comment.permalink);scrollToElement.scrollIntoView ({behavior: 'smooth',block: 'start',inline: 'start'});form.comment.value = '';setTimeout (function () {button.disabled = false;}, 1000);} else {hashover.showMessage (json.message, type, permalink, true);return false;}}function sendRequest (){var postQueries = queries.concat ([button.name + '=' + encodeURIComponent (button.value)]);hashover.ajax ('POST', form.action, postQueries, commentHandler, true);}for (var i = 0, il = inputs.length; i < il; i++) {if (inputs[i].type === 'submit') {continue;}if (inputs[i].type === 'checkbox' && inputs[i].checked !== true) {continue;}var value = encodeURIComponent (inputs[i].value);queries.push (inputs[i].name + '=' + value);}queries = queries.concat (['time=' + HashOver.getClientTime (),'ajax=yes']);if (this.setup['user-is-admin'] !== true&& this.setup['uses-auto-login'] !== false){if (this.setup['user-is-logged-in'] !== true) {var loginQueries = queries.concat ([ 'login=Login' ]);this.ajax ('POST', form.action, loginQueries, sendRequest, true);} else {sendRequest ();}} else {sendRequest ();}setTimeout (function () {button.disabled = false;}, 10000);return false;};HashOver.prototype.postComment = function (form, button, type, permalink, callback){if (this.validateComment (form, type, permalink) === false) {return false;}setTimeout (function () {button.disabled = true;}, 250);if (this.postRequest) {return this.postRequest.apply (this, arguments);}setTimeout (function () {button.disabled = false;}, 10000);return true;};HashOverConstructor.prototype.permalinkFile = function (permalink){var file = permalink.slice (1);file = file.replace (/r/g, '-');file = file.replace ('-pop', '');return file;};HashOver.prototype.cancelSwitcher = function (form, link, wrapper, permalink){var reset = {textContent: link.textContent,title: link.title,onclick: link.onclick};function linkOnClick (){wrapper.textContent = '';link.textContent = reset.textContent;link.title = reset.title;link.onclick = reset.onclick;return false;}link.textContent = this.locale['cancel'];link.title = this.locale['cancel'];link.onclick = linkOnClick;if (this.setup['uses-cancel-buttons'] !== false) {var cancelButtonId = form + '-cancel-' + permalink;var cancelButton = this.getElement (cancelButtonId);cancelButton.onclick = linkOnClick;}};HashOver.prototype.formattingOnclick = function (type, permalink){permalink = permalink ? '-' + permalink : '';var hashover = this;var link = this.getElement (type + '-formatting' + permalink);var message = this.getElement (type + '-formatting-message' + permalink);link.onclick = function (){if (hashover.classes.contains (message, 'hashover-message-open')) {hashover.closeMessage (message);return false;}hashover.openMessage (message);return false;}};HashOverConstructor.prototype.duplicateProperties = function (element, names, value){var properties = {};for (var i = 0, il = names.length; i < il; i++) {properties[(names[i])] = value;}element = this.addProperties (element, properties);return element;};HashOver.prototype.enterCheck = function (event){return (event.keyCode === 13) ? false : true;};HashOver.prototype.preventSubmit = function (form){var infoInputs = form.getElementsByClassName ('hashover-input-info');for (var i = 0, il = infoInputs.length; i < il; i++) {infoInputs[i].onkeypress = this.enterCheck;}};HashOver.prototype.replyToComment = function (permalink){var hashover = this;var link = this.getElement ('reply-link-' + permalink);var file = this.permalinkFile (permalink);var form = this.createElement ('form', {id: this.prefix ('reply-' + permalink),className: 'hashover-reply-form',action: this.setup['http-backend'] + '/form-actions.php',method: 'post'});form.innerHTML = this.strings.parseTemplate (this.ui['reply-form'], {hashover: this.prefix (),permalink: permalink,url: this.instance['page-url'],thread: this.instance['thread-name'],title: this.instance['page-title'],file: file});this.preventSubmit (form);var replyForm = this.getElement ('placeholder-reply-form-' + permalink);replyForm.appendChild (form);this.cancelSwitcher ('reply', link, replyForm, permalink);var postReply = this.getElement ('reply-post-' + permalink);this.formattingOnclick ('reply', permalink);this.duplicateProperties (postReply, [ 'onclick', 'onsubmit' ], function () {return hashover.postComment (form, this, 'reply', permalink, link.onclick);});form.comment.focus ();return true;};HashOver.prototype.editComment = function (comment, callback){if (comment['editable'] !== true) {return false;}var hashover = this;var editInfo = HashOver.backendPath + '/comment-info.php';var permalink = comment.permalink;var file = this.permalinkFile (permalink);var queries = ['url=' + encodeURIComponent (this.instance['page-url']),'thread=' + encodeURIComponent (this.instance['thread-name']),'comment=' + encodeURIComponent (file)];var link = this.getElement ('edit-link-' + permalink);this.classes.add (link, 'hashover-loading');this.ajax ('post', editInfo, queries, function (info) {if (info.error !== undefined) {alert (info.error);hashover.classes.remove (link, 'hashover-loading');return;}var body = info.body.replace (hashover.rx.links, '$1');var placeholder = hashover.getElement ('placeholder-edit-form-' + permalink);var statuses = [ 'approved', 'pending', 'deleted' ];var form = hashover.createElement ('form', {id: hashover.prefix ('edit-' + permalink),className: 'hashover-edit-form',action: hashover.setup['http-backend'] + '/form-actions.php',method: 'post'});form.innerHTML = hashover.strings.parseTemplate (hashover.ui['edit-form'], {hashover: hashover.prefix (),permalink: permalink,url: hashover.instance['page-url'],thread: hashover.instance['thread-name'],title: hashover.instance['page-title'],file: file,name: info.name || '',email: info.email || '',website: info.website || '',body: body});hashover.preventSubmit (form);placeholder.appendChild (form);hashover.elementExists ('edit-status-' + permalink, function (status) {if (comment.status !== undefined) {status.selectedIndex = statuses.indexOf (comment.status);}});hashover.elementExists ('edit-subscribe-' + permalink, function (sub) {if (comment.subscribed !== true) {sub.checked = null;}});var editDelete = hashover.getElement('edit-delete-' + permalink);var saveEdit = hashover.getElement ('edit-post-' + permalink);hashover.cancelSwitcher ('edit', link, placeholder, permalink);editDelete.onclick = function () {return confirm (hashover.locale['delete-comment']);};hashover.formattingOnclick ('edit', permalink);hashover.duplicateProperties (saveEdit, [ 'onclick', 'onsubmit' ], function () {return hashover.postComment (form, this, 'edit', permalink, link.onclick);});hashover.classes.remove (link, 'hashover-loading');if (typeof (callback) === 'function') {callback ();}}, true);return false;};HashOver.prototype.mouseOverChanger = function (element, over, out){var hashover = this;if (over === null || out === null) {element.onmouseover = null;element.onmouseout = null;return false;}element.onmouseover = function (){this.textContent = hashover.locale[over];};element.onmouseout = function (){this.textContent = hashover.locale[out];};};HashOver.prototype.likeComment = function (action, permalink){var hashover = this;var file = this.permalinkFile (permalink);var actionLink = this.getElement (action + '-' + permalink);var likesElement = this.getElement (action + 's-' + permalink);var likePath = this.setup['http-backend'] + '/like.php';var queries = ['url=' + encodeURIComponent (this.instance['page-url']),'thread=' + encodeURIComponent (this.instance['thread-name']),'comment=' + encodeURIComponent (file),'action=' + action];this.ajax ('POST', likePath, queries, function (likeResponse) {if (likeResponse.message !== undefined) {alert (likeResponse.message);return;}if (likeResponse.error !== undefined) {alert (likeResponse.error);return;}var likesKey = (action !== 'dislike') ? 'likes' : 'dislikes';var likes = likeResponse[likesKey] || 0;if (hashover.classes.contains (actionLink, 'hashover-' + action) === true) {var title = (action === 'like') ? 'liked-comment' : 'disliked-comment';var content = (action === 'like') ? 'liked' : 'disliked';hashover.classes.add (actionLink, 'hashover-' + action + 'd');hashover.classes.remove (actionLink, 'hashover-' + action);actionLink.title = hashover.locale[title];actionLink.textContent = hashover.locale[content];if (action === 'like') {hashover.mouseOverChanger (actionLink, 'unlike', 'liked');}} else {var title = (action === 'like') ? 'like-comment' : 'dislike-comment';var content = (action === 'like') ? 'like' : 'dislike';hashover.classes.add (actionLink, 'hashover-' + action);hashover.classes.remove (actionLink, 'hashover-' + action + 'd');actionLink.title = hashover.locale[title];actionLink.textContent = hashover.locale[content];if (action === 'like') {hashover.mouseOverChanger (actionLink, null, null);}}if (likes > 0) {if (likes !== 1) {var likeLocale = (action !== 'like') ? 'dislikes' : 'likes';} else {var likeLocale = (action !== 'like') ? 'dislike' : 'like';}likesElement.textContent = likes + ' ' + hashover.locale[likeLocale];likesElement.style.fontWeight = 'bold';} else {likesElement.textContent = '';likesElement.style.fontWeight = '';}}, true);};HashOverConstructor.prototype.addControls = function (comment){var hashover = this;function stepIntoReplies (){if (comment.replies !== undefined) {for (var i = 0, il = comment.replies.length; i < il; i++) {hashover.addControls (comment.replies[i]);}}}if (comment.notice !== undefined) {stepIntoReplies ();return false;}var permalink = comment.permalink;if (this.setup['allows-images'] !== false) {var main = this.instance['main-element'];var embeds = main.getElementsByClassName ('hashover-embedded-image');for (var i = 0, il = embeds.length; i < il; i++) {embeds[i].onclick = function () {hashover.openEmbeddedImage (this);};}}this.elementExists ('thread-link-' + permalink, function (threadLink) {threadLink.onclick = function (){var callback = function (){var parentThread = permalink.replace (hashover.rx.thread, '$1');var scrollToElement = hashover.getElement (parentThread);scrollToElement.scrollIntoView ({behavior: 'smooth',block: 'start',inline: 'start'});};if (hashover.setup['collapses-comments'] !== false) {hashover.showMoreComments (threadLink, callback);} else {callback ();}return false;};});this.elementExists ('reply-link-' + permalink, function (replyLink) {replyLink.onclick = function () {hashover.replyToComment (permalink);return false;};});this.elementExists ('edit-link-' + permalink, function (editLink) {editLink.onclick = function () {hashover.editComment (comment);return false;};});if (comment['user-owned'] === undefined) {if (this.setup['allows-likes'] !== false) {this.elementExists ('like-' + permalink, function (likeLink) {likeLink.onclick = function () {hashover.likeComment ('like', permalink);return false;};if (hashover.classes.contains (likeLink, 'hashover-liked') === true) {hashover.mouseOverChanger (likeLink, 'unlike', 'liked');}});}if (this.setup['allows-dislikes'] !== false) {this.elementExists ('dislike-' + permalink, function (dislikeLink) {dislikeLink.onclick = function () {hashover.likeComment ('dislike', permalink);return false;};});}}stepIntoReplies ();};HashOver.prototype.loadAllComments = function (element, callback){var hashover = this;if (this.instance['comments-loaded'] === true) {return callback ();}var requestPath = this.setup['http-backend'] + '/load-comments.php';var queries = this.queries.concat (['time=' + HashOver.getClientTime (),'ajax=yes']);this.classes.add (element, 'hashover-loading');this.ajax ('POST', requestPath, queries, function (json) {hashover.classes.remove (element, 'hashover-loading');hashover.instance.comments.primary = json.primary;console.log (hashover.strings.sprintf ('HashOver: backend %d ms, %s', [json.statistics['execution-time'],json.statistics['script-memory']]));callback ();}, true);this.instance['comments-loaded'] = true;};HashOver.prototype.showMoreComments = function (element, callback){var hashover = this;if (this.instance['showing-more'] === true) {if (typeof (callback) === 'function') {callback ();}return false;}if (this.setup['uses-ajax'] === false) {this.hideMoreLink (callback);this.instance['showing-more'] = true;return false;}this.loadAllComments (element, function () {hashover.hideMoreLink (function () {var execStart = Date.now ();var primary = hashover.instance.comments.primary;var sortSelect = hashover.getElement ('sort-select');if (sortSelect !== null) {var sorted = hashover.sortComments (primary, sortSelect.value);} else {var sorted = hashover.sortComments (primary);}var htmlTime = hashover.appendComments (sorted);if (typeof (callback) === 'function') {callback ();}var execTime = Math.abs (Date.now () - execStart - htmlTime);console.log (hashover.strings.sprintf ('HashOver: front-end %d ms, HTML %d ms', [ execTime, htmlTime ]));});});this.instance['showing-more'] = true;return false;};HashOver.prototype.hideMoreLink = function (callback){var hashover = this;var sortSection = this.instance['sort-section'];var moreLink = this.instance['more-link'];this.classes.add (this.instance['more-link'], 'hashover-hide-more-link');setTimeout (function () {moreLink.parentNode.removeChild (moreLink);hashover.getElement('count-wrapper').style.display = '';hashover.elementExists ('popular-section', function (popularSection) {popularSection.style.display = '';});var classRemover = function (element, elements, i, className) {hashover.classes.remove (element, className);};hashover.eachClass (sortSection, 'hashover-hidden', classRemover);if (typeof (callback) === 'function') {callback ();}}, 350);};HashOver.prototype.showMoreLink = function (){var hashover = this;if (this.instance['total-count'] > this.setup['collapse-limit']) {this.instance['more-link'] = this.createElement ('a', {className: 'hashover-more-link',rel: 'nofollow',href: '#',title: this.instance['more-link-text'],textContent: this.instance['more-link-text'],onclick: function () {return hashover.showMoreComments (this);}});var sortSection = this.instance['sort-section'];var comments = sortSection.children;this.instance['last-shown-comment'] = comments[comments.length - 1];sortSection.appendChild (this.instance['more-link']);this.instance['showing-more'] = false;} else {this.instance['showing-more'] = true;}};HashOver.prototype.reappendMoreLink = function (){var moreLink = this.instance['more-link'];var showingMore = this.instance['showing-more'];if (moreLink !== undefined && showingMore === false) {var sortSection = this.instance['sort-section'];var lastShown = this.instance['last-shown-comment'];sortSection.insertBefore (moreLink, lastShown.nextSibling)}};HashOver.prototype.init = function (id){var hashover = this;var execStart = Date.now ();var mainElement = this.getMainElement (id);var formEvents = [ 'onclick', 'onsubmit' ];var pageURL = window.location.href.split ('#')[0];var pageHash = window.location.hash.substring (1);function scrollToElement (id){hashover.elementExists (id, function (element) {element.scrollIntoView ({behavior: 'smooth',block: 'start',inline: 'start'});}, true);}function scrollCommentIntoView (){if (hashover.setup['collapses-comments'] !== false) {var linkedHidden = hashover.elementExists (pageHash, function (comment) {if (hashover.classes.contains (comment, 'hashover-hidden') === false) {scrollToElement (pageHash);return true;}return false;}, true);if (linkedHidden === false) {hashover.showMoreComments (hashover.instance['more-link'], function () {scrollToElement (pageHash);});}} else {scrollToElement (pageHash);}}function prepareScroll (){if (pageHash.match (/comments|hashover/)) {scrollToElement (pageHash);}if (pageHash.match (/hashover-c[0-9]+r*/)) {if (hashover.setup['collapses-interface'] !== false) {hashover.showInterface (scrollCommentIntoView);} else {scrollCommentIntoView ();}}if (hashover.getElement('message').textContent !== '') {hashover.showMessage ();}}function onLoad (){setTimeout (prepareScroll, 500);}this.optionalMethod ('appendCSS', [ id ]);if (this.instance['total-count'] !== 0) {this.elementExists ('comment-count', function (countElement) {countElement.textContent = hashover.instance['total-count'];});this.optionalMethod ('appendRSS');}if ('insertAdjacentHTML' in mainElement) {mainElement.textContent = '';mainElement.insertAdjacentHTML ('beforeend', this.instance['initial-html']);} else {mainElement.innerHTML = this.instance['initial-html'];}this.instance['main-element'] = mainElement;var sortSection = this.getElement ('sort-section');this.instance['sort-section'] = sortSection;this.elementExists ('top-comments', function (topComments) {if (hashover.instance.comments.popular[0] !== undefined) {hashover.parseAll (hashover.instance.comments.popular, topComments, false, true);}});var comments = this.instance.comments.primary;if (this.setup['collapses-comments'] === false || this.setup['uses-ajax'] === false) {comments = this.sortComments (comments);}this.htmlTime = this.parseAll (comments, sortSection, this.setup['collapses-comments']);this.optionalMethod ('showInterfaceLink');this.optionalMethod ('showMoreLink');this.formattingOnclick ('main');var postButton = this.getElement ('post-button');var formElement = this.getElement ('form');this.duplicateProperties (postButton, formEvents, function () {return hashover.postComment (formElement, postButton, 'main');});if (this.setup['allows-login'] !== false) {if (this.setup['user-is-logged-in'] !== true) {var loginButton = this.getElement ('login-button');this.duplicateProperties (loginButton, formEvents, function () {return hashover.validateComment (formElement, 'main', null, true);});}}this.elementExists ('sort-select', function (sortSelect) {sortSelect.onchange = function (){if (hashover.setup['collapses-comments'] !== false) {var sortSelectDiv = hashover.getElement ('sort');hashover.loadAllComments (sortSelectDiv, function () {var collapse = !hashover.instance['showing-more'];hashover.sortPrimary (sortSelect.value, collapse);hashover.reappendMoreLink ();}, false);} else {hashover.sortPrimary (sortSelect.value);}};});if (pageURL.match (/hashover-(reply|edit)=/)) {var permalink = pageURL.replace (/.*?hashover-(edit|reply)=(c[0-9r\-pop]+).*?/, '$2');var callback = function (){if (pageURL.match ('hashover-reply=')) {hashover.replyToComment (permalink);scrollToElement (pageHash);} else {var isPop = permalink.match ('-pop');var comments = hashover.instance.comments[isPop ? 'popular' : 'primary'];var edit = hashover.permalinkComment (permalink, comments);hashover.editComment (edit, function () {scrollToElement (pageHash);});}};if (hashover.setup['collapses-comments'] !== false) {this.showMoreComments (this.instance['more-link'], callback);} else {callback ();}}this.execTime = Math.abs (Date.now () - execStart - this.htmlTime);console.log (this.strings.sprintf ('HashOver: front-end %d ms, HTML %d ms', [ this.execTime, this.htmlTime ]));if (window.addEventListener) {window.addEventListener ('load', onLoad, false);} else {window.attachEvent ('onload', onLoad);}onLoad ();};(function () {var instance = 'hashover';if (HashOver.loaderInstance !== undefined) {for (var variable in window) {if (window[variable] === HashOver.loaderInstance) {instance = variable;break;}}}window[instance] = new HashOver ();}) ();

/*

	HashOver Statistics

	Execution Time     : 7.92289 ms
	Script Memory Peak : 1.03 MiB
	System Memory Peak : 2 MiB

*/

Thanks for pointing this out. The minification process is very basic, it is not aware of proper JavaScript syntax, all it does is remove whitespace, code comments, and spaces and semicolons in the higher levels. This issue was caused by a missing semicolon, it should now be fixed.

Please reopen this issue if it is not fixed.