Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1cfb63ca49 | ||
![]() |
41305d25b6 |
@ -1,9 +1,9 @@
|
||||
fonteditor 在线ttf字体编辑器
|
||||
==========
|
||||
|
||||
[线上地址](http://font.baidu.com)
|
||||
[线上地址](http://fontstore.baidu.com/static/editor/index.html)
|
||||
|
||||
[English Version](http://font.baidu.com/editor/index-en.html)
|
||||
[English Version](http://fontstore.baidu.com/static/editor/index-en.html)
|
||||
|
||||
|
||||
### 开发:
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
index.tpl
16
index.tpl
@ -13,7 +13,7 @@
|
||||
<div class="logo"></div>
|
||||
<div class="action-groups btn-groups">
|
||||
|
||||
<button data-action="add-new" type="button" class="btn btn-flat btn-new btn-sm"><i class="ico ico-left i-add"></i>${lang.newglyph}</button>
|
||||
<button data-action="add-new" type="button" class="btn btn-flat btn-new btn-sm WA_LOG_BTN" data-click="add-new-glyf"><i class="ico ico-left i-add"></i>${lang.newglyph}</button>
|
||||
<i class="split"></i>
|
||||
|
||||
<button data-disabled="1" data-action="undo" type="button" class="btn btn-flat btn-ico" title="${lang.undo}"><i class="ico i-undo"></i></button>
|
||||
@ -21,7 +21,7 @@
|
||||
<i class="split"></i>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-flat btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||
<button type="button" class="btn btn-flat btn-sm dropdown-toggle WA_LOG_BTN" data-click="menu-import" data-toggle="dropdown">
|
||||
${lang.import}
|
||||
<span class="ico i-down"></span>
|
||||
</button>
|
||||
@ -36,12 +36,12 @@
|
||||
</div>
|
||||
<i class="split"></i>
|
||||
|
||||
<a data-disabled="1" id="export-btn" href="#" data-action="export" data-type="ttf" class="btn btn-flat btn-ico" title="${lang.export_ttf}"><i class="ico i-ttf"></i></a>
|
||||
<a data-disabled="1" id="export-btn-woff" href="#" data-action="export" data-type="woff" class="btn btn-flat btn-ico" title="${lang.export_woff}"><i class="ico i-woff"></i></a>
|
||||
<a data-disabled="1" id="export-btn-zip" href="#" data-action="export" data-type="zip" class="btn btn-flat btn-ico" title="${lang.export_zip}"><i class="ico i-zip"></i></a>
|
||||
<a data-disabled="1" id="export-btn" href="#" data-action="export" data-type="ttf" class="btn btn-flat btn-ico WA_LOG_BTN" data-click="download-ttf" title="${lang.export_ttf}"><i class="ico i-ttf"></i></a>
|
||||
<a data-disabled="1" id="export-btn-woff" href="#" data-action="export" data-type="woff" class="btn btn-flat btn-ico WA_LOG_BTN" data-click="download-woff" title="${lang.export_woff}"><i class="ico i-woff"></i></a>
|
||||
<a data-disabled="1" id="export-btn-zip" href="#" data-action="export" data-type="zip" class="btn btn-flat btn-ico WA_LOG_BTN" data-click="download-zip" title="${lang.export_zip}"><i class="ico i-zip"></i></a>
|
||||
<i class="split"></i>
|
||||
|
||||
<button data-disabled="1" data-action="save" type="button" class="btn btn-flat btn-sm"><i class="ico ico-left i-save"></i>${lang.save_proj}</button>
|
||||
<button data-disabled="1" data-action="save" type="button" class="btn btn-flat btn-sm"><i class="ico ico-left i-save WA_LOG_BTN" data-click="save-project"></i>${lang.save_proj}</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-flat btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<div class="btn-group">
|
||||
|
||||
<button type="button" class="btn btn-flat btn-preview btn-sm dropdown-toggle" data-toggle="dropdown">
|
||||
<button type="button" class="btn btn-flat btn-preview btn-sm dropdown-toggle WA_LOG_BTN" data-click="preview-btn" data-toggle="dropdown">
|
||||
${lang.preview}
|
||||
<span class="drop ico i-down"></span>
|
||||
</button>
|
||||
@ -100,7 +100,7 @@
|
||||
|
||||
<section class="sidebar">
|
||||
<div class="project-btns action-groups">
|
||||
<button data-action="new" type="button" class="btn btn-flat btn-sm" title="${lang.new_font_title}"><i class="ico ico-left i-new"></i>${lang.new_font}</button><button data-action="open" type="button" class="btn btn-flat btn-sm" title="${lang.open_font_title}"><i class="ico ico-left i-open"></i>${lang.open_font}</button>
|
||||
<button data-action="new" type="button" class="btn btn-flat btn-sm WA_LOG_BTN" data-click="add-new" title="${lang.new_font_title}"><i class="ico ico-left i-new"></i>${lang.new_font}</button><button data-action="open" type="button" class="btn btn-flat btn-sm WA_LOG_BTN" data-click="open" title="${lang.open_font_title}"><i class="ico ico-left i-open"></i>${lang.open_font}</button>
|
||||
</div>
|
||||
<div class="project">
|
||||
<div class="project-title">${lang.project_list}</div>
|
||||
|
@ -198,6 +198,9 @@ define(
|
||||
}, function () {
|
||||
program.loading.show(i18n.lang.msg_save_failed, 400);
|
||||
});
|
||||
require('../log').send({
|
||||
'action': 'create-project:' + name
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
130
src/fonteditor/log.js
Normal file
130
src/fonteditor/log.js
Normal file
@ -0,0 +1,130 @@
|
||||
/**
|
||||
* @file 运营活动类非结果页日志组件
|
||||
* @author sunwei11@baidu.com,
|
||||
* mengke01(kekee000@gmail.com)
|
||||
*/
|
||||
|
||||
/* eslint-disable fecs-camelcase */
|
||||
|
||||
|
||||
define(function (require) {
|
||||
|
||||
/**
|
||||
* 默认的参数配置
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var defaultOptions = {
|
||||
url: 'http://fonteditor.duapp.com/?url=',
|
||||
data: {
|
||||
from: 'font-store' // 标记统计类型
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* log 的fm类型
|
||||
* @type {Object}
|
||||
*/
|
||||
var logFMType = {
|
||||
BTN: 'beha',
|
||||
TAB: 'beha',
|
||||
LINK: 'click'
|
||||
};
|
||||
|
||||
/**
|
||||
* 发送日志请求
|
||||
*
|
||||
* @memberof module:log
|
||||
* @method module:log~send
|
||||
* @param {string} url 日志完整地址
|
||||
* @inner
|
||||
*/
|
||||
|
||||
function send(data) {
|
||||
if (!defaultOptions.url) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = defaultOptions.url + JSON.stringify($.extend({}, defaultOptions.data, data));
|
||||
var img = document.createElement('img');
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
|
||||
var onClick = function (e) {
|
||||
var target = e.target;
|
||||
var logReg = /\bWA_LOG_(BTN|TAB|LINK)\b/;
|
||||
while (target && target !== document) {
|
||||
var match = target.className.match(logReg);
|
||||
if (match) {
|
||||
var data = {
|
||||
fm: logFMType[match[1]] || '-',
|
||||
extra: target.getAttribute('data-click')
|
||||
|| $(target).closest('[data-click]').attr('data-click')
|
||||
|| '-'
|
||||
};
|
||||
|
||||
send(data);
|
||||
break;
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* 配置项
|
||||
*
|
||||
* @see module:log~options
|
||||
* @param {Object} ops 可配置项
|
||||
* @return {module:log} log
|
||||
*/
|
||||
config: function (ops) {
|
||||
$.extend(true, defaultOptions, ops);
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* 开始监听页面点击日志
|
||||
*
|
||||
* @return {module:log} log
|
||||
* @fires module:log#start
|
||||
*/
|
||||
start: function () {
|
||||
document.addEventListener('click', onClick, true);
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* 停止监听页面点击日志
|
||||
*
|
||||
* @return {module:log} log
|
||||
*/
|
||||
stop: function () {
|
||||
document.removeEventListener('click', onClick, true);
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* 手动发送统计请求
|
||||
*
|
||||
* @param {Object} data 要替换的日志参数
|
||||
* @return {Object} this 当前发送的日志参数
|
||||
*/
|
||||
send: function (data) {
|
||||
send(data);
|
||||
return this;
|
||||
},
|
||||
|
||||
init: function () {
|
||||
this.start();
|
||||
|
||||
// 首屏pv
|
||||
this.send({
|
||||
fm: 'pv'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
});
|
@ -5,6 +5,8 @@
|
||||
|
||||
define(
|
||||
function (require) {
|
||||
require('./log').init();
|
||||
|
||||
var i18n = require('./i18n/i18n');
|
||||
var program = require('./widget/program');
|
||||
var controller = require('./controller/default');
|
||||
@ -192,7 +194,6 @@ define(
|
||||
};
|
||||
|
||||
entry.init();
|
||||
|
||||
return entry;
|
||||
}
|
||||
);
|
||||
|
@ -74,7 +74,8 @@ define(
|
||||
var str = '';
|
||||
(projects || []).forEach(function (proj) {
|
||||
str += '<dl data-id="' + proj.id + '">'
|
||||
+ '<dt>' + proj.name + '</dt>'
|
||||
+ '<dt class="WA_LOG_BTN" data-click="project-open:'
|
||||
+ proj.name.replace(/["'\n]/, '_') + '">' + proj.name + '</dt>'
|
||||
+ '<dd>'
|
||||
+ (proj.config && proj.config.sync
|
||||
? ('<span data-action="sync" title="'
|
||||
|
Loading…
x
Reference in New Issue
Block a user