patch_file/updatefiles/accessibility/CKEDITOR Readme.txt

320 lines
13 KiB
Plaintext
Raw Permalink Normal View History

<EFBFBD>b <20>ثe<D8AB>M<EFBFBD><4D>/app/assets/stylesheets/lib<69><62><EFBFBD><EFBFBD><EFBFBD>Jjquery-ui-12.1<EFBFBD><EFBFBD><EFBFBD>Ƨ<EFBFBD>
<EFBFBD>b <20>ثe<D8AB>M<EFBFBD><4D>/app/views/layouts/back_end.html.erb<72>M
<20>ثe<D8AB>M<EFBFBD><4D>/app/views/page_parts/_form.html.erb<72><62><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>H<EFBFBD>U<EFBFBD><55><EFBFBD>e
<script src="/assets/lib/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript">
/* <20>ץ<EFBFBD>bootstap.js<6A>Mjquery-ui.js<6A><73><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>,<2C><>tab<61><62><EFBFBD>s<EFBFBD>ॿ<EFBFBD>`<60>B<EFBFBD>@ */
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
/* <20>ץ<EFBFBD>bootstap.js<6A>Mjquery-ui.js<6A><73><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>,<2C><>tab<61><62><EFBFBD>s<EFBFBD>ॿ<EFBFBD>`<60>B<EFBFBD>@ */
</script>
<link rel="stylesheet" href="/assets/lib/jquery-ui-1.12.1/jquery-ui.min.css">
<script>
$('.btn-primary').attr('onclick',"return checkArea()");
var textID = new Array($('.ckeditor').length);
$(document).ready(function(){
for(var i=0 ; i< $('.ckeditor').length ; i++){
if($('.ckeditor').eq(i).attr("id") == "" || $('.ckeditor').eq(i).attr("id") == undefined){
$('.ckeditor').eq(i).attr("id","ckeditorArea"+i);
textID[i] = "ckeditorArea"+i
}else{
textID[i] = $('.ckeditor').eq(i).attr("id");
}
try{
CKEDITOR.replace(textID[i])
}catch(e){};
}
});
function checkArea(){
var flag = 1;//1=>true
if( $(".fakeArea").length !=0 )
$(".fakeArea").remove();
var k = 0; //k=0 => <20>Ҧ<EFBFBD>iframe<6D><65>title<6C><65><EFBFBD><EFBFBD><EFBFBD>[
var k1 = 0;//k1=0 => <20>Ҧ<EFBFBD>img<6D><67>title<6C>Malt<6C><74><EFBFBD><EFBFBD><EFBFBD>[
var k2 = 0;//k2=0 => <20>Ҧ<EFBFBD>a<EFBFBD><61>title<6C><65><EFBFBD><EFBFBD><EFBFBD>[
for(var i=0 ; i< $('.ckeditor').length ; i++){
$("#"+textID[i]).before("<div class='fakeArea' style='display:none;'></div>");
var Data = CKEDITOR.instances[textID[i]].getData();
$(".fakeArea").eq(i).html(Data);
/* change the font-size unit from px to em start*/
function changepxToem(that){
for(var i=0;i<that.querySelectorAll('*').length;i++){
if(that.querySelectorAll('*')[i].style.fontSize.search('px') != -1)
that.querySelectorAll('*')[i].style.fontSize = Number(that.querySelectorAll('*')[i].style.fontSize.split('px')[0]) / 16 + 'em';
}
}
changepxToem(document.querySelectorAll('.fakeArea')[i]);
/* change the font-size unit from px to em end*/
if($('.fakeArea:eq('+i+') iframe').length != 0){
for(var j=0;j<$('.fakeArea:eq('+i+') iframe').length;j++){
if($('.fakeArea:eq('+i+') iframe').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') iframe').eq(j).attr('title') ==''){
k += 1;
};
};
for(var j=0;j<$('.fakeArea:eq('+i+') img').length;j++){
if($('.fakeArea:eq('+i+') img').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('title') =='' || $('.fakeArea:eq('+i+') img').eq(j).attr('alt') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('alt') ==''){
k1 += 1;
};
}
for(var j=0;j<$('.fakeArea:eq('+i+') a').length;j++){
if($('.fakeArea:eq('+i+') a').eq(j).attr('href') != undefined || $('.fakeArea:eq('+i+') a').eq(j).attr('href') !=''){
if($('.fakeArea:eq('+i+') a').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') a').eq(j).attr('title') ==''){
k2 += 1;
};
};
}
};
};
function setIframe(){
for(var i=0 ; i< $('.ckeditor').length ; i++){
for(var j=0;j<$('.fakeArea:eq('+i+') iframe').length;j++){
if($('.fakeArea:eq('+i+') iframe').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') iframe').eq(j).attr('title') ==''){
if($('.fakeArea:eq('+i+') iframe').eq(j).attr('src').search("facebook") != -1)
$('.fakeArea:eq('+i+') iframe').eq(j).attr('title',"facebook");
else if($('.fakeArea:eq('+i+') iframe').eq(j).attr('src').search("twitframe") != -1)
$('.fakeArea:eq('+i+') iframe').eq(j).attr('title',"twitter");
else if($('.fakeArea:eq('+i+') iframe').eq(j).attr('src').search("google") != -1)
$('.fakeArea:eq('+i+') iframe').eq(j).attr('title',"google");
else if($('.fakeArea:eq('+i+') iframe').eq(j).attr('src').search("youtube") != -1)
$('.fakeArea:eq('+i+') iframe').eq(j).attr('title',"youtube");
}
};
CKEDITOR.instances[textID[i]].setData($('.fakeArea').eq(i).html());
};
};
function setImg(){
for(var i=0 ; i< $('.ckeditor').length ; i++){
for(var j=0;j<$('.fakeArea:eq('+i+') img').length;j++){
if($('.fakeArea:eq('+i+') img').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('title') =='' || $('.fakeArea:eq('+i+') img').eq(j).attr('alt') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('alt') ==''){
if($('.fakeArea:eq('+i+') img').eq(j).attr('title') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('title') =='' ){
if($('.ckeditor').eq(i).attr('name').search('zh_tw') != -1)
$('.fakeArea:eq('+i+') img').eq(j).attr('title','<27>o<EFBFBD>O<EFBFBD>@<40>i<EFBFBD>Ϥ<EFBFBD>')
else if($('.ckeditor').eq(i).attr('name').search('en') != -1)
$('.fakeArea:eq('+i+') img').eq(j).attr('title','This is a image')
};
if($('.fakeArea:eq('+i+') img').eq(j).attr('alt') == undefined || $('.fakeArea:eq('+i+') img').eq(j).attr('alt') =='' ){
if($('.ckeditor').eq(i).attr('name').search('zh_tw') != -1)
$('.fakeArea:eq('+i+') img').eq(j).attr('alt','<27>o<EFBFBD>O<EFBFBD>@<40>i<EFBFBD>Ϥ<EFBFBD>')
else if($('.ckeditor').eq(i).attr('name').search('en') != -1)
$('.fakeArea:eq('+i+') img').eq(j).attr('alt','This is a image')
};
}
}
CKEDITOR.instances[textID[i]].setData($('.fakeArea').eq(i).html());
};
};
function setAtitle(){
for(var i=0 ; i< $('.ckeditor').length ; i++){
for(var j=0;j<$('.fakeArea:eq('+i+') a').length;j++){
if($('.fakeArea:eq('+i+') a').eq(j).attr("href") != "" || $('.fakeArea:eq('+i+') a').eq(j).attr("href") != undefined ){
var titlestr="";
if($('.fakeArea:eq('+i+') a').eq(j).attr('target')=='_self')
titlestr += '<27>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}<7D><> ';
else if($('.fakeArea:eq('+i+') a').eq(j).attr('target') == '_blank')
titlestr += '<27>b<EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD>}<7D><> ';
if($('.fakeArea:eq('+i+') a').eq(j).attr('title')=="" || $('.fakeArea:eq('+i+') a').eq(j).attr('title')==undefined && $('.fakeArea:eq('+i+') a').eq(j).html().search('</') == -1)
titlestr += $('.fakeArea:eq('+i+') a').eq(j).html().trim();
else if($('.fakeArea:eq('+i+') a').eq(j).attr('title')=="" || $('.fakeArea:eq('+i+') a').eq(j).attr('title') == undefined && $('.fakeArea:eq('+i+') a').eq(j).find('>span').length==1)
titlestr += $('.fakeArea:eq('+i+') a').eq(j).find('>span').html().trim();
else if($('.fakeArea:eq('+i+') a').eq(j).attr('title') =="" || $('.fakeArea:eq('+i+') a').eq(j).attr('title') == undefined){
try{
if($('.fakeArea:eq('+i+') a').eq(j).html().trim().split('>').length==2)
titlestr += $('.fakeArea:eq('+i+') a').eq(j).html().trim().split('>')[1].trim();
else if($('.fakeArea:eq('+i+') a').eq(j).html().trim().split('>').length==3)
titlestr += $('.fakeArea:eq('+i+') a').eq(j).html().trim().split('>')[2].trim();
}catch(e){};
}
else
titlestr += $('.fakeArea:eq('+i+') a').eq(j).attr('title');
if(titlestr.search('<img') != -1)
titlestr = "<22>o<EFBFBD>O<EFBFBD>@<40>i<EFBFBD>Ӥ<EFBFBD>";
if(titlestr != "")
$('.fakeArea:eq('+i+') a').eq(j).attr('title',titlestr);
};
};
CKEDITOR.instances[textID[i]].setData($('.fakeArea').eq(i).html());
};
};
if( k != 0){
if($(".active > [data-toggle='tab']").attr("href") == ".zh_tw"){
alert('<27>Х[<5B>Wiframe<6D><65>title');
i = 0;
$("#"+textID[i]).before("<div id='dialog-confirm' title='<27>n<EFBFBD>ϥ<EFBFBD><CFA5>q<EFBFBD>{<7B><>iframe title<6C>ܡH'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"<22><><EFBFBD>U<EFBFBD>T<EFBFBD>{<7B><>,<2C>N<EFBFBD>۰ʷs<CAB7>Wiframe<6D><65>title,<2C>Y<EFBFBD><59><EFBFBD>U<EFBFBD>_,<2C>h<EFBFBD>i<EFBFBD>ۦ<EFBFBD><DBA6>]<5D>wtitle<6C>C</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"<22>T<EFBFBD>{": function(){setIframe();$( this ).dialog( "close" );},
"<22><><EFBFBD><EFBFBD>": function() {
$( this ).dialog( "close" );
}
}
});
}else if($(".active > [data-toggle='tab']").attr("href") == ".en"){
alert('please write down iframe title');
i = 1;
$("#"+textID[i]).before("<div id='dialog-confirm' title='Do you want to use default title of the iframes<65>H'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"After click confirm button,title of the iframes will be auto generated.And after click confirm button,you can set up title of the iframes by yourself.</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"confirm": function(){setIframe();$( this ).dialog( "close" );},
"Cancel": function() {
$( this ).dialog( "close" );
}
}
});
};
flag = 0;
}else{
if( k1!= 0){
if($(".active > [data-toggle='tab']").attr("href") == ".zh_tw"){
alert('<27>Х[<5B>Wimg<6D><67>title');
i = 0;
$("#"+textID[i]).before("<div id='dialog-confirm' title='<27>n<EFBFBD>ϥ<EFBFBD><CFA5>q<EFBFBD>{<7B><><EFBFBD>Ϥ<EFBFBD><CFA4><EFBFBD><EFBFBD>D<EFBFBD>M<EFBFBD><4D><EFBFBD>N<EFBFBD><4E><EFBFBD>r<EFBFBD>ܡH'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"<22><><EFBFBD>U<EFBFBD>T<EFBFBD>{<7B><>,<2C>N<EFBFBD>۰ʷs<CAB7>Wimg<6D><67>title<6C>Malt,<2C>Y<EFBFBD><59><EFBFBD>U<EFBFBD>_,<2C>h<EFBFBD>i<EFBFBD>ۦ<EFBFBD><DBA6>]<5D>wtitle<6C>Malt<6C>C</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"<22>T<EFBFBD>{": function(){setImg();$( this ).dialog( "close" );},
"<22><><EFBFBD><EFBFBD>": function() {
$( this ).dialog( "close" );
}
}
});
}else if($(".active > [data-toggle='tab']").attr("href") == ".en"){
alert('please write down img title');
i = 1;
$("#"+textID[i]).before("<div id='dialog-confirm' title='Do you want to use default title and alt of the images<65>H'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"After click confirm button,title and alt of the images will be auto generated."
+"And after click confirm button,you can set up title and alt of the images by yourself.</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"confirm": function(){setImg();$( this ).dialog( "close" );},
"Cancel": function() {
$( this ).dialog( "close" );
}
}
});
};
flag = 0;
}else{
if( k2!= 0){
if($(".active > [data-toggle='tab']").attr("href") == ".zh_tw"){
alert('<27>Х[<5B>Wa<57><61><EFBFBD>Ҫ<EFBFBD>title');
i = 0;
$("#"+textID[i]).before("<div id='dialog-confirm' title='<27>n<EFBFBD>ϥ<EFBFBD><CFA5>q<EFBFBD>{<7B><>a<EFBFBD><61><EFBFBD>Ҽ<EFBFBD><D2BC>D<EFBFBD>ܡH'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"<22><><EFBFBD>U<EFBFBD>T<EFBFBD>{<7B><>,<2C>N<EFBFBD>۰ʷs<CAB7>Wimg<6D><67>title<6C>Malt,<2C>Y<EFBFBD><59><EFBFBD>U<EFBFBD>_,<2C>h<EFBFBD>i<EFBFBD>ۦ<EFBFBD><DBA6>]<5D>wtitle<6C>Malt<6C>C</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"<22>T<EFBFBD>{": function(){setAtitle();$( this ).dialog( "close" );},
"<22><><EFBFBD><EFBFBD>": function() {
$( this ).dialog( "close" );
}
}
});
}else if($(".active > [data-toggle='tab']").attr("href") == ".en"){
alert('please write down title of the a labels');
i = 1;
$("#"+textID[i]).before("<div id='dialog-confirm' title='Do you want to use default title of the a label<65>H'>"+
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>"+
"After click confirm button,title of the a label will be auto generated."
+"And after click confirm button,you can set up title of the a label by yourself.</p>"
+"</div>");
$( "#dialog-confirm" ).dialog({
resizable: false,
height:200,
modal: true,
buttons: {
"confirm": function(){setAtitle();$( this ).dialog( "close" );},
"Cancel": function() {
$( this ).dialog( "close" );
}
}
});
};
flag = 0;
}else{
for(var i=0 ; i< $('.ckeditor').length ; i++){
CKEDITOR.instances[textID[i]].setData($('.fakeArea').eq(i).html()); //<2F>N<EFBFBD>ק粒<D7A7><EFA7B9>data(font-size from px to em)<29><><EFBFBD>^textarea
}
}
}
if(flag != 0)
flag = 1;
};
if(flag == 1)
return true;
else
return false;
};
</script>