|
@@ -1,4 +1,4 @@
|
|
|
-// post.js v2.1.0 Copyright (C) 2014-2015 Visman (mio.visman@yandex.ru)
|
|
|
+// post.js v2.1.1 Copyright (C) 2014-2016 Visman (mio.visman@yandex.ru)
|
|
|
if (typeof FluxBB === 'undefined' || !FluxBB) {var FluxBB = {};}
|
|
|
|
|
|
FluxBB.post = (function (doc, win) {
|
|
@@ -27,16 +27,8 @@ FluxBB.post = (function (doc, win) {
|
|
|
return node.querySelectorAll('.' + classname);
|
|
|
} else if (node.getElementsByClassName) {
|
|
|
return node.getElementsByClassName(classname);
|
|
|
- } else {
|
|
|
- var list = node.all || node.getElementsByTagName('*');
|
|
|
- var result = [];
|
|
|
- for (var index = 0, elem; elem = list[index++];) {
|
|
|
- if (elem.className && (' ' + elem.className + ' ').indexOf(' ' + classname + ' ') > -1) {
|
|
|
- result[result.length] = elem;
|
|
|
- }
|
|
|
- }
|
|
|
- return result;
|
|
|
}
|
|
|
+ return [];
|
|
|
}
|
|
|
|
|
|
function createElement(elem) {
|
|
@@ -81,47 +73,26 @@ FluxBB.post = (function (doc, win) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function SmileysMapBB() {
|
|
|
- var html = "";
|
|
|
+ function SmileysMapBB() {
|
|
|
+ var html = '';
|
|
|
for (var i = 0; i < FluxBB.vars.bbSmImg.length; i++) {
|
|
|
- html += "<img src=\"img/smilies/" + FluxBB.vars.bbSmImg[i] + "\" alt=\"" + FluxBB.vars.bbSmTxt[i] + "\" onclick=\"return FluxBB.post.insText('', ' " + FluxBB.vars.bbSmTxt[i].replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + " ');\" />"
|
|
|
+ html += '<img src="img/smilies/' + FluxBB.vars.bbSmImg[i] + '" alt="' + FluxBB.vars.bbSmTxt[i] + '" onclick="return FluxBB.post.insText(\'\', \' ' + FluxBB.vars.bbSmTxt[i].replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + ' \');" />';
|
|
|
}
|
|
|
return html;
|
|
|
}
|
|
|
|
|
|
function ColorMapBB() {
|
|
|
- var colors = [
|
|
|
- "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
|
|
|
- "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
|
|
|
- "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
|
|
|
- "#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
|
|
|
- "#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
|
|
|
- "#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
|
|
|
- "#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
|
|
|
- "#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
|
|
|
- "#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
|
|
|
- "#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
|
|
|
- "#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
|
|
|
- "#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
|
|
|
- "#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
|
|
|
- "#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
|
|
|
- "#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
|
|
|
- "#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
|
|
|
- "#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
|
|
|
- "#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
|
|
|
- "#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
|
|
|
- "#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
|
|
|
- "#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
|
|
|
- "#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
|
|
|
- "#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
|
|
|
- "#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
|
|
|
- "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
|
|
|
- "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
|
|
|
- "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"];
|
|
|
+ var colors = [], a = ['00', '33', '66', '99', 'cc', 'ff'];
|
|
|
+ for (var x = 0; x < 6; x++) {
|
|
|
+ for (var y = 0; y < 6; y++) {
|
|
|
+ for (var z = 0; z < 6; z++) {
|
|
|
+ colors.push('#' + a[y] + a[x] + a[z]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
var html = '<table class="tbl"><tr>';
|
|
|
for (var i=0; i<colors.length; i++) {
|
|
|
- html += "<td style='background-color:" + colors[i] + "' onclick=\"return FluxBB.post.insText('[color=" + colors[i] + "]', '[/color]');\" onfocus=\"FluxBB.post.showMapColor('" + colors[i] + "');\" onmouseover=\"FluxBB.post.showMapColor('" + colors[i] + "');\">"
|
|
|
- html += '</td>';
|
|
|
+ html += '<td style="background-color:' + colors[i] + '" onclick="return FluxBB.post.insText(\'[color=' + colors[i] + ']\', \'[/color]\');" onfocus="FluxBB.post.showMapColor(\'' + colors[i] + '\');" onmouseover="FluxBB.post.showMapColor(\'' + colors[i] + '\');"></td>';
|
|
|
if ((i+1) % 18 == 0) html += '</tr><tr>';
|
|
|
}
|
|
|
html += '<td colspan="9" id="selectedMapColor" height="16"></td>'
|
|
@@ -137,7 +108,7 @@ FluxBB.post = (function (doc, win) {
|
|
|
fls = true;
|
|
|
|
|
|
textarea = doc.getElementsByName('req_message')[0];
|
|
|
- if (typeof(textarea) === 'undefined') return false;
|
|
|
+ if (typeof textarea === 'undefined') return false;
|
|
|
|
|
|
bbcode = [{i:'b.png', a:'[b]', s:'[b]', e:'[/b]'},
|
|
|
{i:'i.png', a:'[i]', s:'[i]', e:'[/i]'},
|
|
@@ -199,22 +170,22 @@ FluxBB.post = (function (doc, win) {
|
|
|
if (blockposts[i].id) {
|
|
|
var id = blockposts[i].id.replace('p', '');
|
|
|
var dt = blockposts[i].getElementsByTagName('dt')[0];
|
|
|
- if (typeof(dt) !== 'undefined') {
|
|
|
+ if (typeof dt !== 'undefined') {
|
|
|
var a = dt.innerHTML;
|
|
|
var n = a.replace(/<[^>]+>/g, '');
|
|
|
|
|
|
// Decode html special chars
|
|
|
- n = n.replace(/</g, '<');
|
|
|
- n = n.replace(/>/g, '>');
|
|
|
- n = n.replace(/"/g, '"');
|
|
|
- n = n.replace(/'/g, '\'');
|
|
|
- n = n.replace(/ /g, ' ');
|
|
|
- n = n.replace(/ /g, ' ');
|
|
|
- nameusers[id] = n.replace(/&/g, '&');
|
|
|
+ nameusers[id] = n.replace(/</g, '<')
|
|
|
+ .replace(/>/g, '>')
|
|
|
+ .replace(/"/g, '"')
|
|
|
+ .replace(/'/g, '\'')
|
|
|
+ .replace(/ /g, ' ')
|
|
|
+ .replace(/ /g, ' ')
|
|
|
+ .replace(/&/g, '&');
|
|
|
dt.insertAdjacentHTML('afterBegin', '<strong><a href="#req_message" onclick="return FluxBB.post.insName(' + id + ');">@ </a></strong>');
|
|
|
|
|
|
var quote = getCN('postquote', blockposts[i])[0];
|
|
|
- if (typeof(quote) !== 'undefined') {
|
|
|
+ if (typeof quote !== 'undefined') {
|
|
|
a = quote.getElementsByTagName('a')[0];
|
|
|
p = quote.parentNode;
|
|
|
p.insertAdjacentHTML('beforeEnd', '<li class="postquote"><span id="pq' + id + '"><a href="' + a.href.replace(/&/g, '&') + '" onmousedown="FluxBB.post.getText();" onclick="return FluxBB.post.quote(' + id + ');">' + lang['QQ'] + '</a></span></li>');
|
|
@@ -224,10 +195,10 @@ FluxBB.post = (function (doc, win) {
|
|
|
}
|
|
|
|
|
|
if (!!FluxBB.vars.bbFlagUp && !FluxBB.vars.bbGuest) {
|
|
|
- var all_ul = doc.getElementsByTagName("ul"),
|
|
|
+ var all_ul = doc.getElementsByTagName('ul'),
|
|
|
i = all_ul.length - 1;
|
|
|
while (i > -1) {
|
|
|
- if (all_ul[i].className == "bblinks") {
|
|
|
+ if (all_ul[i].className == 'bblinks') {
|
|
|
all_ul[i].insertAdjacentHTML('beforeEnd', '<li><span><a href="upfiles.php" onclick="return FluxBB.post.popUp(this.href);"><strong>' + lang['upfiles'] + '</strong></a></span></li>');
|
|
|
i = 0;
|
|
|
}
|
|
@@ -240,33 +211,31 @@ FluxBB.post = (function (doc, win) {
|
|
|
get('bbcode_color_map').style.display = 'none';
|
|
|
get('bbcode_smileys').style.display = 'none';
|
|
|
textarea.focus();
|
|
|
- // IE support
|
|
|
- if (doc.selection && doc.selection.createRange) {
|
|
|
- sel = doc.selection.createRange();
|
|
|
- sel.text = open + sel.text + close;
|
|
|
- }
|
|
|
- // Moz support
|
|
|
- else if (textarea.selectionStart || textarea.selectionStart == '0') {
|
|
|
- var startPos = textarea.selectionStart;
|
|
|
- var endPos = textarea.selectionEnd;
|
|
|
- textarea.value = textarea.value.substring(0, startPos) + open + textarea.value.substring(startPos, endPos) + close + textarea.value.substring(endPos);
|
|
|
- if (startPos == endPos && open == '') {
|
|
|
- textarea.selectionStart = startPos + close.length;
|
|
|
- textarea.selectionEnd = endPos + close.length;
|
|
|
+ // all and IE9+
|
|
|
+ if ('selectionStart' in textarea) {
|
|
|
+ var len = textarea.value.length,
|
|
|
+ sp = Math.min(textarea.selectionStart, len), // IE bug
|
|
|
+ ep = Math.min(textarea.selectionEnd, len); // IE bug
|
|
|
+
|
|
|
+ textarea.value = textarea.value.substring(0, sp) + open + textarea.value.substring(sp, ep) + close + textarea.value.substring(ep);
|
|
|
+ if (sp == ep && open == '') {
|
|
|
+ textarea.selectionStart = sp + close.length;
|
|
|
+ textarea.selectionEnd = ep + close.length;
|
|
|
} else {
|
|
|
- textarea.selectionStart = startPos + open.length;
|
|
|
- textarea.selectionEnd = endPos + open.length;
|
|
|
+ textarea.selectionStart = sp + open.length;
|
|
|
+ textarea.selectionEnd = ep + open.length;
|
|
|
}
|
|
|
}
|
|
|
- // Fallback support for other browsers
|
|
|
- else {
|
|
|
- textarea.value += open + close;
|
|
|
+ // IE9-
|
|
|
+ else if (doc.selection && doc.selection.createRange) {
|
|
|
+ var sel = doc.selection.createRange();
|
|
|
+ sel.text = open + sel.text + close;
|
|
|
}
|
|
|
textarea.focus();
|
|
|
return false;
|
|
|
},
|
|
|
|
|
|
- insName: function (id) {
|
|
|
+ insName: function (id) {
|
|
|
return FluxBB.post.insText('', '[b]@' + nameusers[id] + '[/b], ');
|
|
|
},
|
|
|
|
|
@@ -276,8 +245,8 @@ FluxBB.post = (function (doc, win) {
|
|
|
},
|
|
|
|
|
|
quote: function (id) {
|
|
|
- if (typeof(id) !== 'number' || id < 1) return false;
|
|
|
- if (quote_text != "") {
|
|
|
+ if (typeof id !== 'number' || id < 1) return false;
|
|
|
+ if (quote_text != '') {
|
|
|
return FluxBB.post.insText('', '[quote="' + nameusers[id] + '"]\n' + quote_text + '\n[/quote]\n');
|
|
|
} else if (!FluxBB.vars.bbGuest){
|
|
|
check_apq();
|
|
@@ -289,8 +258,8 @@ FluxBB.post = (function (doc, win) {
|
|
|
get('pq' + apq_id).innerHTML = '<img src="img/loading.gif" /> <a href="#">' + lang['Loading'] + '</a>';
|
|
|
|
|
|
req.onreadystatechange=function(){orsc(req);};
|
|
|
- req.open("POST", 'pjq.php?' + id, true);
|
|
|
- req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
|
+ req.open('POST', 'pjq.php?' + id, true);
|
|
|
+ req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
req.send('action=' + typepost + '&id=' + id);
|
|
|
}
|
|
|
} else {
|
|
@@ -304,7 +273,7 @@ FluxBB.post = (function (doc, win) {
|
|
|
w = Math.min(820, screen.width),
|
|
|
t = Math.max((screen.height - h) / 3, 0),
|
|
|
l = (screen.width - w) / 2;
|
|
|
- win.open(url, 'gest', "top=" + t + ",left=" + l + ",width=" + w + ",height=" + h + ",resizable=yes,location=no,menubar=no,status=no,scrollbars=yes");
|
|
|
+ win.open(url, 'gest', 'top=' + t + ',left=' + l + ',width=' + w + ',height=' + h + ',resizable=yes,location=no,menubar=no,status=no,scrollbars=yes');
|
|
|
return false;
|
|
|
},
|
|
|
|
|
@@ -341,13 +310,13 @@ FluxBB.post = (function (doc, win) {
|
|
|
},
|
|
|
|
|
|
showMapColor : function (color) {
|
|
|
- get("selectedMapColor").style.backgroundColor = color;
|
|
|
- get("selectedMapColorBox").value = color;
|
|
|
+ get('selectedMapColor').style.backgroundColor = color;
|
|
|
+ get('selectedMapColorBox').value = color;
|
|
|
}
|
|
|
};
|
|
|
}(document, window));
|
|
|
|
|
|
-if (typeof(jQuery) !== "undefined") {
|
|
|
+if (typeof jQuery !== 'undefined') {
|
|
|
(function($){var textarea,staticOffset;var iLastMousePos=0;var iMin=64;var grip;$.fn.TextAreaResizer=function(){return this.each(function(){textarea=$(this).addClass('processed'),staticOffset=null;$(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append($('<div class="grippie"></div>').bind("mousedown",{el:this},startDrag));var grippie=$('div.grippie',$(this).parent())[0];grippie.style.marginRight=(grippie.offsetWidth-$(this)[0].offsetWidth)+'px'})};function startDrag(e){textarea=$(e.data.el);textarea.blur();iLastMousePos=mousePosition(e).y;staticOffset=textarea.height()-iLastMousePos;if(!window.ActiveXObject){textarea.css('opacity',0.25)}$(document).mousemove(performDrag).mouseup(endDrag);return false}function performDrag(e){var iThisMousePos=mousePosition(e).y;var iMousePos=staticOffset+iThisMousePos;if(iLastMousePos>=(iThisMousePos)){iMousePos-=5}iLastMousePos=iThisMousePos;iMousePos=Math.max(iMin,iMousePos);textarea.height(iMousePos+'px');if(iMousePos<iMin){endDrag(e)}return false}function endDrag(e){$(document).unbind('mousemove',performDrag).unbind('mouseup',endDrag);if(!window.ActiveXObject){textarea.css('opacity',1)}textarea.focus();textarea=null;staticOffset=null;iLastMousePos=0}function mousePosition(e){return{x:e.clientX+document.documentElement.scrollLeft,y:e.clientY+document.documentElement.scrollTop}}})(jQuery);
|
|
|
$(document).ready(function() {$('textarea:not(.processed)').TextAreaResizer();});
|
|
|
-}
|
|
|
+}
|