mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
Reformated JS (#770)
This commit is contained in:
parent
2c1cb6d703
commit
76fa6eeabd
2 changed files with 18 additions and 36 deletions
|
@ -107,9 +107,8 @@ if (DBG_USER) {
|
|||
unset($_COOKIE['explain']);
|
||||
}
|
||||
|
||||
define('DELETED', -1);
|
||||
|
||||
// User Levels
|
||||
define('DELETED', -1);
|
||||
define('USER', 0);
|
||||
define('ADMIN', 1);
|
||||
define('MOD', 2);
|
||||
|
|
|
@ -30,19 +30,12 @@ BBCode.prototype = {
|
|||
this.textarea = textarea;
|
||||
this.tags = {};
|
||||
// Tag for quoting
|
||||
this.addTag(
|
||||
'_quoter',
|
||||
function () {
|
||||
return '[quote="' + th.quoter + '"][qpost=' + th.qouted_pid + ']'
|
||||
},
|
||||
'[/quote]\n',
|
||||
null,
|
||||
null,
|
||||
function () {
|
||||
th.collapseAfterInsert = true;
|
||||
return th._prepareMultiline(th.quoterText)
|
||||
}
|
||||
);
|
||||
this.addTag('_quoter', function () {
|
||||
return '[quote="' + th.quoter + '"][qpost=' + th.qouted_pid + ']'
|
||||
}, '[/quote]\n', null, null, function () {
|
||||
th.collapseAfterInsert = true;
|
||||
return th._prepareMultiline(th.quoterText)
|
||||
});
|
||||
|
||||
// Init events
|
||||
var th = this;
|
||||
|
@ -73,8 +66,7 @@ BBCode.prototype = {
|
|||
var sel = this.getSelection()[0];
|
||||
if (sel) {
|
||||
this.insertAtCursor('[quote]' + sel + '[/quote]\n');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
alert('Вы не выбрали текст');
|
||||
}
|
||||
return false;
|
||||
|
@ -84,8 +76,7 @@ BBCode.prototype = {
|
|||
emoticon: function (em) {
|
||||
if (em) {
|
||||
this.insertAtCursor(' ' + em + ' ');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
@ -230,12 +221,9 @@ BBCode.prototype = {
|
|||
// Hot keys
|
||||
var form = this.textarea.form;
|
||||
var submitter = null;
|
||||
if (e.keyCode === this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey)
|
||||
submitter = form.add_attachment_box;
|
||||
if (e.keyCode === this.VK_ENTER && !e.shiftKey && !e.ctrlKey && e.altKey)
|
||||
submitter = form.preview;
|
||||
if (e.keyCode === this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey)
|
||||
submitter = form.post;
|
||||
if (e.keyCode === this.VK_PAGE_UP && e.shiftKey && !e.ctrlKey && e.altKey) submitter = form.add_attachment_box;
|
||||
if (e.keyCode === this.VK_ENTER && !e.shiftKey && !e.ctrlKey && e.altKey) submitter = form.preview;
|
||||
if (e.keyCode === this.VK_ENTER && !e.shiftKey && e.ctrlKey && !e.altKey) submitter = form.post;
|
||||
if (submitter) {
|
||||
submitter.click();
|
||||
return this._cancelEvent(e);
|
||||
|
@ -272,8 +260,7 @@ BBCode.prototype = {
|
|||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (id && id.indexOf('_') !== 0) return alert("addTag('" + id + "'): no such element in the form");
|
||||
}
|
||||
},
|
||||
|
@ -286,7 +273,7 @@ BBCode.prototype = {
|
|||
|
||||
// Open tag is generated by callback?
|
||||
var op = tag.open;
|
||||
if (typeof(tag.open) === "function") op = tag.open(tag.elt);
|
||||
if (typeof (tag.open) === "function") op = tag.open(tag.elt);
|
||||
var cl = tag.close !== null ? tag.close : "/" + op;
|
||||
|
||||
// Use "[" if needed
|
||||
|
@ -317,8 +304,7 @@ if (window.HTMLElement && window.HTMLElement.prototype.__defineSetter__) {
|
|||
}
|
||||
|
||||
function AddSelectedText(BBOpen, BBClose) {
|
||||
if (document.post.message.caretPos) document.post.message.caretPos.text = BBOpen + document.post.message.caretPos.text + BBClose;
|
||||
else document.post.message.value += BBOpen + BBClose;
|
||||
if (document.post.message.caretPos) document.post.message.caretPos.text = BBOpen + document.post.message.caretPos.text + BBClose; else document.post.message.value += BBOpen + BBClose;
|
||||
document.post.message.focus()
|
||||
}
|
||||
|
||||
|
@ -384,8 +370,7 @@ function initPostImages(context) {
|
|||
imgFit(this, maxW);
|
||||
$v.empty().append(this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$img.one('load', function () {
|
||||
imgFit(this, maxW)
|
||||
});
|
||||
|
@ -419,8 +404,7 @@ function initSpoilers(context) {
|
|||
$('div.sp-head', $($sp_body.parents('td')[0])).filter(function () {
|
||||
return $(this).hasClass('unfolded') ? fold : !fold
|
||||
}).click();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$(this).toggleClass('unfolded');
|
||||
$sp_body.slideToggle('fast');
|
||||
}
|
||||
|
@ -440,8 +424,7 @@ function fixPostImage($img) {
|
|||
var src = $img[0].src;
|
||||
if (src.match(banned_image_hosts)) {
|
||||
$img.wrap('<a href="' + this.src + '" target="_blank"></a>').attr({
|
||||
src: "" + bb_url + "styles/images/smiles/tr_oops.gif",
|
||||
title: "" + bbl['scr_rules'] + ""
|
||||
src: "" + bb_url + "styles/images/smiles/tr_oops.gif", title: "" + bbl['scr_rules'] + ""
|
||||
});
|
||||
}
|
||||
return $img;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue