|
@@ -27,7 +27,7 @@ function MarkControl(option) {
|
|
//}
|
|
//}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.initContainer = function() {
|
|
|
|
|
|
+MarkControl.prototype.initContainer = function () {
|
|
|
|
|
|
var height = this.option.height;
|
|
var height = this.option.height;
|
|
if (height == undefined) {
|
|
if (height == undefined) {
|
|
@@ -58,13 +58,13 @@ MarkControl.prototype.initContainer = function() {
|
|
this.navNumber = 0;
|
|
this.navNumber = 0;
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.initHeaderAndAssistant = function() {
|
|
|
|
|
|
+MarkControl.prototype.initHeaderAndAssistant = function () {
|
|
var self = this;
|
|
var self = this;
|
|
this.container.header.find('#mark-user-name').html(this.option.userName);
|
|
this.container.header.find('#mark-user-name').html(this.option.userName);
|
|
if (this.option.logoutTitle != undefined) {
|
|
if (this.option.logoutTitle != undefined) {
|
|
this.container.header.find('#logout-title').html(this.option.logoutTitle);
|
|
this.container.header.find('#logout-title').html(this.option.logoutTitle);
|
|
}
|
|
}
|
|
- this.container.header.find('#logout-link').click(function() {
|
|
|
|
|
|
+ this.container.header.find('#logout-link').click(function () {
|
|
self.trigger('logout.link.click');
|
|
self.trigger('logout.link.click');
|
|
return true;
|
|
return true;
|
|
})
|
|
})
|
|
@@ -73,7 +73,7 @@ MarkControl.prototype.initHeaderAndAssistant = function() {
|
|
this.container.assistant.positionSet = false;
|
|
this.container.assistant.positionSet = false;
|
|
this.container.assistantButton = this.container.header.find('#assistant-button');
|
|
this.container.assistantButton = this.container.header.find('#assistant-button');
|
|
|
|
|
|
- this.container.assistantButton.click(this, function(event) {
|
|
|
|
|
|
+ this.container.assistantButton.click(this, function (event) {
|
|
if (self.container.assistant.positionSet == false) {
|
|
if (self.container.assistant.positionSet == false) {
|
|
self.container.assistant.offset({
|
|
self.container.assistant.offset({
|
|
top: self.container.assistantButton.position().top + self.container.assistantButton.height() + 5,
|
|
top: self.container.assistantButton.position().top + self.container.assistantButton.height() + 5,
|
|
@@ -86,7 +86,7 @@ MarkControl.prototype.initHeaderAndAssistant = function() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.initMarkFunction = function() {
|
|
|
|
|
|
+MarkControl.prototype.initMarkFunction = function () {
|
|
var functionList = this.container.assistant.functionList;
|
|
var functionList = this.container.assistant.functionList;
|
|
if (functionList == undefined) {
|
|
if (functionList == undefined) {
|
|
functionList = getDom(this.mark_function_dom, this).appendTo(this.container.assistant).find('#function-list');
|
|
functionList = getDom(this.mark_function_dom, this).appendTo(this.container.assistant).find('#function-list');
|
|
@@ -94,7 +94,7 @@ MarkControl.prototype.initMarkFunction = function() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.initSetting = function(option) {
|
|
|
|
|
|
+MarkControl.prototype.initSetting = function (option) {
|
|
this.userId = option.userId;
|
|
this.userId = option.userId;
|
|
this.settingSyncUrl = option.settingSyncUrl;
|
|
this.settingSyncUrl = option.settingSyncUrl;
|
|
this.settingSyncing = false;
|
|
this.settingSyncing = false;
|
|
@@ -117,7 +117,7 @@ MarkControl.prototype.initSetting = function(option) {
|
|
this.trigger('mark.setting.init', this.setting);
|
|
this.trigger('mark.setting.init', this.setting);
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.localSettingSave = function() {
|
|
|
|
|
|
+MarkControl.prototype.localSettingSave = function () {
|
|
if (this.localStore != undefined) {
|
|
if (this.localStore != undefined) {
|
|
this.localStore.setItem('mark.setting', JSON.stringify({
|
|
this.localStore.setItem('mark.setting', JSON.stringify({
|
|
userId: this.userId,
|
|
userId: this.userId,
|
|
@@ -126,7 +126,7 @@ MarkControl.prototype.localSettingSave = function() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.updateSetting = function(item) {
|
|
|
|
|
|
+MarkControl.prototype.updateSetting = function (item) {
|
|
if (item == undefined) {
|
|
if (item == undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -137,7 +137,7 @@ MarkControl.prototype.updateSetting = function(item) {
|
|
if (this.settingSyncUrl != undefined && this.settingSyncing == false) {
|
|
if (this.settingSyncUrl != undefined && this.settingSyncing == false) {
|
|
this.settingSyncing = true;
|
|
this.settingSyncing = true;
|
|
var self = this;
|
|
var self = this;
|
|
- setTimeout(function() {
|
|
|
|
|
|
+ setTimeout(function () {
|
|
//同步个性化设置
|
|
//同步个性化设置
|
|
$.post(self.settingSyncUrl, {
|
|
$.post(self.settingSyncUrl, {
|
|
setting: JSON.stringify(self.setting)
|
|
setting: JSON.stringify(self.setting)
|
|
@@ -148,8 +148,8 @@ MarkControl.prototype.updateSetting = function(item) {
|
|
}
|
|
}
|
|
|
|
|
|
//增加某个事件的监听方法
|
|
//增加某个事件的监听方法
|
|
-MarkControl.prototype.on = function(eventName, caller, callback, async) {
|
|
|
|
- if (eventName && callback && eventName.length > 0 && typeof(callback) == 'function') {
|
|
|
|
|
|
+MarkControl.prototype.on = function (eventName, caller, callback, async) {
|
|
|
|
+ if (eventName && callback && eventName.length > 0 && typeof (callback) == 'function') {
|
|
if (async) {
|
|
if (async) {
|
|
this.container.bind(eventName, callback);
|
|
this.container.bind(eventName, callback);
|
|
} else {
|
|
} else {
|
|
@@ -165,7 +165,7 @@ MarkControl.prototype.on = function(eventName, caller, callback, async) {
|
|
}
|
|
}
|
|
|
|
|
|
//触发某个事件,并传递事件相关内容
|
|
//触发某个事件,并传递事件相关内容
|
|
-MarkControl.prototype.trigger = function(eventName, eventObject) {
|
|
|
|
|
|
+MarkControl.prototype.trigger = function (eventName, eventObject) {
|
|
var result = true;
|
|
var result = true;
|
|
if (eventName && eventName.length > 0) {
|
|
if (eventName && eventName.length > 0) {
|
|
var array = this.triggers[eventName];
|
|
var array = this.triggers[eventName];
|
|
@@ -183,7 +183,7 @@ MarkControl.prototype.trigger = function(eventName, eventObject) {
|
|
}
|
|
}
|
|
|
|
|
|
//初始化事件监听
|
|
//初始化事件监听
|
|
-MarkControl.prototype.initTriggers = function(option) {
|
|
|
|
|
|
+MarkControl.prototype.initTriggers = function (option) {
|
|
if (this.triggers == undefined) {
|
|
if (this.triggers == undefined) {
|
|
this.triggers = {};
|
|
this.triggers = {};
|
|
}
|
|
}
|
|
@@ -194,7 +194,7 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
|
|
|
|
var self = this;
|
|
var self = this;
|
|
- this.on('view.sidebar.open', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('view.sidebar.open', this, function (event, context, eventObject) {
|
|
this.container.assistant.hide();
|
|
this.container.assistant.hide();
|
|
if (this.container.center.hasClass('span12')) {
|
|
if (this.container.center.hasClass('span12')) {
|
|
this.container.center.removeClass('span12');
|
|
this.container.center.removeClass('span12');
|
|
@@ -205,7 +205,7 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
this.trigger('center.width.change');
|
|
this.trigger('center.width.change');
|
|
});
|
|
});
|
|
- this.on('view.sidebar.close', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('view.sidebar.close', this, function (event, context, eventObject) {
|
|
this.container.assistant.hide();
|
|
this.container.assistant.hide();
|
|
if (this.container.center.hasClass('span7')) {
|
|
if (this.container.center.hasClass('span7')) {
|
|
this.container.center.removeClass('span7');
|
|
this.container.center.removeClass('span7');
|
|
@@ -216,7 +216,7 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
this.trigger('center.width.change');
|
|
this.trigger('center.width.change');
|
|
});
|
|
});
|
|
- this.on('mark.sidebar.open', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('mark.sidebar.open', this, function (event, context, eventObject) {
|
|
this.container.assistant.hide();
|
|
this.container.assistant.hide();
|
|
if (this.container.center.hasClass('span12')) {
|
|
if (this.container.center.hasClass('span12')) {
|
|
this.container.center.removeClass('span12');
|
|
this.container.center.removeClass('span12');
|
|
@@ -227,7 +227,7 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
this.trigger('center.width.change');
|
|
this.trigger('center.width.change');
|
|
});
|
|
});
|
|
- this.on('mark.sidebar.close', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('mark.sidebar.close', this, function (event, context, eventObject) {
|
|
this.container.assistant.hide();
|
|
this.container.assistant.hide();
|
|
if (this.container.center.hasClass('span10')) {
|
|
if (this.container.center.hasClass('span10')) {
|
|
this.container.center.removeClass('span10');
|
|
this.container.center.removeClass('span10');
|
|
@@ -238,68 +238,70 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
this.trigger('center.width.change');
|
|
this.trigger('center.width.change');
|
|
});
|
|
});
|
|
- this.on('task.load.finish', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.load.finish', this, function (event, context, eventObject) {
|
|
if (context.task != undefined) {
|
|
if (context.task != undefined) {
|
|
context.task.spent = new Date().getTime();
|
|
context.task.spent = new Date().getTime();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- this.on('mark.focus.change', this, function(event, context, eventObject) {});
|
|
|
|
- this.on('task.get.finish', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('mark.focus.change', this, function (event, context, eventObject) {
|
|
|
|
+ });
|
|
|
|
+ this.on('task.get.finish', this, function (event, context, eventObject) {
|
|
context.prefetchCallback = undefined;
|
|
context.prefetchCallback = undefined;
|
|
});
|
|
});
|
|
- this.on('task.get.none', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.get.none', this, function (event, context, eventObject) {
|
|
self.getStatus();
|
|
self.getStatus();
|
|
if (context.task == undefined && self.option.clearUrl != undefined) {
|
|
if (context.task == undefined && self.option.clearUrl != undefined) {
|
|
- $.post(self.option.clearUrl, {}, function() {});
|
|
|
|
|
|
+ $.post(self.option.clearUrl, {}, function () {
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- context.prefetchCallback = function() {
|
|
|
|
|
|
+ context.prefetchCallback = function () {
|
|
context.prefetchCallback = undefined;
|
|
context.prefetchCallback = undefined;
|
|
if (self.context.task == undefined && self.context.prefetchTask.length > 0) {
|
|
if (self.context.task == undefined && self.context.prefetchTask.length > 0) {
|
|
self.getTask();
|
|
self.getTask();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- this.on('task.prefetch.success', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.prefetch.success', this, function (event, context, eventObject) {
|
|
if (context.prefetchCallback != undefined) {
|
|
if (context.prefetchCallback != undefined) {
|
|
context.prefetchCallback();
|
|
context.prefetchCallback();
|
|
}
|
|
}
|
|
- setTimeout(function() {
|
|
|
|
|
|
+ setTimeout(function () {
|
|
self.prefetch();
|
|
self.prefetch();
|
|
}, 500);
|
|
}, 500);
|
|
});
|
|
});
|
|
- this.on('task.prefetch.error', this, function(event, context, eventObject) {
|
|
|
|
- setTimeout(function() {
|
|
|
|
|
|
+ this.on('task.prefetch.error', this, function (event, context, eventObject) {
|
|
|
|
+ setTimeout(function () {
|
|
self.prefetch();
|
|
self.prefetch();
|
|
}, 500);
|
|
}, 500);
|
|
});
|
|
});
|
|
- this.on('task.prefetch.none', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.prefetch.none', this, function (event, context, eventObject) {
|
|
if (context.prefetchCallback != undefined) {
|
|
if (context.prefetchCallback != undefined) {
|
|
context.prefetchCallback();
|
|
context.prefetchCallback();
|
|
}
|
|
}
|
|
if (context.isFinish != true) {
|
|
if (context.isFinish != true) {
|
|
- setTimeout(function() {
|
|
|
|
|
|
+ setTimeout(function () {
|
|
self.prefetch();
|
|
self.prefetch();
|
|
}, 1000);
|
|
}, 1000);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- this.on('task.prefetch.finish', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.prefetch.finish', this, function (event, context, eventObject) {
|
|
self.getTask();
|
|
self.getTask();
|
|
});
|
|
});
|
|
- this.on('task.submit.before', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.submit.before', this, function (event, context, eventObject) {
|
|
context.submitting = true;
|
|
context.submitting = true;
|
|
});
|
|
});
|
|
- this.on('history.submit.success', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('history.submit.success', this, function (event, context, eventObject) {
|
|
context.submitting = false;
|
|
context.submitting = false;
|
|
});
|
|
});
|
|
- this.on('task.submit.success', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.submit.success', this, function (event, context, eventObject) {
|
|
context.submitting = false;
|
|
context.submitting = false;
|
|
context.task = undefined;
|
|
context.task = undefined;
|
|
self.getTask();
|
|
self.getTask();
|
|
});
|
|
});
|
|
- this.on('task.submit.error', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.submit.error', this, function (event, context, eventObject) {
|
|
context.submitting = false;
|
|
context.submitting = false;
|
|
});
|
|
});
|
|
- this.on('task.pass.success', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('task.pass.success', this, function (event, context, eventObject) {
|
|
if (context.task != undefined && self.option.clearUrl != undefined) {
|
|
if (context.task != undefined && self.option.clearUrl != undefined) {
|
|
$.post(self.option.clearUrl, {
|
|
$.post(self.option.clearUrl, {
|
|
libraryId: context.task.libraryId
|
|
libraryId: context.task.libraryId
|
|
@@ -308,26 +310,26 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
context.task = undefined;
|
|
context.task = undefined;
|
|
self.getTask();
|
|
self.getTask();
|
|
});
|
|
});
|
|
- this.on('mark.setting.change', this, function(event, context, eventObject) {
|
|
|
|
|
|
+ this.on('mark.setting.change', this, function (event, context, eventObject) {
|
|
self.updateSetting(eventObject);
|
|
self.updateSetting(eventObject);
|
|
});
|
|
});
|
|
- $(document).keypress(this, function(event) {
|
|
|
|
|
|
+ $(document).keypress(this, function (event) {
|
|
if (self.context.listenKeyboard != false) {
|
|
if (self.context.listenKeyboard != false) {
|
|
return self.trigger('key.press', event);
|
|
return self.trigger('key.press', event);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- $(document).keydown(this, function(event) {
|
|
|
|
|
|
+ $(document).keydown(this, function (event) {
|
|
if (self.context.listenKeyboard != false) {
|
|
if (self.context.listenKeyboard != false) {
|
|
return self.trigger('key.down', event);
|
|
return self.trigger('key.down', event);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- $(document).keyup(this, function(event) {
|
|
|
|
|
|
+ $(document).keyup(this, function (event) {
|
|
if (self.context.listenKeyboard != false) {
|
|
if (self.context.listenKeyboard != false) {
|
|
return self.trigger('key.up', event);
|
|
return self.trigger('key.up', event);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- window.onbeforeunload = function(e) {
|
|
|
|
|
|
+ window.onbeforeunload = function (e) {
|
|
if (self.option.clearUrl != undefined) {
|
|
if (self.option.clearUrl != undefined) {
|
|
$.post(self.option.clearUrl);
|
|
$.post(self.option.clearUrl);
|
|
}
|
|
}
|
|
@@ -335,7 +337,7 @@ MarkControl.prototype.initTriggers = function(option) {
|
|
}
|
|
}
|
|
|
|
|
|
//初始化功能模块
|
|
//初始化功能模块
|
|
-MarkControl.prototype.initModules = function(option) {
|
|
|
|
|
|
+MarkControl.prototype.initModules = function (option) {
|
|
if (this.modules == undefined) {
|
|
if (this.modules == undefined) {
|
|
this.modules = {};
|
|
this.modules = {};
|
|
}
|
|
}
|
|
@@ -361,18 +363,18 @@ MarkControl.prototype.initModules = function(option) {
|
|
}
|
|
}
|
|
|
|
|
|
//指定初始化某个名称的模块
|
|
//指定初始化某个名称的模块
|
|
-MarkControl.prototype.initModule = function(names, options, success) {
|
|
|
|
|
|
+MarkControl.prototype.initModule = function (names, options, success) {
|
|
for (var i in names) {
|
|
for (var i in names) {
|
|
var name = names[i];
|
|
var name = names[i];
|
|
var option = options[name];
|
|
var option = options[name];
|
|
var moduleInit = name.replace(/-/g, '_');
|
|
var moduleInit = name.replace(/-/g, '_');
|
|
- if (option == undefined || typeof(option) != 'object') {
|
|
|
|
|
|
+ if (option == undefined || typeof (option) != 'object') {
|
|
option = {};
|
|
option = {};
|
|
}
|
|
}
|
|
option.markControl = this;
|
|
option.markControl = this;
|
|
eval('this.modules[name]=' + moduleInit + '(option, function(){})');
|
|
eval('this.modules[name]=' + moduleInit + '(option, function(){})');
|
|
}
|
|
}
|
|
- if (success != undefined && typeof(success) == 'function') {
|
|
|
|
|
|
+ if (success != undefined && typeof (success) == 'function') {
|
|
success();
|
|
success();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -385,12 +387,12 @@ function initModuleAsync(markControl, names, index, option) {
|
|
var moduleInit = name.replace(/-/g, '_');
|
|
var moduleInit = name.replace(/-/g, '_');
|
|
var modules = markControl.modules;
|
|
var modules = markControl.modules;
|
|
if (modules[name] == undefined) {
|
|
if (modules[name] == undefined) {
|
|
- if (typeof(moduleOption) != 'object') {
|
|
|
|
|
|
+ if (typeof (moduleOption) != 'object') {
|
|
moduleOption = {};
|
|
moduleOption = {};
|
|
}
|
|
}
|
|
moduleOption.markControl = markControl;
|
|
moduleOption.markControl = markControl;
|
|
- $.getScript(moduleUrl, function() {
|
|
|
|
- var success = function() {
|
|
|
|
|
|
+ $.getScript(moduleUrl, function () {
|
|
|
|
+ var success = function () {
|
|
initModule(markControl, names, index + 1, option);
|
|
initModule(markControl, names, index + 1, option);
|
|
}
|
|
}
|
|
eval('modules[name]=' + moduleInit + '(moduleOption, success)');
|
|
eval('modules[name]=' + moduleInit + '(moduleOption, success)');
|
|
@@ -399,27 +401,27 @@ function initModuleAsync(markControl, names, index, option) {
|
|
initModule(markControl, names, index + 1, option);
|
|
initModule(markControl, names, index + 1, option);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if (markControl.option.success != undefined && typeof(markControl.option.success) == 'function') {
|
|
|
|
|
|
+ if (markControl.option.success != undefined && typeof (markControl.option.success) == 'function') {
|
|
markControl.option.success();
|
|
markControl.option.success();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.start = function(taskOption) {
|
|
|
|
|
|
+MarkControl.prototype.start = function (taskOption) {
|
|
taskOption.markControl = this;
|
|
taskOption.markControl = this;
|
|
var markControl = this;
|
|
var markControl = this;
|
|
- taskOption.success = function() {
|
|
|
|
- markControl.context.prefetchCallback = function() {
|
|
|
|
|
|
+ taskOption.success = function () {
|
|
|
|
+ markControl.context.prefetchCallback = function () {
|
|
markControl.context.prefetchCallback = undefined;
|
|
markControl.context.prefetchCallback = undefined;
|
|
markControl.getTask();
|
|
markControl.getTask();
|
|
}
|
|
}
|
|
- markControl.context.statusCallback = function() {
|
|
|
|
|
|
+ markControl.context.statusCallback = function () {
|
|
markControl.context.statusCallback = undefined;
|
|
markControl.context.statusCallback = undefined;
|
|
markControl.prefetch();
|
|
markControl.prefetch();
|
|
}
|
|
}
|
|
markControl.getStatus();
|
|
markControl.getStatus();
|
|
};
|
|
};
|
|
- taskOption.error = function(message) {
|
|
|
|
|
|
+ taskOption.error = function (message) {
|
|
alert(getMessage(mark.control.init.error));
|
|
alert(getMessage(mark.control.init.error));
|
|
};
|
|
};
|
|
this.taskControl = new TaskControl(taskOption);
|
|
this.taskControl = new TaskControl(taskOption);
|
|
@@ -427,7 +429,7 @@ MarkControl.prototype.start = function(taskOption) {
|
|
}
|
|
}
|
|
|
|
|
|
//task预加载
|
|
//task预加载
|
|
-MarkControl.prototype.prefetch = function() {
|
|
|
|
|
|
+MarkControl.prototype.prefetch = function () {
|
|
var taskControl = this.taskControl;
|
|
var taskControl = this.taskControl;
|
|
var markControl = this;
|
|
var markControl = this;
|
|
var context = this.context;
|
|
var context = this.context;
|
|
@@ -442,9 +444,9 @@ MarkControl.prototype.prefetch = function() {
|
|
context.prefetching = true;
|
|
context.prefetching = true;
|
|
markControl.trigger('task.prefetch.before');
|
|
markControl.trigger('task.prefetch.before');
|
|
|
|
|
|
- taskControl.fetch(function(task) {
|
|
|
|
|
|
+ taskControl.fetch(function (task) {
|
|
if (imageBuilder != undefined) {
|
|
if (imageBuilder != undefined) {
|
|
- imageBuilder.build(task, function(error) {
|
|
|
|
|
|
+ imageBuilder.build(task, function (error) {
|
|
if (error) {
|
|
if (error) {
|
|
context.prefetching = false;
|
|
context.prefetching = false;
|
|
markControl.trigger('task.prefetch.error');
|
|
markControl.trigger('task.prefetch.error');
|
|
@@ -461,11 +463,11 @@ MarkControl.prototype.prefetch = function() {
|
|
context.prefetching = false;
|
|
context.prefetching = false;
|
|
markControl.trigger('task.prefetch.success');
|
|
markControl.trigger('task.prefetch.success');
|
|
}
|
|
}
|
|
- }, function(task) {
|
|
|
|
- context.prefetchStatus = task.message ==null ?null:getMessage(task.message);
|
|
|
|
|
|
+ }, function (task) {
|
|
|
|
+ context.prefetchStatus = task.message == null ? null : getMessage(task.message);
|
|
context.prefetching = false;
|
|
context.prefetching = false;
|
|
markControl.trigger('task.prefetch.none');
|
|
markControl.trigger('task.prefetch.none');
|
|
- }, function() {
|
|
|
|
|
|
+ }, function () {
|
|
context.prefetching = false;
|
|
context.prefetching = false;
|
|
markControl.trigger('task.prefetch.none');
|
|
markControl.trigger('task.prefetch.none');
|
|
});
|
|
});
|
|
@@ -475,12 +477,12 @@ MarkControl.prototype.prefetch = function() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.getStatus = function() {
|
|
|
|
|
|
+MarkControl.prototype.getStatus = function () {
|
|
if (this.taskControl == undefined) {
|
|
if (this.taskControl == undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var self = this;
|
|
var self = this;
|
|
- this.taskControl.status(function(status) {
|
|
|
|
|
|
+ this.taskControl.status(function (status) {
|
|
self.context.status = status;
|
|
self.context.status = status;
|
|
if (status != undefined) {
|
|
if (status != undefined) {
|
|
self.context.isFinish = status.blockTotalCount > 0 && status.blockTotalCount == (status.blockMarkedCount + status.blockExceptionCount);
|
|
self.context.isFinish = status.blockTotalCount > 0 && status.blockTotalCount == (status.blockMarkedCount + status.blockExceptionCount);
|
|
@@ -492,7 +494,7 @@ MarkControl.prototype.getStatus = function() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.getTask = function() {
|
|
|
|
|
|
+MarkControl.prototype.getTask = function () {
|
|
if (this.taskControl == undefined) {
|
|
if (this.taskControl == undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -523,20 +525,20 @@ MarkControl.prototype.getTask = function() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.getHistory = function(data) {
|
|
|
|
|
|
+MarkControl.prototype.getHistory = function (data) {
|
|
if (this.taskControl == undefined) {
|
|
if (this.taskControl == undefined) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.taskControl.history(data, function(result) {
|
|
|
|
|
|
+ this.taskControl.history(data, function (result) {
|
|
data.result = result;
|
|
data.result = result;
|
|
this.option.markControl.trigger('history.get.success', data);
|
|
this.option.markControl.trigger('history.get.success', data);
|
|
- }, function(message) {
|
|
|
|
|
|
+ }, function (message) {
|
|
data.message = message;
|
|
data.message = message;
|
|
this.option.markControl.trigger('history.get.error', data);
|
|
this.option.markControl.trigger('history.get.error', data);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.setTask = function(task) {
|
|
|
|
|
|
+MarkControl.prototype.setTask = function (task) {
|
|
var imageBuilder = this.modules['image-builder'];
|
|
var imageBuilder = this.modules['image-builder'];
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
@@ -545,7 +547,7 @@ MarkControl.prototype.setTask = function(task) {
|
|
}
|
|
}
|
|
this.trigger('task.get.before');
|
|
this.trigger('task.get.before');
|
|
if (imageBuilder != undefined && task != undefined) {
|
|
if (imageBuilder != undefined && task != undefined) {
|
|
- imageBuilder.build(task, function(error) {
|
|
|
|
|
|
+ imageBuilder.build(task, function (error) {
|
|
self.context.task = task;
|
|
self.context.task = task;
|
|
self.trigger('task.get.success');
|
|
self.trigger('task.get.success');
|
|
});
|
|
});
|
|
@@ -557,14 +559,14 @@ MarkControl.prototype.setTask = function(task) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-MarkControl.prototype.submitTask = function(submitUrl) {
|
|
|
|
|
|
+MarkControl.prototype.submitTask = function (submitUrl) {
|
|
var task = this.context.task;
|
|
var task = this.context.task;
|
|
var markControl = this;
|
|
var markControl = this;
|
|
var submitUrl = submitUrl != undefined && submitUrl.length > 0 ? submitUrl : this.option.submitUrl;
|
|
var submitUrl = submitUrl != undefined && submitUrl.length > 0 ? submitUrl : this.option.submitUrl;
|
|
|
|
|
|
if (task != undefined && this.context.submitting != true) {
|
|
if (task != undefined && this.context.submitting != true) {
|
|
//开启强制标记
|
|
//开启强制标记
|
|
- if (this.option.forceSpecialTag === true && task.problem!=true) {
|
|
|
|
|
|
+ if (this.option.forceSpecialTag === true && task.problem != true) {
|
|
if (task.tagList == undefined || task.tagList == null || task.tagList.length <= 0) {
|
|
if (task.tagList == undefined || task.tagList == null || task.tagList.length <= 0) {
|
|
markControl.trigger('task.submit.forceSpecialTag');
|
|
markControl.trigger('task.submit.forceSpecialTag');
|
|
return;
|
|
return;
|
|
@@ -580,15 +582,15 @@ MarkControl.prototype.submitTask = function(submitUrl) {
|
|
trackList: [],
|
|
trackList: [],
|
|
tagList: task.tagList,
|
|
tagList: task.tagList,
|
|
spent: new Date().getTime() - task.spent,
|
|
spent: new Date().getTime() - task.spent,
|
|
- problem : task.problem,
|
|
|
|
- reason : task.reason
|
|
|
|
|
|
+ problem: task.problem,
|
|
|
|
+ reason: task.reason
|
|
}
|
|
}
|
|
|
|
|
|
this.trigger('task.submit.before');
|
|
this.trigger('task.submit.before');
|
|
|
|
|
|
if (this.taskControl != undefined) {
|
|
if (this.taskControl != undefined) {
|
|
//已定义任务引擎
|
|
//已定义任务引擎
|
|
- this.taskControl.submit(submitObj, function(status) {
|
|
|
|
|
|
+ this.taskControl.submit(submitObj, function (status) {
|
|
if (status != undefined && status.valid == true) {
|
|
if (status != undefined && status.valid == true) {
|
|
markControl.context.status = status;
|
|
markControl.context.status = status;
|
|
markControl.trigger('mark.status.change', status);
|
|
markControl.trigger('mark.status.change', status);
|
|
@@ -598,8 +600,8 @@ MarkControl.prototype.submitTask = function(submitUrl) {
|
|
} else {
|
|
} else {
|
|
markControl.trigger('task.submit.success');
|
|
markControl.trigger('task.submit.success');
|
|
}
|
|
}
|
|
- }, function(message) {
|
|
|
|
- markControl.trigger('task.submit.error', getMessage('mark.control.tsak.error'));
|
|
|
|
|
|
+ }, function (message) {
|
|
|
|
+ markControl.trigger('task.submit.error', getMessage('mark.control.task.error'));
|
|
});
|
|
});
|
|
} else if (submitUrl != undefined && submitUrl.length > 0) {
|
|
} else if (submitUrl != undefined && submitUrl.length > 0) {
|
|
//未定义任务引擎,依赖定义/传入的提交地址
|
|
//未定义任务引擎,依赖定义/传入的提交地址
|
|
@@ -609,15 +611,15 @@ MarkControl.prototype.submitTask = function(submitUrl) {
|
|
data: JSON.stringify(submitObj),
|
|
data: JSON.stringify(submitObj),
|
|
dataType: "json",
|
|
dataType: "json",
|
|
contentType: 'application/json;charset=utf-8',
|
|
contentType: 'application/json;charset=utf-8',
|
|
- success: function(result) {
|
|
|
|
|
|
+ success: function (result) {
|
|
if (result.success == true) {
|
|
if (result.success == true) {
|
|
markControl.trigger('task.submit.success');
|
|
markControl.trigger('task.submit.success');
|
|
} else {
|
|
} else {
|
|
markControl.trigger('task.submit.error', getMessage(result.message));
|
|
markControl.trigger('task.submit.error', getMessage(result.message));
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- error: function(message) {
|
|
|
|
- markControl.trigger('task.submit.error', getMessage('mark.control.tsak.error'));
|
|
|
|
|
|
+ error: function (message) {
|
|
|
|
+ markControl.trigger('task.submit.error', getMessage('mark.control.task.error'));
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
@@ -625,13 +627,13 @@ MarkControl.prototype.submitTask = function(submitUrl) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-MarkControl.prototype.addNavGroup = function(title, content) {
|
|
|
|
|
|
+MarkControl.prototype.addNavGroup = function (title, content) {
|
|
var self = this;
|
|
var self = this;
|
|
self.navNumber++;
|
|
self.navNumber++;
|
|
var nav = $('<a href="#"><span>' + title + '</span></a>').appendTo(self.container.centerNavbar);
|
|
var nav = $('<a href="#"><span>' + title + '</span></a>').appendTo(self.container.centerNavbar);
|
|
nav.attr('data-number', self.navNumber);
|
|
nav.attr('data-number', self.navNumber);
|
|
content.attr('data-number', self.navNumber);
|
|
content.attr('data-number', self.navNumber);
|
|
- nav.click(function() {
|
|
|
|
|
|
+ nav.click(function () {
|
|
self.container.centerNavbar.find('a').removeClass('selected');
|
|
self.container.centerNavbar.find('a').removeClass('selected');
|
|
$(this).addClass('selected');
|
|
$(this).addClass('selected');
|
|
|
|
|
|
@@ -679,15 +681,15 @@ MarkControl.prototype.mark_function_dom = '<h3 class="popover-title" data-i18n-t
|
|
</p></div>';
|
|
</p></div>';
|
|
|
|
|
|
//其他通用方法
|
|
//其他通用方法
|
|
-String.prototype.startWith = function(prefix) {
|
|
|
|
|
|
+String.prototype.startWith = function (prefix) {
|
|
return this.indexOf(prefix) === 0;
|
|
return this.indexOf(prefix) === 0;
|
|
}
|
|
}
|
|
-String.prototype.endWith = function(suffix) {
|
|
|
|
|
|
+String.prototype.endWith = function (suffix) {
|
|
return this.match(suffix + "$") == suffix;
|
|
return this.match(suffix + "$") == suffix;
|
|
};
|
|
};
|
|
|
|
|
|
//日期格式化
|
|
//日期格式化
|
|
-Date.prototype.format = function(fmt) { //author: meizz
|
|
|
|
|
|
+Date.prototype.format = function (fmt) { //author: meizz
|
|
var o = {
|
|
var o = {
|
|
"M+": this.getMonth() + 1, //月份
|
|
"M+": this.getMonth() + 1, //月份
|
|
"d+": this.getDate(), //日
|
|
"d+": this.getDate(), //日
|
|
@@ -720,27 +722,27 @@ function getDom(content, markControl) {
|
|
content = content.replace(/{logoutUrl}/g, markControl.option.logoutUrl);
|
|
content = content.replace(/{logoutUrl}/g, markControl.option.logoutUrl);
|
|
}
|
|
}
|
|
var result = $(content);
|
|
var result = $(content);
|
|
- result.each(function() {
|
|
|
|
- if($(this).data("i18n-value")!=undefined){
|
|
|
|
- $(this).val($.i18n.prop($(this).data("i18n-value")));
|
|
|
|
- }
|
|
|
|
- if($(this).data("i18n-text")!=undefined){
|
|
|
|
- $(this).text($.i18n.prop($(this).data("i18n-text")));
|
|
|
|
- }
|
|
|
|
- if($(this).data("i18n-placeholder")!=undefined){
|
|
|
|
- $(this).attr('placeholder',$.i18n.prop($(this).data("i18n-placeholder")));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $(this).find("[data-i18n-value]").each(function() {
|
|
|
|
- $(this).val($.i18n.prop($(this).data("i18n-value")));
|
|
|
|
- });
|
|
|
|
- $(this).find("[data-i18n-text]").each(function() {
|
|
|
|
- $(this).text($.i18n.prop($(this).data("i18n-text")));
|
|
|
|
- });
|
|
|
|
- $(this).find("[data-i18n-placeholder]").each(function() {
|
|
|
|
- $(this).attr('placeholder',$.i18n.prop($(this).data("i18n-placeholder")));
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ result.each(function () {
|
|
|
|
+ if ($(this).data("i18n-value") != undefined) {
|
|
|
|
+ $(this).val($.i18n.prop($(this).data("i18n-value")));
|
|
|
|
+ }
|
|
|
|
+ if ($(this).data("i18n-text") != undefined) {
|
|
|
|
+ $(this).text($.i18n.prop($(this).data("i18n-text")));
|
|
|
|
+ }
|
|
|
|
+ if ($(this).data("i18n-placeholder") != undefined) {
|
|
|
|
+ $(this).attr('placeholder', $.i18n.prop($(this).data("i18n-placeholder")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $(this).find("[data-i18n-value]").each(function () {
|
|
|
|
+ $(this).val($.i18n.prop($(this).data("i18n-value")));
|
|
|
|
+ });
|
|
|
|
+ $(this).find("[data-i18n-text]").each(function () {
|
|
|
|
+ $(this).text($.i18n.prop($(this).data("i18n-text")));
|
|
|
|
+ });
|
|
|
|
+ $(this).find("[data-i18n-placeholder]").each(function () {
|
|
|
|
+ $(this).attr('placeholder', $.i18n.prop($(this).data("i18n-placeholder")));
|
|
|
|
+ });
|
|
|
|
+ });
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -748,6 +750,6 @@ function isArray(obj) {
|
|
return obj != undefined && Object.prototype.toString.call(obj) === '[object Array]';
|
|
return obj != undefined && Object.prototype.toString.call(obj) === '[object Array]';
|
|
}
|
|
}
|
|
|
|
|
|
-function getMessage(message) {
|
|
|
|
- return $.i18n.prop(message);
|
|
|
|
|
|
+function getMessage(message) {
|
|
|
|
+ return $.i18n.prop(message);
|
|
}
|
|
}
|