mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 23:29:57 +09:00
Add option to select different editors for PC and mobile
This commit is contained in:
parent
ee6c62a91e
commit
e0f5678aba
13 changed files with 412 additions and 232 deletions
|
|
@ -1,55 +1,21 @@
|
|||
function getEditorSkinColorList(skin_name,selected_colorset,type,testid){
|
||||
if(skin_name.length>0){
|
||||
type = type || 'document';
|
||||
var response_tags = new Array('error','message','colorset');
|
||||
exec_xml('editor','dispEditorSkinColorset',{skin:skin_name},resultGetEditorSkinColorList,response_tags,{'selected_colorset':selected_colorset,'type':type,'testid':testid});
|
||||
}
|
||||
}
|
||||
"use strict";
|
||||
|
||||
function resultGetEditorSkinColorList(ret_obj,response_tags, params) {
|
||||
var selectbox = null;
|
||||
jQuery(function($){
|
||||
if(params.testid){
|
||||
selectbox = $("#"+params.testid).next('label').children('select');
|
||||
} else {
|
||||
selectbox = (params.type == 'document') ? $('select[name=sel_editor_colorset]') : $('select[name=sel_comment_editor_colorset]');
|
||||
}
|
||||
selectbox.html('');
|
||||
|
||||
if(params.type == 'document'){
|
||||
$("select[name=sel_editor_colorset]").hide()
|
||||
.removeAttr('name');
|
||||
selectbox.attr('name','sel_editor_colorset');
|
||||
} else {
|
||||
$("select[name=sel_comment_editor_colorset]").hide()
|
||||
.removeAttr('name');
|
||||
selectbox.attr('name','sel_comment_editor_colorset');
|
||||
}
|
||||
|
||||
/* jshint -W041 */
|
||||
if(ret_obj.error == 0 && ret_obj.colorset){
|
||||
var it = [];
|
||||
var items = ret_obj.colorset.item;
|
||||
if(typeof(items[0]) == 'undefined'){
|
||||
it[0] = items;
|
||||
} else {
|
||||
it = items;
|
||||
(function($) {
|
||||
$(function() {
|
||||
$('.editor_skin_selector').on('change', function() {
|
||||
var colorset_selector = $(this).siblings('.editor_colorset_selector').empty();
|
||||
var colorset_list = $(this).find('option:selected').data('colorsets');
|
||||
if (colorset_list && colorset_list.length) {
|
||||
$.each(colorset_list, function(i, colorset) {
|
||||
var option = $('<option></option>');
|
||||
option.attr('value', colorset.name);
|
||||
option.text(colorset.title);
|
||||
option.appendTo(colorset_selector);
|
||||
if (colorset.title.indexOf('L') > -1) {
|
||||
option.attr('selected', 'selected');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var selectAttr = "";
|
||||
for(var i=0;i<it.length;i++){
|
||||
var $options = $('<option value="'+it[i].name+'" >'+it[i].title+'</option>');
|
||||
|
||||
if(params.selected_colorset == it[i].name){
|
||||
$options.attr('selected', 'selected');
|
||||
}
|
||||
|
||||
selectbox.append($options);
|
||||
}
|
||||
selectbox.show();
|
||||
} else {
|
||||
selectbox.hide();
|
||||
selectbox.html('');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
Loading…
Add table
Add a link
Reference in a new issue