test 2 probando
Mon Oct 24, 2016 8:43 am
- Code:
console.log('//-Written by Chalo ------ Open Source 2014-2016 -----//');
console.log('//--------- http://www.opensourcephpbb3.com ----------//');
console.log('//------------------- Version: 1.5 -------------------//');
var os = {
lang: {
success_reply: 'Your message has been entered successfully', // <--- change this text exactly like is display in your language board
flood: 'Flood control is active on this forum, please wait 10 second(s) before replying or posting',
newpost: 'A new message has been posted',
error_reply: 'Try again',
words_reply: 'You need 5 letters at least',
button_send_reply: 'Send data...',
notice_original: 'No predefined text',
no_message: 'There is nothing written in the editor',
loading: 'Loading...',
wait_notice: 'Please be patient, sending data to the server',
color_a: 'linear-gradient(to bottom, #febbbb 0%,#fe9090 45%,#ff5c5c 100%)',
color_b: 'linear-gradient(to bottom, #ffaf4b 0%,#ff920a 100%)',
color_c: 'linear-gradient(to bottom, #87e0fd 0%,#53cbf1 40%,#05abe0 100%)',
color_d: 'linear-gradient(to bottom, #ff3019 0%,#cf0404 100%)',
color_e: 'linear-gradient(to bottom, #d2ff52 0%,#91e842 100%)'
},
length_reply: 5, //min letters in the textarea before reply
time: 3000,
previewHTML: '<div id="overlay" style="display:block;position:fixed;top:0;left:0;min-height:101%;width:100%;background-color:#000;opacity:.7;z-index:999;"></div><div id="preview_content" style="background:#fff;left:15%;position:fixed;top:10%;width:70%;height:65%;overflow:auto;z-index:999;box-shadow:10px 10px 40px black;border-radius:3px;font-size:1.2em;padding:10px;font-family:Arial;text-shadow:0 1px 1px white;color:#666;"> <a id="close" style="float:right;cursor:pointer;" onclick="os.close(this)"><img src="http://2img.net/i/fa/prosilver/icon_post_delete.gif"></a> </div>',
init: function () {
os.isTheme = /\/t\d+/g.test(window.location.pathname);
os.isPost = /\/post/.test(window.location.pathname);
os.phpbb2 = document.getElementsByClassName('bodylinewidth').length;
os.phpbb3 = document.getElementById('phpbb');
os.invision = document.getElementById('ipbwrapper');
os.punbb = document.getElementById('pun-intro');
os.form = document.forms.post;
os.button_reply = document.forms.post.post;
os.button_value_reply = document.forms.post.post.value;
os.textarea = document.forms.post.message;
os.action_reply = document.forms.post.action;
os.button_prev = os.form.preview;
os.button_val = os.button_prev.value;
os.URL = os.isTheme ? '/post?t=' + document.forms.post.t.value + '&mode=reply' : os.isPost && document.location.href;
os.sceditor = $(os.textarea).sceditor('instance');
os.button_prev.setAttribute('onclick', 'os.prev(this);return false');
os.button_reply.setAttribute('onclick', 'os.send_post(this);return false')
},
notice: function (c, f) {
var a, b, d, e, g;
g = document.getElementsByClassName('notice_reply');
b = document.getElementsByClassName('sceditor-group')[0];
d = b.parentNode;
a = !g.length ? document.createElement('DIV') : g[0];
e = 'height:20px;line-height: 1.5;border-radius: 3px; text-shadow: 0 1px rgba(255, 255, 255, 0.46)';
!g.length && (a.classList.add('notice_reply'), a.setAttribute('style', e), d.insertBefore(a, b));
a.style.display = 'block';
a.innerHTML = 'undefined' == typeof c ? os.lang.notice_original : c;
a.style.background = 'undefined' == typeof f ? os.lang.color_a : f;
setTimeout(function () {
a.style.display == 'block' && (a.style.display = 'none')
}, os.time)
},
prev: function (c) {
os.sceditor.updateOriginal();
c.value = os.lang.loading;
c.style.background = os.lang.color_c;
if (0 != os.sceditor.val()) {
var x, y;
os.XML(os.serialize(os.form) + '&preview=Preview', os.URL, function (e) {
y = e.responseXML.getElementsByClassName('postbody')[0];
document.body.insertAdjacentHTML('afterbegin', os.previewHTML);
document.getElementById('preview_content').appendChild(y)
os.button_prev.value = os.button_val;
os.button_prev.style.background = ''
})
} else(os.notice(os.lang.no_message), os.button_prev.value = os.button_val, os.button_prev.style.background = '');
},
send_post: function (f) {
var c, h, a, d, b, v, i, x, y, z;
h = os.action_reply,
os.sceditor.updateOriginal();
z = document.getElementsByClassName('new_ajax_post'), z.length && z[0].classList.remove('new_ajax_post'), os.sceditor.val().length > os.length_reply ? (f.value = os.lang.button_send_reply, os.XML(os.serialize(os.form) + '&post=1&prevent_post=1', h, function (e) {
for (x = e.responseXML, y = x.getElementById(os.phpbb2 ? 'page-body' : 'main'), a = y.innerHTML.indexOf(os.lang.success_reply), b = y.innerHTML.indexOf(os.lang.flood), v = x.getElementsByTagName('a'), i = 0; i < v.length; i++) /\/viewtopic/g.test(v[i].href) && (c = v[i].href, d = v[i].href.match(/(\d+)$/g)[0]);
b > 0 ? (os.notice(os.lang.flood, os.lang.color_b), f.value = os.button_value_reply) : y.innerHTML.indexOf(os.lang.newpost) > 0 ? os.XML(os.serialize(x.forms.posts), '/post', function () {
0 > a ? os.notice(os.lang.error_reply) : (os.new_post(c, d), f.value = os.button_value_reply)
}) : 0 > a ? os.notice(os.lang.error_reply) : os.isTheme ? (os.new_post(c, d), f.value = os.button_value_reply, os.notice(os.lang.wait_notice, os.lang.color_c)) : document.location.href = c
})) : os.notice(os.lang.words_reply, os.lang.color_d)
},
new_post: function (c, a, l) {
var f, g, h, b, m, n, s, x;
os.XML('', c, function (e) {
x = e.responseXML;
b = x.getElementsByClassName('post--' + a)[0];
b.style.display = 'none';
b.className += ' new_ajax_post';
os.set_post(b);
os.sceditor.val('');
os.notice(os.lang.success_reply, os.lang.color_e);
})
},
set_post: function (h) {
var e = os.punbb ? document.getElementsByClassName('topic')[0] : os.phpbb2 ? document.getElementsByClassName('catBottom')[0].parentNode.previousElementSibling : os.phpbb3 ? document.getElementsByName('bottomtitle')[0].previousElementSibling : os.invision && document.getElementsByClassName('topic-footer')[0].previousElementSibling;
os.punbb ? e.appendChild(h) : e.parentNode.insertBefore(h, e.nextSibling);
os.fadeIn(h, 500);
},
XML: function (a, b, f) {
var c;
c = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject && (new ActiveXObject('Microsoft.XMLHTTP'));
'undefined' != typeof a ? c.open('POST', b) : c.open('GET', b, true);
c.responseType = 'document';
c.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
'undefined' != typeof a ? c.send(a) : c.send();
c.onreadystatechange = function () {
this.readyState == 4 && this.status == 200 && (f(this));
};
},
serialize: function (b) {
var a, i, j, l, s = [];
if ('object' == typeof b && 'FORM' == b.nodeName) {
l = b.elements.length;
for (i = 0; l > i; i++)
if (a = b.elements[i], a.name && !a.disabled && 'file' != a.type && 'reset' != a.type && 'submit' != a.type && 'button' != a.type)
if ('select-multiple' == a.type)
for (j = b.elements[i].options.length - 1; j >= 0; j--) a.options[j].selected && (s[s.length] = encodeURIComponent(a.name) + '=' + encodeURIComponent(a.options[j].value));
else('checkbox' != a.type && 'radio' != a.type || a.checked) && (s[s.length] = encodeURIComponent(a.name) + '=' + encodeURIComponent(a.value))
}
return s.join('&').replace(/%20/g, '+');
},
fadeIn: function (a, b) {
var e, d;
if (!a) return;
a.style.opacity = 0, a.style.filter = 'alpha(opacity=0)', a.style.display = 'block', a.style.visibility = 'visible',
b ? (e = 0, d = setInterval(function () {
e += 50 / b, e >= 1 && (clearInterval(d), e = 1), a.style.opacity = e, a.style.filter = 'alpha(opacity=' + e * 100 + ')'
}, 50)) : (a.style.opacity = 1, a.style.filter = 'alpha(opacity=1)')
},
close: function (c) {
var a = c.parentNode;
a.previousElementSibling.remove();
a.remove();
}
};
$(function () {
(document.getElementById('logout') && /\/t\d+/g.test(window.location.pathname) || /\/post/.test(window.location.pathname)) && os.init()
});
Permissions in this forum:
You cannot reply to topics in this forum
|
|