Sha256: ef1590bdaae61b42a70933e74c5a84bb3d40b47a5876cdc80c4130d5cf6d1a95

Contents?: true

Size: 1.61 KB

Versions: 16

Compression:

Stored size: 1.61 KB

Contents

/**
 * Created with JetBrains PhpStorm.
 * User: xuheng
 * Date: 12-8-8
 * Time: 下午2:09
 * To change this template use File | Settings | File Templates.
 */
(function () {
    var me = editor,
            preview = $G( "preview" ),
            preitem = $G( "preitem" ),
            tmps = templates,
            currentTmp;
    var initPre = function () {
        var str = "";
        for ( var i = 0, tmp; tmp = tmps[i++]; ) {
            str += '<div class="preitem" onclick="pre(' + i + ')"><img src="' + "images/" + tmp.pre + '" ' + (tmp.title ? "alt=" + tmp.title + " title=" + tmp.title + "" : "") + '></div>';
        }
        preitem.innerHTML = str;
    };
    var pre = function ( n ) {
        var tmp = tmps[n - 1];
        currentTmp = tmp;
        clearItem();
        domUtils.setStyles( preitem.childNodes[n - 1], {
            "background-color":"lemonChiffon",
            "border":"#ccc 1px solid"
        } );
        preview.innerHTML = tmp.preHtml ? tmp.preHtml : "";
    };
    var clearItem = function () {
        var items = preitem.children;
        for ( var i = 0, item; item = items[i++]; ) {
            domUtils.setStyles( item, {
                "background-color":"",
                "border":"white 1px solid"
            } );
        }
    };
    dialog.onok = function () {
        if ( !$G( "issave" ).checked ){
            me.execCommand( "cleardoc" );
        }
        var obj = {
            html:currentTmp && currentTmp.html
        };
        me.execCommand( "template", obj );
    };
    initPre();
    window.pre = pre;
    pre(2)

})();

Version data entries

16 entries across 16 versions & 7 rubygems

Version Path
activeadmin_ueditor-0.2.0 public/assets/ueditor/dialogs/template/template.js
baidu_ueditor_rails5-0.3.1 app/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails5-0.3.0 app/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.2.3 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.2.2 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.2.1 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.2.0 vendor/assets/javascripts/ueditor/dialogs/template/template.js
ueditor_rails4-0.0.5 vendor/assets/javascripts/ueditor/dialogs/template/template.js
rails_ueditor-0.2.0 vendor/assets/javascripts/ueditor/dialogs/template/template.js
ueditor.rails-0.0.3 vendor/assets/javascripts/ueditor/dialogs/template/template.js
ueditor.rails-0.0.2 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.1.0 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.0.5 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.0.4 vendor/assets/javascripts/ueditor/dialogs/template/template.js
baidu_ueditor_rails-0.0.3 vendor/assets/javascripts/ueditor/dialogs/template/template.js
ueditor_rails-0.0.4 vendor/assets/javascripts/ueditor/dialogs/template/template.js