1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 09:24:25 +03:00

Merge pull request #90 from 1d10t/master

js
This commit is contained in:
Mzhelskiy Maxim 2012-03-01 07:58:23 -08:00
commit 18b266f9e5
2 changed files with 40 additions and 40 deletions

View file

@ -143,9 +143,9 @@ ls.swfupload = (function ($) {
debug: false debug: false
}; };
ls.hook.run('ls_swfupload_init_options_after',arguments,this.swfOptions) ls.hook.run('ls_swfupload_init_options_after',arguments,this.swfOptions);
} };
this.loadSwf = function() { this.loadSwf = function() {
var f = {}; var f = {};
@ -200,31 +200,31 @@ ls.swfupload = (function ($) {
} }
this.swfu = new SWFUpload(this.swfOptions); this.swfu = new SWFUpload(this.swfOptions);
return this.swfu; return this.swfu;
} };
this.handlerFileQueueError = function(file, errorCode, message) { this.handlerFileQueueError = function(file, errorCode, message) {
$(this).trigger('eFileQueueError',[file, errorCode, message]); $(this).trigger('eFileQueueError',[file, errorCode, message]);
} };
this.handlerFileDialogComplete = function(numFilesSelected, numFilesQueued) { this.handlerFileDialogComplete = function(numFilesSelected, numFilesQueued) {
$(this).trigger('eFileDialogComplete',[numFilesSelected, numFilesQueued]); $(this).trigger('eFileDialogComplete',[numFilesSelected, numFilesQueued]);
if (numFilesQueued>0) { if (numFilesQueued>0) {
this.startUpload(); this.startUpload();
} }
} };
this.handlerUploadProgress = function(file, bytesLoaded) { this.handlerUploadProgress = function(file, bytesLoaded) {
var percent = Math.ceil((bytesLoaded / file.size) * 100); var percent = Math.ceil((bytesLoaded / file.size) * 100);
$(this).trigger('eUploadProgress',[file, bytesLoaded, percent]); $(this).trigger('eUploadProgress',[file, bytesLoaded, percent]);
} };
this.handlerUploadError = function(file, errorCode, message) { this.handlerUploadError = function(file, errorCode, message) {
$(this).trigger('eUploadError',[file, errorCode, message]); $(this).trigger('eUploadError',[file, errorCode, message]);
} };
this.handlerUploadSuccess = function(file, serverData) { this.handlerUploadSuccess = function(file, serverData) {
$(this).trigger('eUploadSuccess',[file, serverData]); $(this).trigger('eUploadSuccess',[file, serverData]);
} };
this.handlerUploadComplete = function(file) { this.handlerUploadComplete = function(file) {
var next = this.getStats().files_queued; var next = this.getStats().files_queued;
@ -232,7 +232,7 @@ ls.swfupload = (function ($) {
this.startUpload(); this.startUpload();
} }
$(this).trigger('eUploadComplete',[file, next]); $(this).trigger('eUploadComplete',[file, next]);
} };
return this; return this;
}).call(ls.swfupload || {},jQuery); }).call(ls.swfupload || {},jQuery);
@ -249,7 +249,7 @@ ls.tools = (function ($) {
this.ucfirst = function(str) { this.ucfirst = function(str) {
var f = str.charAt(0).toUpperCase(); var f = str.charAt(0).toUpperCase();
return f + str.substr(1, str.length-1); return f + str.substr(1, str.length-1);
} };
/** /**
* Выделяет все chekbox с определенным css классом * Выделяет все chekbox с определенным css классом
@ -262,7 +262,7 @@ ls.tools = (function ($) {
$(item).attr('checked', $(checkbox).attr("checked")); $(item).attr('checked', $(checkbox).attr("checked"));
} }
}); });
} };
/** /**
* Предпросмотр * Предпросмотр
@ -290,7 +290,7 @@ ls.tools = (function ($) {
} }
} }
}); });
} };
/** /**
* Возвращает выделенный текст на странице * Возвращает выделенный текст на странице
@ -309,7 +309,7 @@ ls.tools = (function ($) {
} }
} }
return text; return text;
} };
return this; return this;
@ -324,7 +324,7 @@ ls = (function ($) {
/** /**
* Глобальные опции * Глобальные опции
*/ */
this.options = this.options || {} this.options = this.options || {};
/** /**
* Выполнение AJAX запроса, автоматически передает security key * Выполнение AJAX запроса, автоматически передает security key
@ -338,9 +338,9 @@ ls = (function ($) {
if (typeof(v) == "boolean") { if (typeof(v) == "boolean") {
params[k]=v ? 1 : 0; params[k]=v ? 1 : 0;
} }
}) });
if (url.indexOf('http://')!=0 && url.indexOf('https://')!=0) { if (url.indexOf('http://')!=0 && url.indexOf('https://')!=0 && url.indexOf('/')!=0) {
url=aRouter['ajax']+url+'/'; url=aRouter['ajax']+url+'/';
} }
@ -349,17 +349,17 @@ ls = (function ($) {
url: url, url: url,
data: params, data: params,
dataType: more.dataType || 'json', dataType: more.dataType || 'json',
success: callback || function(msg){ success: callback || function(){
ls.debug("base success: "); ls.debug("ajax success: ");
ls.debug(msg); ls.debug.apply(this,arguments);
}.bind(this), }.bind(this),
error: more.error || function(msg){ error: more.error || function(msg){
ls.debug("base error: "); ls.debug("ajax error: ");
ls.debug(msg); ls.debug.apply(this,arguments);
}.bind(this), }.bind(this),
complete: more.complete || function(msg){ complete: more.complete || function(msg){
ls.debug("base complete: "); ls.debug("ajax complete: ");
ls.debug(msg); ls.debug.apply(this,arguments);
}.bind(this) }.bind(this)
}; };
@ -376,7 +376,7 @@ ls = (function ($) {
if (typeof(form)=='string') { if (typeof(form)=='string') {
form=$('#'+form); form=$('#'+form);
} }
if (url.indexOf('http://')!=0 && url.indexOf('https://')!=0) { if (url.indexOf('http://')!=0 && url.indexOf('https://')!=0 && url.indexOf('/')!=0) {
url=aRouter['ajax']+url+'/'; url=aRouter['ajax']+url+'/';
} }
@ -385,21 +385,21 @@ ls = (function ($) {
url: url, url: url,
dataType: more.dataType || 'json', dataType: more.dataType || 'json',
data: {security_ls_key: LIVESTREET_SECURITY_KEY}, data: {security_ls_key: LIVESTREET_SECURITY_KEY},
success: callback || function(msg){ success: callback || function(){
ls.debug("base success: "); ls.debug("ajax success: ");
ls.debug(msg); ls.debug.apply(this,arguments);
}.bind(this), }.bind(this),
error: more.error || function(x,s,e){ error: more.error || function(){
ls.debug("base error: "); ls.debug("ajax error: ");
ls.debug(x); ls.debug.apply(this,arguments);
}.bind(this) }.bind(this)
} };
ls.hook.run('ls_ajaxsubmit_before', [options], this); ls.hook.run('ls_ajaxsubmit_before', [options], this);
form.ajaxSubmit(options); form.ajaxSubmit(options);
} };
/** /**
* Загрузка изображения * Загрузка изображения
@ -416,7 +416,7 @@ ls = (function ($) {
'*ajaxUploadImgAfter*'; '*/ajaxUploadImgAfter*'; '*ajaxUploadImgAfter*'; '*/ajaxUploadImgAfter*';
} }
}); });
} };
/** /**
* Дебаг сообщений * Дебаг сообщений
@ -425,7 +425,7 @@ ls = (function ($) {
if (this.options.debug) { if (this.options.debug) {
this.log.apply(this,arguments); this.log.apply(this,arguments);
} }
} };
/** /**
* Лог сообщений * Лог сообщений
@ -436,7 +436,7 @@ ls = (function ($) {
} else { } else {
//alert(msg); //alert(msg);
} }
} };
return this; return this;
}).call(ls || {},jQuery); }).call(ls || {},jQuery);
@ -490,15 +490,15 @@ ls.autocomplete = (function ($) {
} }
}); });
} }
} };
this.split = function(val) { this.split = function(val) {
return val.split( /,\s*/ ); return val.split( /,\s*/ );
} };
this.extractLast = function(term) { this.extractLast = function(term) {
return ls.autocomplete.split(term).pop(); return ls.autocomplete.split(term).pop();
} };
return this; return this;
}).call(ls.autocomplete || {},jQuery); }).call(ls.autocomplete || {},jQuery);

