modify online reader

This commit is contained in:
kekee000 2014-12-25 20:00:46 +08:00
parent 60a544956f
commit b91d463fa3

View File

@ -1,7 +1,7 @@
/**
* @file setting-unicode.js
* @author mengke01
* @date
* @date
* @description
* 在线字体列表
*/
@ -12,19 +12,19 @@ define(
var onlineList = require('../data/online-font');
return require('./setting').derive({
title: '在线字体',
nofooter: true,
getTpl: function() {
var str = '<div class="list-group">';
onlineList.forEach(function(item, index) {
str += '<a href="'+ item.url +'" class="list-group-item">'
str += '<a data-url="'+ item.url +'" href="'+ item.url +'" class="list-group-item">'
+ '<span class="from">'+ string.encodeHTML(item.from) +'</span>'
+ (index + 1) + '. '
+ string.encodeHTML(item.name)
+ string.encodeHTML(item.name)
+ '</a>';
});
str += '</div>';
@ -34,11 +34,11 @@ define(
set: function() {
var me = this;
var dialog = this.getDialog();
dialog.find('.list-group').delegate('.list-group-item', 'click', function(e) {
dialog.find('.list-group').on('click', '.list-group-item', function(e) {
e.preventDefault();
e.stopPropagation();
var url = this.href;
dialog.find('.list-group').off('[data-url]', 'click').remove();
var url = $(this).attr('data-url');
dialog.find('.list-group').off('click', '.list-group-item').remove();
me.options.onChange && me.options.onChange.call(this, decodeURIComponent(url));
$('#model-dialog').modal('hide');
});