14a14b7e80
This commit might be a little broken, another is coming to fix things up! The topics list is now paginated. Refactored the error handling system. Added the Trumboyg WYSIWYG editor for Cosora. Moved Delete() out of the TopicStore and into *Topic You can now bulk delete and bulk lock topics on Cosora. h1s are now formatted properly on Firefox. Added more ARIA Labels. SuperModOnly is now a piece of middleware for the Control Panel routes. Refactored and extended the router generator. Improved the SEO for the paginators. Added bits of Microdata to improve SEO further. Wrote benchmarks for users.Get() and users.BypassGet() More errors are caught now. You can now attach pcss files to posts. Improved the error logging for JavaScript. Topic list avatars now link to the associated profiles. Added last poster avatars to the forum list.
154 lines
5.6 KiB
JavaScript
154 lines
5.6 KiB
JavaScript
/* ===========================================================
|
|
* trumbowyg.table.js v1.2
|
|
* Table plugin for Trumbowyg
|
|
* http://alex-d.github.com/Trumbowyg
|
|
* ===========================================================
|
|
* Author : Lawrence Meckan
|
|
* Twitter : @absalomedia
|
|
* Website : absalom.biz
|
|
*/
|
|
|
|
(function ($) {
|
|
'use strict';
|
|
|
|
var defaultOptions = {
|
|
rows: 0,
|
|
columns: 0,
|
|
styler: ''
|
|
};
|
|
|
|
$.extend(true, $.trumbowyg, {
|
|
langs: {
|
|
en: {
|
|
table: 'Insert table',
|
|
tableAddRow: 'Add rows',
|
|
tableAddColumn: 'Add columns',
|
|
rows: 'Rows',
|
|
columns: 'Columns',
|
|
styler: 'Table class',
|
|
error: 'Error'
|
|
},
|
|
sk: {
|
|
table: 'Vytvoriť tabuľky',
|
|
tableAddRow: 'Pridať riadok',
|
|
tableAddColumn: 'Pridať stĺpec',
|
|
rows: 'Riadky',
|
|
columns: 'Stĺpce',
|
|
styler: 'Tabuľku triedy',
|
|
error: 'Chyba'
|
|
},
|
|
fr: {
|
|
table: 'Insérer un tableau',
|
|
tableAddRow: 'Ajouter des lignes',
|
|
tableAddColumn: 'Ajouter des colonnes',
|
|
rows: 'Lignes',
|
|
columns: 'Colonnes',
|
|
styler: 'Classes CSS sur la table',
|
|
error: 'Erreur'
|
|
},
|
|
cs: {
|
|
table: 'Vytvořit příkaz Table',
|
|
tableAddRow: 'Přidat řádek',
|
|
tableAddColumn: 'Přidat sloupec',
|
|
rows: 'Řádky',
|
|
columns: 'Sloupce',
|
|
styler: 'Tabulku třída',
|
|
error: 'Chyba'
|
|
},
|
|
ru: {
|
|
table: 'Вставить таблицу',
|
|
tableAddRow: 'Добавить строки',
|
|
tableAddColumn: 'Добавить столбцы',
|
|
rows: 'Строки',
|
|
columns: 'Столбцы',
|
|
styler: 'Имя CSS класса для таблицы',
|
|
error: 'Ошибка'
|
|
},
|
|
ja: {
|
|
table: '表の挿入',
|
|
tableAddRow: '行の追加',
|
|
tableAddColumn: '列の追加',
|
|
rows: '行',
|
|
columns: '列',
|
|
styler: '表のクラス',
|
|
error: 'エラー'
|
|
}
|
|
},
|
|
|
|
plugins: {
|
|
table: {
|
|
init: function (trumbowyg) {
|
|
trumbowyg.o.plugins.table = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.table || {});
|
|
|
|
var tableBuild = {
|
|
fn: function () {
|
|
trumbowyg.saveRange();
|
|
trumbowyg.openModalInsert(
|
|
// Title
|
|
trumbowyg.lang.table,
|
|
|
|
// Fields
|
|
{
|
|
rows: {
|
|
type: 'number',
|
|
required: true
|
|
},
|
|
columns: {
|
|
type: 'number',
|
|
required: true
|
|
},
|
|
styler: {
|
|
label: trumbowyg.lang.styler,
|
|
type: 'text'
|
|
}
|
|
},
|
|
function (v) { // v is value
|
|
var tabler = $('<table></table>');
|
|
if (v.styler.length !== 0) {
|
|
tabler.addClass(v.styler);
|
|
}
|
|
|
|
for (var i = 0; i < v.rows; i += 1) {
|
|
var row = $('<tr></tr>').appendTo(tabler);
|
|
for (var j = 0; j < v.columns; j += 1) {
|
|
$('<td></td>').appendTo(row);
|
|
}
|
|
}
|
|
|
|
trumbowyg.range.deleteContents();
|
|
trumbowyg.range.insertNode(tabler[0]);
|
|
return true;
|
|
});
|
|
}
|
|
};
|
|
|
|
var addRow = {
|
|
fn: function () {
|
|
trumbowyg.saveRange();
|
|
var rower = $('<tr></tr>');
|
|
trumbowyg.range.deleteContents();
|
|
trumbowyg.range.insertNode(rower[0]);
|
|
return true;
|
|
|
|
}
|
|
};
|
|
|
|
var addColumn = {
|
|
fn: function () {
|
|
trumbowyg.saveRange();
|
|
var columner = $('<td></td>');
|
|
trumbowyg.range.deleteContents();
|
|
trumbowyg.range.insertNode(columner[0]);
|
|
return true;
|
|
|
|
}
|
|
};
|
|
|
|
trumbowyg.addBtnDef('table', tableBuild);
|
|
trumbowyg.addBtnDef('tableAddRow', addRow);
|
|
trumbowyg.addBtnDef('tableAddColumn', addColumn);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
})(jQuery); |