View file

@ -31,7 +31,7 @@ function getMarkitupSettings() {
{name: ls.lang.get('panel_list'), className:'editor-ol', openWith:' <li>', closeWith:'</li>', multiline: true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>' }, {name: ls.lang.get('panel_list'), className:'editor-ol', openWith:' <li>', closeWith:'</li>', multiline: true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>' },
{name: ls.lang.get('panel_list_li'), className:'editor-li', openWith:'<li>', closeWith:'</li>' }, {name: ls.lang.get('panel_list_li'), className:'editor-li', openWith:'<li>', closeWith:'</li>' },
{separator:'---------------' }, {separator:'---------------' },
{name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { $('#form_upload_img').jqmShow(); } }, {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#form_upload_img').jqmShow(); } },
{name: ls.lang.get('panel_image'), className:'editor-image', replaceWith:'<img src="[!['+ls.lang.get('panel_image_promt')+':!:http://]!]" />' }, {name: ls.lang.get('panel_image'), className:'editor-image', replaceWith:'<img src="[!['+ls.lang.get('panel_image_promt')+':!:http://]!]" />' },
{name: ls.lang.get('panel_video'), className:'editor-video', replaceWith:'<video>[!['+ls.lang.get('panel_video_promt')+':!:http://]!]</video>' }, {name: ls.lang.get('panel_video'), className:'editor-video', replaceWith:'<video>[!['+ls.lang.get('panel_video_promt')+':!:http://]!]</video>' },
{name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'<a href="[!['+ls.lang.get('panel_url_promt')+':!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' }, {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'<a href="[!['+ls.lang.get('panel_url_promt')+':!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
@ -55,7 +55,7 @@ function getMarkitupCommentSettings() {
{separator:'---------------' }, {separator:'---------------' },
{name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>' } }, {name: ls.lang.get('panel_quote'), className:'editor-quote', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>' } },
{name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<code>', closeWith:'</code>' }, {name: ls.lang.get('panel_code'), className:'editor-code', openWith:'<code>', closeWith:'</code>' },
{name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { $('#form_upload_img').jqmShow(); } }, {name: ls.lang.get('panel_image'), className:'editor-picture', key:'P', beforeInsert: function(h) { jQuery('#form_upload_img').jqmShow(); } },
{name: ls.lang.get('panel_image'), className:'editor-image', replaceWith:'<img src="[!['+ls.lang.get('panel_image_promt')+':!:http://]!]" />' }, {name: ls.lang.get('panel_image'), className:'editor-image', replaceWith:'<img src="[!['+ls.lang.get('panel_image_promt')+':!:http://]!]" />' },
{name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'<a href="[!['+ls.lang.get('panel_url_promt')+':!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' }, {name: ls.lang.get('panel_url'), className:'editor-link', key:'L', openWith:'<a href="[!['+ls.lang.get('panel_url_promt')+':!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
{name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'<ls user="[!['+ls.lang.get('panel_user_promt')+']!]" />' }, {name: ls.lang.get('panel_user'), className:'editor-user', replaceWith:'<ls user="[!['+ls.lang.get('panel_user_promt')+']!]" />' },