|
@@ -1,77 +0,0 @@
|
|
|
-//多媒体显示模块
|
|
|
-var json_builder = function(option, success) {
|
|
|
- var object = new JsonBuilder(option);
|
|
|
- success();
|
|
|
- return object;
|
|
|
-}
|
|
|
-
|
|
|
-function JsonBuilder(option) {
|
|
|
- this.markControl = option.markControl;
|
|
|
- this.answerServer = option.answerServer;
|
|
|
- this.init();
|
|
|
- this.markControl.on('step.board.show', this, function(event, context, eventObject) {
|
|
|
- this.container.removeClass('span12');
|
|
|
- this.container.addClass('span10');
|
|
|
- });
|
|
|
- this.markControl.on('step.board.hide', this, function(event, context, eventObject) {
|
|
|
- this.container.removeClass('span10');
|
|
|
- this.container.addClass('span12');
|
|
|
- });
|
|
|
- this.markControl.on('task.get.before', this, function(event, context, eventObject) {
|
|
|
- this.task = undefined;
|
|
|
- this.json = undefined;
|
|
|
- });
|
|
|
- this.markControl.on('task.get.success', this, function(event, context, eventObject) {
|
|
|
- this.task = context.task;
|
|
|
- this.json = undefined;
|
|
|
- });
|
|
|
- this.markControl.on('task.get.none', this, function(event, context, eventObject) {
|
|
|
- this.task = undefined;
|
|
|
- this.json = undefined;
|
|
|
- });
|
|
|
- this.markControl.on('image.position.change', this, function(event, context, topPercent) {
|
|
|
- if (this.task != undefined) {
|
|
|
- this.updateScrollTop(topPercent);
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-JsonBuilder.prototype.init = function() {
|
|
|
- var self = this;
|
|
|
- this.container = this.markControl.container.imageContent;
|
|
|
- this.container.height(this.markControl.container.centerContent.height());
|
|
|
- this.container.css('overflow', 'scroll');
|
|
|
-
|
|
|
- this.container = getDom(this.control_dom, this.markControl).appendTo(this.markControl.container);
|
|
|
- this.container.hide();
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-JsonBuilder.prototype.build = function(task,callback) {
|
|
|
- var self = this;
|
|
|
- if (this.task != undefined && this.task.answerUrl != undefined) {
|
|
|
- var url = this.answerServer + this.task.answerUrl;
|
|
|
- $.get(url, function(result) {
|
|
|
-
|
|
|
- self.container.show();
|
|
|
- self.markControl.trigger('task.load.finish');
|
|
|
- }).error(function() {
|
|
|
- callback('image load error');
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-JsonBuilder.prototype.updateScrollTop = function(scrollTopPercent) {
|
|
|
- var height = this.canvas.height;
|
|
|
- var minHeight = this.container.height();
|
|
|
- if (scrollTopPercent != undefined && scrollTopPercent >= 0 && scrollTopPercent <= 1 && height > minHeight) {
|
|
|
- var left = height * (1 - scrollTopPercent);
|
|
|
- var scrollTop = left > minHeight ? (height - left) : (height - minHeight);
|
|
|
- this.container.scrollTop(scrollTop);
|
|
|
- } else {
|
|
|
- this.container.scrollTop(0);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-JsonBuilder.prototype.control_dom = '<div class="wp"><div class="rich-text"></div></div>';
|
|
|
-JsonBuilder.prototype.rich_text_dom = '<div class="rich-text"></div>';
|