/*! * ZUI: 看板 - v1.8.1 - 2018-01-18 * http://zui.sexy * GitHub: https://github.com/easysoft/zui.git * Copyright (c) 2018 cnezsoft.com; Licensed MIT */ /* ======================================================================== * ZUI: boards.js * http://zui.sexy * ======================================================================== * Copyright (c) 2014-2016 cnezsoft.com; Licensed MIT * ======================================================================== */ (function($) { 'use strict'; if(!$.fn.droppable) throw new Error('Droppable requires for boards'); var Boards = function(element, options) { this.$ = $(element); this.options = this.getOptions(options); this.getLang(); this.init(); }; Boards.DEFAULTS = { // lang: null, langs: { 'zh_cn': { append2end: '移动到末尾' }, 'zh_tw': { append2end: '移动到末尾' }, 'en': { append2end: 'Move to the end.' } } }; // default options Boards.prototype.getOptions = function(options) { options = $.extend({lang: $.zui.clientLang()}, Boards.DEFAULTS, this.$.data(), options); return options; }; Boards.prototype.getLang = function() { var options = this.options; this.lang = options.langs[options.lang] || options.langs[Boards.DEFAULTS.lang]; }; Boards.prototype.init = function() { var idSeed = 1; var lang = this.lang; this.$.find('.board-item:not(".disable-drop"), .board:not(".disable-drop")').each(function() { var $this = $(this); if($this.attr('id')) { $this.attr('data-id', $this.attr('id')); } else if(!$this.attr('data-id')) { $this.attr('data-id', 'board' + (idSeed++)); } if($this.hasClass('board')) { $this.find('.board-list').append('