mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-24 07:32:22 +03:00
1 line
No EOL
4.1 KiB
JavaScript
1 line
No EOL
4.1 KiB
JavaScript
!function(e){"use strict";var t={rows:8,columns:8,styler:"table"};e.extend(!0,e.trumbowyg,{langs:{en:{table:"Insert table",tableAddRow:"Add row",tableAddColumn:"Add column",tableDeleteRow:"Delete row",tableDeleteColumn:"Delete column",tableDestroy:"Delete table",error:"Error"},de:{table:"Tabelle einfügen",tableAddRow:"Zeile hinzufügen",tableAddColumn:"Spalte hinzufügen",tableDeleteRow:"Zeile löschen",tableDeleteColumn:"Spalte löschen",tableDestroy:"Tabelle löschen",error:"Error"},sk:{table:"Vytvoriť tabuľky",tableAddRow:"Pridať riadok",tableAddColumn:"Pridať stĺpec",error:"Chyba"},fr:{table:"Insérer un tableau",tableAddRow:"Ajouter des lignes",tableAddColumn:"Ajouter des colonnes",error:"Erreur"},cs:{table:"Vytvořit příkaz Table",tableAddRow:"Přidat řádek",tableAddColumn:"Přidat sloupec",error:"Chyba"},ru:{table:"Вставить таблицу",tableAddRow:"Добавить строки",tableAddColumn:"Добавить столбцы",error:"Ошибка"},ja:{table:"表の挿入",tableAddRow:"行の追加",tableAddColumn:"列の追加",error:"エラー"},tr:{table:"Tablo ekle",tableAddRow:"Satır ekle",tableAddColumn:"Kolon ekle",error:"Hata"}},plugins:{table:{init:function(l){l.o.plugins.table=e.extend(!0,{},t,l.o.plugins.table||{});var a={fn:function(){l.saveRange();var t="table",a=l.o.prefix+"dropdown",d={"class":a+"-"+t+" "+a+" "+l.o.prefix+"fixed-top"};d["data-"+a]=t;var r=e("<div/>",d);if(0===l.$box.find("."+a+"-"+t).length?l.$box.append(r.hide()):r=l.$box.find("."+a+"-"+t),r.html(""),l.$box.find("."+l.o.prefix+"table-button").hasClass(l.o.prefix+"active-button"))r.append(l.buildSubBtn("tableAddRow")),r.append(l.buildSubBtn("tableAddColumn")),r.append(l.buildSubBtn("tableDeleteRow")),r.append(l.buildSubBtn("tableDeleteColumn")),r.append(l.buildSubBtn("tableDestroy"));else{for(var b=e("<table></table>"),i=0;i<l.o.plugins.table.rows;i+=1)for(var s=e("<tr></tr>").appendTo(b),u=0;u<l.o.plugins.table.columns;u+=1)e("<td></td>").appendTo(s);b.find("td").on("mouseover",n),b.find("td").on("mousedown",o),r.append(b),r.append(e("<center>1x1</center>"))}l.dropdown(t)}},n=function(t){var l=e(t.target),a=l.parents("table"),n=this.cellIndex,o=this.parentNode.rowIndex;a.find("td").removeClass("active");for(var d=0;d<=o;d+=1)for(var r=0;r<=n;r+=1)a.find("tr:nth-of-type("+(d+1)+")").find("td:nth-of-type("+(r+1)+")").addClass("active");a.next("center").html(n+1+"x"+(o+1))},o=function(t){l.saveRange();var a=e("<table></table>");l.o.plugins.table.styler&&a.attr("class",l.o.plugins.table.styler);for(var n=(e(t.target),this.cellIndex),o=this.parentNode.rowIndex,d=0;d<=o;d+=1)for(var r=e("<tr></tr>").appendTo(a),b=0;b<=n;b+=1)e("<td></td>").appendTo(r);l.range.deleteContents(),l.range.insertNode(a[0]),l.$c.trigger("tbwchange")},d={title:l.lang.tableAddRow,text:l.lang.tableAddRow,ico:"row-below",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table");if(a.length>0){for(var n=e("<tr></tr>"),o=0;o<a.find("tr")[0].childElementCount;o+=1)e("<td></td>").appendTo(n);n.appendTo(a)}return!0}},r={title:l.lang.tableAddColumn,text:l.lang.tableAddColumn,ico:"col-right",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table");return a.length>0&&e(a).find("tr").each(function(){e(this).find("td:last").after("<td></td>")}),!0}},b={title:l.lang.tableDestroy,text:l.lang.tableDestroy,ico:"table-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table");return a.remove(),!0}},i={title:l.lang.tableDeleteRow,text:l.lang.tableDeleteRow,ico:"row-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("tr");return a.remove(),!0}},s={title:l.lang.tableDeleteColumn,text:l.lang.tableDeleteColumn,ico:"col-delete",fn:function(){l.saveRange();var t=l.doc.getSelection().focusNode,a=e(t).closest("table"),n=e(t).closest("td"),o=n.index();return e(a).find("tr").each(function(){e(this).find("td:eq("+o+")").remove()}),!0}};l.addBtnDef("table",a),l.addBtnDef("tableAddRow",d),l.addBtnDef("tableAddColumn",r),l.addBtnDef("tableDeleteRow",i),l.addBtnDef("tableDeleteColumn",s),l.addBtnDef("tableDestroy",b)}}}})}(jQuery); |