2013-05-17 14:32:03 +03:00
/ * *
* Различные настройки
2013-08-29 12:30:04 +03:00
*
* @ module ls / settings
*
* @ license GNU General Public License , version 2
* @ copyright 2013 OOO "ЛС-СОФТ" { @ link http : //livestreetcms.com}
* @ author Denis Shakhov < denis . shakhov @ gmail . com >
2013-05-17 14:32:03 +03:00
* /
2012-04-01 18:39:25 +03:00
var ls = ls || { } ;
ls . settings = ( function ( $ ) {
2013-07-02 06:53:08 +03:00
this . get = function ( sSettingsName ) {
return this [ sSettingsName ] ;
2012-04-01 18:39:25 +03:00
} ;
2013-07-02 06:53:08 +03:00
this . markitup = {
onShiftEnter : { keepDefault : false , replaceWith : '<br />\n' } ,
onCtrlEnter : { keepDefault : false , openWith : '\n<p>' , closeWith : '</p>' } ,
onTab : { keepDefault : false , replaceWith : ' ' } ,
markupSet : [
{ name : 'H4' , className : 'editor-h4' , openWith : '<h4>' , closeWith : '</h4>' } ,
{ name : 'H5' , className : 'editor-h5' , openWith : '<h5>' , closeWith : '</h5>' } ,
{ name : 'H6' , className : 'editor-h6' , openWith : '<h6>' , closeWith : '</h6>' } ,
{ separator : '---------------' } ,
{ name : ls . lang . get ( 'panel_b' ) , className : 'editor-bold' , key : 'B' , openWith : '(!(<strong>|!|<b>)!)' , closeWith : '(!(</strong>|!|</b>)!)' } ,
{ name : ls . lang . get ( 'panel_i' ) , className : 'editor-italic' , key : 'I' , openWith : '(!(<em>|!|<i>)!)' , closeWith : '(!(</em>|!|</i>)!)' } ,
{ name : ls . lang . get ( 'panel_s' ) , className : 'editor-stroke' , key : 'S' , openWith : '<s>' , closeWith : '</s>' } ,
{ name : ls . lang . get ( 'panel_u' ) , className : 'editor-underline' , key : 'U' , openWith : '<u>' , closeWith : '</u>' } ,
{ 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|!|codeline)!)>' , closeWith : '</(!(code|!|codeline)!)>' } ,
{ separator : '---------------' } ,
{ name : ls . lang . get ( 'panel_list' ) , className : 'editor-ul' , openWith : ' <li>' , closeWith : '</li>' , multiline : true , openBlockWith : '<ul>\n' , closeBlockWith : '\n</ul>' } ,
{ 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>' } ,
{ separator : '---------------' } ,
2013-07-09 08:09:06 +03:00
{ name : ls . lang . get ( 'panel_image' ) , className : 'editor-picture' , key : 'P' , beforeInsert : function ( h ) { jQuery ( '#modal-image-upload' ) . modal ( 'show' ) ; } } ,
2013-07-02 06:53:08 +03:00
{ 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_user' ) , className : 'editor-user' , replaceWith : '<ls user="[![' + ls . lang . get ( 'panel_user_promt' ) + ']!]" />' } ,
{ separator : '---------------' } ,
{ name : ls . lang . get ( 'panel_clear_tags' ) , className : 'editor-clean' , replaceWith : function ( markitup ) { return markitup . selection . replace ( /<(.*?)>/g , "" ) } } ,
{ name : ls . lang . get ( 'panel_cut' ) , className : 'editor-cut' , replaceWith : function ( markitup ) { if ( markitup . selection ) return '<cut name="' + markitup . selection + '">' ; else return '<cut>' } }
]
} ;
this . markitupComment = {
onShiftEnter : { keepDefault : false , replaceWith : '<br />\n' } ,
onTab : { keepDefault : false , replaceWith : ' ' } ,
markupSet : [
{ name : ls . lang . get ( 'panel_b' ) , className : 'editor-bold' , key : 'B' , openWith : '(!(<strong>|!|<b>)!)' , closeWith : '(!(</strong>|!|</b>)!)' } ,
{ name : ls . lang . get ( 'panel_i' ) , className : 'editor-italic' , key : 'I' , openWith : '(!(<em>|!|<i>)!)' , closeWith : '(!(</em>|!|</i>)!)' } ,
{ name : ls . lang . get ( 'panel_s' ) , className : 'editor-stroke' , key : 'S' , openWith : '<s>' , closeWith : '</s>' } ,
{ name : ls . lang . get ( 'panel_u' ) , className : 'editor-underline' , key : 'U' , openWith : '<u>' , closeWith : '</u>' } ,
{ 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_code' ) , className : 'editor-code' , openWith : '<(!(code|!|codeline)!)>' , closeWith : '</(!(code|!|codeline)!)>' } ,
2014-01-15 14:00:01 +02:00
{ name : ls . lang . get ( 'panel_image' ) , className : 'editor-picture' , key : 'P' , beforeInsert : function ( h ) { jQuery ( '#modal-image-upload' ) . modal ( 'show' ) ; } } ,
2013-07-02 06:53:08 +03:00
{ 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' ) + ']!]" />' } ,
{ separator : '---------------' } ,
{ name : ls . lang . get ( 'panel_clear_tags' ) , className : 'editor-clean' , replaceWith : function ( markitup ) { return markitup . selection . replace ( /<(.*?)>/g , "" ) } }
]
2012-04-01 18:39:25 +03:00
} ;
2013-07-02 06:53:08 +03:00
this . tinymce = {
mode : "specific_textareas" ,
editor _selector : "mce-editor" ,
theme : "advanced" ,
skin : "livestreet" ,
theme _advanced _toolbar _location : "top" ,
theme _advanced _toolbar _align : "left" ,
theme _advanced _buttons1 : "lshselect,bold,italic,underline,strikethrough,|,bullist,numlist,|,undo,redo,|,lslink,unlink,lsvideo,lsimage,pagebreak,code" ,
theme _advanced _buttons2 : "" ,
theme _advanced _buttons3 : "" ,
theme _advanced _statusbar _location : "bottom" ,
theme _advanced _resizing : true ,
theme _advanced _resize _horizontal : 0 ,
theme _advanced _resizing _use _cookie : 0 ,
theme _advanced _path : false ,
object _resizing : true ,
force _br _newlines : true ,
forced _root _block : '' , // Needed for 3.x
force _p _newlines : false ,
plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize" ,
convert _urls : false ,
extended _valid _elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]" ,
pagebreak _separator : "<cut>" ,
media _strict : false ,
language : 'ru' ,
inline _styles : false ,
formats : {
underline : { inline : 'u' , exact : true } ,
strikethrough : { inline : 's' , exact : true }
2012-04-01 18:39:25 +03:00
}
} ;
2013-07-02 06:53:08 +03:00
this . tinymceComment = {
mode : "textareas" ,
theme : "advanced" ,
skin : "livestreet" ,
theme _advanced _toolbar _location : "top" ,
theme _advanced _toolbar _align : "left" ,
theme _advanced _buttons1 : "bold,italic,underline,strikethrough,lslink,lsquote" ,
theme _advanced _buttons2 : "" ,
theme _advanced _buttons3 : "" ,
theme _advanced _statusbar _location : "bottom" ,
theme _advanced _resizing : true ,
theme _advanced _resize _horizontal : 0 ,
theme _advanced _resizing _use _cookie : 0 ,
theme _advanced _path : false ,
object _resizing : true ,
force _br _newlines : true ,
forced _root _block : '' , // Needed for 3.x
force _p _newlines : false ,
plugins : "lseditor,safari,inlinepopups,media,pagebreak,autoresize" ,
convert _urls : false ,
extended _valid _elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height]" ,
pagebreak _separator : "<cut>" ,
media _strict : false ,
language : 'ru' ,
inline _styles : false ,
formats : {
underline : { inline : 'u' , exact : true } ,
strikethrough : { inline : 's' , exact : true }
} ,
setup : function ( ed ) {
// Display an alert onclick
ed . onKeyPress . add ( function ( ed , e ) {
key = e . keyCode || e . which ;
if ( e . ctrlKey && ( key == 13 ) ) {
$ ( '#comment-button-submit' ) . click ( ) ;
return false ;
}
} ) ;
2012-04-01 18:39:25 +03:00
}
} ;
return this ;
} ) . call ( ls . settings || { } , jQuery ) ;