Merge pull request #1608 from MITx/feature/jkarni/genex
Feature/jkarni/genex
This commit is contained in:
@@ -974,11 +974,12 @@ class EditAGeneInput(InputTypeBase):
|
||||
@classmethod
|
||||
def get_attributes(cls):
|
||||
"""
|
||||
Note: width, hight, and dna_sequencee are required.
|
||||
"""
|
||||
Note: width, height, and dna_sequencee are required.
|
||||
"""
|
||||
return [Attribute('width'),
|
||||
Attribute('height'),
|
||||
Attribute('dna_sequence')
|
||||
Attribute('dna_sequence'),
|
||||
Attribute('genex_problem_number')
|
||||
]
|
||||
|
||||
def _extra_context(self):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<section id="editageneinput_${id}" class="editageneinput">
|
||||
<section id="editageneinput_${id}" class="editageneinput">
|
||||
<div class="script_placeholder" data-src="/static/js/capa/genex/genex.nocache.js?raw"/>
|
||||
<div class="script_placeholder" data-src="${applet_loader}"/>
|
||||
|
||||
% if status == 'unsubmitted':
|
||||
@@ -8,16 +9,12 @@
|
||||
% elif status == 'incorrect':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
% elif status == 'incomplete':
|
||||
<div class="incorrect" id="status_${id}">
|
||||
<div class="incomplete" id="status_${id}">
|
||||
% endif
|
||||
|
||||
<object type="application/x-java-applet" id="applet_${id}" class="applet" width="${width}" height="${height}">
|
||||
<param name="archive" value="/static/applets/capa/genex.jar" />
|
||||
<param name="code" value="GX.GenexApplet.class" />
|
||||
<param name="DNA_SEQUENCE" value="${dna_sequence}" />
|
||||
Applet failed to run. No Java plug-in was found.
|
||||
</object>
|
||||
|
||||
|
||||
<div id="genex_container"></div>
|
||||
<input type="hidden" name="dna_sequence" id="dna_sequence" value ="${dna_sequence}"></input>
|
||||
<input type="hidden" name="genex_problem_number" id="genex_problem_number" value ="${genex_problem_number}"></input>
|
||||
<input type="hidden" name="input_${id}" id="input_${id}" value="${value|h}"/>
|
||||
|
||||
<p class="status">
|
||||
@@ -37,3 +34,4 @@
|
||||
</div>
|
||||
% endif
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,27 +1,44 @@
|
||||
(function () {
|
||||
var timeout = 1000;
|
||||
|
||||
function initializeApplet(applet) {
|
||||
console.log("Initializing " + applet);
|
||||
waitForApplet(applet);
|
||||
}
|
||||
waitForGenex();
|
||||
|
||||
function waitForApplet(applet) {
|
||||
if (applet.isActive && applet.isActive()) {
|
||||
console.log("Applet is ready.");
|
||||
var answerStr = applet.checkAnswer();
|
||||
console.log(answerStr);
|
||||
var input = $('.editageneinput input');
|
||||
console.log(input);
|
||||
input.val(answerStr);
|
||||
} else if (timeout > 30 * 1000) {
|
||||
console.error("Applet did not load on time.");
|
||||
} else {
|
||||
console.log("Waiting for applet...");
|
||||
setTimeout(function() { waitForApplet(applet); }, timeout);
|
||||
function waitForGenex() {
|
||||
if (typeof(genex) !== "undefined" && genex) {
|
||||
genex.onInjectionDone("genex");
|
||||
}
|
||||
else {
|
||||
setTimeout(function() { waitForGenex(); }, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
var applets = $('.editageneinput object');
|
||||
applets.each(function(i, el) { initializeApplet(el); });
|
||||
//NOTE:
|
||||
// Genex uses six global functions:
|
||||
// genexSetDNASequence (exported from GWT)
|
||||
// genexSetClickEvent (exported from GWT)
|
||||
// genexSetKeyEvent (exported from GWT)
|
||||
// genexSetProblemNumber (exported from GWT)
|
||||
//
|
||||
// It calls genexIsReady with a deferred command when it has finished
|
||||
// initialization and has drawn itself
|
||||
// genexStoreAnswer(answer) is called when the GWT [Store Answer] button
|
||||
// is clicked
|
||||
|
||||
genexIsReady = function() {
|
||||
//Load DNA sequence
|
||||
var dna_sequence = $('#dna_sequence').val();
|
||||
genexSetDNASequence(dna_sequence);
|
||||
//Now load mouse and keyboard handlers
|
||||
genexSetClickEvent();
|
||||
genexSetKeyEvent();
|
||||
//Now load problem
|
||||
var genex_problem_number = $('#genex_problem_number').val();
|
||||
genexSetProblemNumber(genex_problem_number);
|
||||
};
|
||||
genexStoreAnswer = function(ans) {
|
||||
var problem = $('#genex_container').parents('.problem');
|
||||
var input_field = problem.find('input[type="hidden"][name!="dna_sequence"][name!="genex_problem_number"]');
|
||||
input_field.val(ans);
|
||||
};
|
||||
}).call(this);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
BIN
common/static/js/capa/genex/clear.cache.gif
Normal file
BIN
common/static/js/capa/genex/clear.cache.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
122
common/static/js/capa/genex/genex.css
Normal file
122
common/static/js/capa/genex/genex.css
Normal file
@@ -0,0 +1,122 @@
|
||||
.genex-button {
|
||||
margin-right: -8px;
|
||||
height: 40px !important;
|
||||
}
|
||||
|
||||
.genex-label {
|
||||
/*font: normal normal normal 10pt/normal 'Open Sans', Verdana, Geneva, sans-serif !important;*/
|
||||
/*padding: 4px 0px 0px 10px !important;*/
|
||||
font-family: sans-serif !important;
|
||||
font-size: 13px !important;
|
||||
font-style: normal !important;
|
||||
font-variant: normal !important;
|
||||
font-weight: bold !important;
|
||||
padding-top: 6px !important;
|
||||
margin-left: 18px;
|
||||
}
|
||||
|
||||
.gwt-HTML {
|
||||
cursor: default;
|
||||
overflow-x: auto !important;
|
||||
overflow-y: auto !important;
|
||||
background-color: rgb(248, 248, 248) !important;
|
||||
}
|
||||
|
||||
.genex-scrollpanel {
|
||||
word-wrap: normal !important;
|
||||
white-space: pre !important;
|
||||
}
|
||||
|
||||
pre, #dna-strand {
|
||||
font-family: 'courier new', courier !important;
|
||||
font-size: 13px !important;
|
||||
font-style: normal !important;
|
||||
font-variant: normal !important;
|
||||
font-weight: normal !important;
|
||||
border-style: none !important;
|
||||
background-color: rgb(248, 248, 248) !important;
|
||||
word-wrap: normal !important;
|
||||
white-space: pre !important;
|
||||
overflow-x: visible !important;
|
||||
overflow-y: visible !important;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .Caption {
|
||||
background: #F1F1F1;
|
||||
padding: 4px 8px 4px 4px;
|
||||
cursor: default;
|
||||
font-family: Arial Unicode MS, Arial, sans-serif;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid #bbbbbb;
|
||||
border-top: 1px solid #D2D2D2;
|
||||
}
|
||||
.gwt-DialogBox .dialogContent {
|
||||
}
|
||||
.gwt-DialogBox .dialogMiddleCenter {
|
||||
padding: 3px;
|
||||
background: white;
|
||||
}
|
||||
.gwt-DialogBox .dialogBottomCenter {
|
||||
background: url(images/hborder.png) repeat-x 0px -2945px;
|
||||
-background: url(images/hborder_ie6.png) repeat-x 0px -2144px;
|
||||
}
|
||||
.gwt-DialogBox .dialogMiddleLeft {
|
||||
background: url(images/vborder.png) repeat-y -31px 0px;
|
||||
}
|
||||
.gwt-DialogBox .dialogMiddleRight {
|
||||
background: url(images/vborder.png) repeat-y -32px 0px;
|
||||
-background: url(images/vborder_ie6.png) repeat-y -32px 0px;
|
||||
}
|
||||
.gwt-DialogBox .dialogTopLeftInner {
|
||||
width: 10px;
|
||||
height: 8px;
|
||||
zoom: 1;
|
||||
}
|
||||
.gwt-DialogBox .dialogTopRightInner {
|
||||
width: 12px;
|
||||
zoom: 1;
|
||||
}
|
||||
.gwt-DialogBox .dialogBottomLeftInner {
|
||||
width: 10px;
|
||||
height: 12px;
|
||||
zoom: 1;
|
||||
}
|
||||
.gwt-DialogBox .dialogBottomRightInner {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
zoom: 1;
|
||||
}
|
||||
.gwt-DialogBox .dialogTopLeft {
|
||||
background: url(images/circles.png) no-repeat -20px 0px;
|
||||
-background: url(images/circles_ie6.png) no-repeat -20px 0px;
|
||||
}
|
||||
.gwt-DialogBox .dialogTopRight {
|
||||
background: url(images/circles.png) no-repeat -28px 0px;
|
||||
-background: url(images/circles_ie6.png) no-repeat -28px 0px;
|
||||
}
|
||||
.gwt-DialogBox .dialogBottomLeft {
|
||||
background: url(images/circles.png) no-repeat 0px -36px;
|
||||
-background: url(images/circles_ie6.png) no-repeat 0px -36px;
|
||||
}
|
||||
.gwt-DialogBox .dialogBottomRight {
|
||||
background: url(images/circles.png) no-repeat -8px -36px;
|
||||
-background: url(images/circles_ie6.png) no-repeat -8px -36px;
|
||||
}
|
||||
* html .gwt-DialogBox .dialogTopLeftInner {
|
||||
width: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
* html .gwt-DialogBox .dialogTopRightInner {
|
||||
width: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
* html .gwt-DialogBox .dialogBottomLeftInner {
|
||||
width: 10px;
|
||||
height: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
* html .gwt-DialogBox .dialogBottomRightInner {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
18
common/static/js/capa/genex/genex.nocache.js
Normal file
18
common/static/js/capa/genex/genex.nocache.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function genex(){var P='',xb='" for "gwt:onLoadErrorFn"',vb='" for "gwt:onPropertyErrorFn"',ib='"><\/script>',Z='#',Xb='.cache.html',_='/',lb='//',Qb='026A6180B5959B8660E084245FEE5E9E',Rb='1F433010E1134C95BF6CB43F552F3019',Sb='2DDA730EDABB80B88A6B0DFA3AFEACA2',Tb='4EEB1DCF4B30D366C27968D1B5C0BD04',Ub='5033ABB047340FB9346B622E2CC7107D',Wb=':',pb='::',dc='<script defer="defer">genex.onInjectionDone(\'genex\')<\/script>',hb='<script id="',sb='=',$='?',ub='Bad handler "',Vb='DF3D3A7FAEE63D711CF2D95BDB3F538C',cc='DOMContentLoaded',jb='SCRIPT',gb='__gwt_marker_genex',kb='base',cb='baseUrl',T='begin',S='bootstrap',bb='clear.cache.gif',rb='content',Y='end',Kb='gecko',Lb='gecko1_8',Q='genex',Yb='genex.css',eb='genex.nocache.js',ob='genex::',U='gwt.codesvr=',V='gwt.hosted=',W='gwt.hybrid',wb='gwt:onLoadErrorFn',tb='gwt:onPropertyErrorFn',qb='gwt:property',bc='head',Ob='hosted.html?genex',ac='href',Jb='ie6',Ib='ie8',Hb='ie9',yb='iframe',ab='img',zb="javascript:''",Zb='link',Nb='loadExternalRefs',mb='meta',Bb='moduleRequested',X='moduleStartup',Gb='msie',nb='name',Db='opera',Ab='position:absolute;width:0;height:0;border:none',$b='rel',Fb='safari',db='script',Pb='selectingPermutation',R='startup',_b='stylesheet',fb='undefined',Mb='unknown',Cb='user.agent',Eb='webkit';var m=window,n=document,o=m.__gwtStatsEvent?function(a){return m.__gwtStatsEvent(a)}:null,p=m.__gwtStatsSessionId?m.__gwtStatsSessionId:null,q,r,s,t=P,u={},v=[],w=[],x=[],y=0,z,A;o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:S,millis:(new Date).getTime(),type:T});if(!m.__gwt_stylesLoaded){m.__gwt_stylesLoaded={}}if(!m.__gwt_scriptsLoaded){m.__gwt_scriptsLoaded={}}function B(){var b=false;try{var c=m.location.search;return (c.indexOf(U)!=-1||(c.indexOf(V)!=-1||m.external&&m.external.gwtOnLoad))&&c.indexOf(W)==-1}catch(a){}B=function(){return b};return b}
|
||||
function C(){if(q&&r){var b=n.getElementById(Q);var c=b.contentWindow;if(B()){c.__gwt_getProperty=function(a){return H(a)}}genex=null;c.gwtOnLoad(z,Q,t,y);o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:X,millis:(new Date).getTime(),type:Y})}}
|
||||
function D(){function e(a){var b=a.lastIndexOf(Z);if(b==-1){b=a.length}var c=a.indexOf($);if(c==-1){c=a.length}var d=a.lastIndexOf(_,Math.min(c,b));return d>=0?a.substring(0,d+1):P}
|
||||
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=n.createElement(ab);b.src=a+bb;a=e(b.src)}return a}
|
||||
function g(){var a=F(cb);if(a!=null){return a}return P}
|
||||
function h(){var a=n.getElementsByTagName(db);for(var b=0;b<a.length;++b){if(a[b].src.indexOf(eb)!=-1){return e(a[b].src)}}return P}
|
||||
function i(){var a;if(typeof isBodyLoaded==fb||!isBodyLoaded()){var b=gb;var c;n.write(hb+b+ib);c=n.getElementById(b);a=c&&c.previousSibling;while(a&&a.tagName!=jb){a=a.previousSibling}if(c){c.parentNode.removeChild(c)}if(a&&a.src){return e(a.src)}}return P}
|
||||
function j(){var a=n.getElementsByTagName(kb);if(a.length>0){return a[a.length-1].href}return P}
|
||||
function k(){var a=n.location;return a.href==a.protocol+lb+a.host+a.pathname+a.search+a.hash}
|
||||
var l=g();if(l==P){l=h()}if(l==P){l=i()}if(l==P){l=j()}if(l==P&&k()){l=e(n.location.href)}l=f(l);t=l;return l}
|
||||
function E(){var b=document.getElementsByTagName(mb);for(var c=0,d=b.length;c<d;++c){var e=b[c],f=e.getAttribute(nb),g;if(f){f=f.replace(ob,P);if(f.indexOf(pb)>=0){continue}if(f==qb){g=e.getAttribute(rb);if(g){var h,i=g.indexOf(sb);if(i>=0){f=g.substring(0,i);h=g.substring(i+1)}else{f=g;h=P}u[f]=h}}else if(f==tb){g=e.getAttribute(rb);if(g){try{A=eval(g)}catch(a){alert(ub+g+vb)}}}else if(f==wb){g=e.getAttribute(rb);if(g){try{z=eval(g)}catch(a){alert(ub+g+xb)}}}}}}
|
||||
function F(a){var b=u[a];return b==null?null:b}
|
||||
function G(a,b){var c=x;for(var d=0,e=a.length-1;d<e;++d){c=c[a[d]]||(c[a[d]]=[])}c[a[e]]=b}
|
||||
function H(a){var b=w[a](),c=v[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(A){A(a,d,b)}throw null}
|
||||
var I;function J(){if(!I){I=true;var a=n.createElement(yb);a.src=zb;a.id=Q;a.style.cssText=Ab;a.tabIndex=-1;n.body.appendChild(a);o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:X,millis:(new Date).getTime(),type:Bb});a.contentWindow.location.replace(t+L)}}
|
||||
w[Cb]=function(){var b=navigator.userAgent.toLowerCase();var c=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return b.indexOf(Db)!=-1}())return Db;if(function(){return b.indexOf(Eb)!=-1}())return Fb;if(function(){return b.indexOf(Gb)!=-1&&n.documentMode>=9}())return Hb;if(function(){return b.indexOf(Gb)!=-1&&n.documentMode>=8}())return Ib;if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(b);if(a&&a.length==3)return c(a)>=6000}())return Jb;if(function(){return b.indexOf(Kb)!=-1}())return Lb;return Mb};v[Cb]={gecko1_8:0,ie6:1,ie8:2,ie9:3,opera:4,safari:5};genex.onScriptLoad=function(){if(I){r=true;C()}};genex.onInjectionDone=function(){q=true;o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:Nb,millis:(new Date).getTime(),type:Y});C()};E();D();var K;var L;if(B()){if(m.external&&(m.external.initModule&&m.external.initModule(Q))){m.location.reload();return}L=Ob;K=P}o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:S,millis:(new Date).getTime(),type:Pb});if(!B()){try{G([Fb],Qb);G([Lb],Rb);G([Hb],Sb);G([Jb],Tb);G([Db],Ub);G([Ib],Vb);K=x[H(Cb)];var M=K.indexOf(Wb);if(M!=-1){y=Number(K.substring(M+1));K=K.substring(0,M)}L=K+Xb}catch(a){return}}var N;function O(){if(!s){s=true;if(!__gwt_stylesLoaded[Yb]){var a=n.createElement(Zb);__gwt_stylesLoaded[Yb]=a;a.setAttribute($b,_b);a.setAttribute(ac,t+Yb);n.getElementsByTagName(bc)[0].appendChild(a)}C();if(n.removeEventListener){n.removeEventListener(cc,O,false)}if(N){clearInterval(N)}}}
|
||||
if(n.addEventListener){n.addEventListener(cc,function(){J();O()},false)}var N=setInterval(function(){if(/loaded|complete/.test(n.readyState)){J();O()}},50);o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:S,millis:(new Date).getTime(),type:Y});o&&o({moduleName:Q,sessionId:p,subSystem:R,evtGroup:Nb,millis:(new Date).getTime(),type:T});n.write(dc)}
|
||||
genex();
|
||||
365
common/static/js/capa/genex/hosted.html
Normal file
365
common/static/js/capa/genex/hosted.html
Normal file
@@ -0,0 +1,365 @@
|
||||
<html>
|
||||
<head><script>
|
||||
var $wnd = parent;
|
||||
var $doc = $wnd.document;
|
||||
var $moduleName, $moduleBase, $entry
|
||||
,$stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null
|
||||
,$sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;
|
||||
// Lightweight metrics
|
||||
if ($stats) {
|
||||
var moduleFuncName = location.search.substr(1);
|
||||
var moduleFunc = $wnd[moduleFuncName];
|
||||
var moduleName = moduleFunc ? moduleFunc.moduleName : "unknown";
|
||||
$stats({moduleName:moduleName,sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalStart'});
|
||||
}
|
||||
var $hostedHtmlVersion="2.1";
|
||||
|
||||
var gwtOnLoad;
|
||||
var $hosted = "localhost:9997";
|
||||
|
||||
function loadIframe(url) {
|
||||
var topDoc = window.top.document;
|
||||
|
||||
// create an iframe
|
||||
var iframeDiv = topDoc.createElement("div");
|
||||
iframeDiv.innerHTML = "<iframe scrolling=no frameborder=0 src='" + url + "'>";
|
||||
var iframe = iframeDiv.firstChild;
|
||||
|
||||
// mess with the iframe style a little
|
||||
var iframeStyle = iframe.style;
|
||||
iframeStyle.position = "absolute";
|
||||
iframeStyle.borderWidth = "0";
|
||||
iframeStyle.left = "0";
|
||||
iframeStyle.top = "0";
|
||||
iframeStyle.width = "100%";
|
||||
iframeStyle.backgroundColor = "#ffffff";
|
||||
iframeStyle.zIndex = "1";
|
||||
iframeStyle.height = "100%";
|
||||
|
||||
// update the top window's document's body's style
|
||||
var hostBodyStyle = window.top.document.body.style;
|
||||
hostBodyStyle.margin = "0";
|
||||
hostBodyStyle.height = iframeStyle.height;
|
||||
hostBodyStyle.overflow = "hidden";
|
||||
|
||||
// insert the iframe
|
||||
topDoc.body.insertBefore(iframe, topDoc.body.firstChild);
|
||||
}
|
||||
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf("gecko") != -1) {
|
||||
// install eval wrapper on FF to avoid EvalError problem
|
||||
var __eval = window.eval;
|
||||
window.eval = function(s) {
|
||||
return __eval(s);
|
||||
}
|
||||
}
|
||||
if (ua.indexOf("chrome") != -1) {
|
||||
// work around __gwt_ObjectId appearing in JS objects
|
||||
var hop = Object.prototype.hasOwnProperty;
|
||||
Object.prototype.hasOwnProperty = function(prop) {
|
||||
return prop != "__gwt_ObjectId" && hop.call(this, prop);
|
||||
};
|
||||
// do the same in our parent as well -- see issue 4486
|
||||
// NOTE: this will have to be changed when we support non-iframe-based DevMode
|
||||
var hop2 = parent.Object.prototype.hasOwnProperty;
|
||||
parent.Object.prototype.hasOwnProperty = function(prop) {
|
||||
return prop != "__gwt_ObjectId" && hop2.call(this, prop);
|
||||
};
|
||||
}
|
||||
|
||||
// wrapper to call JS methods, which we need both to be able to supply a
|
||||
// different this for method lookup and to get the exception back
|
||||
function __gwt_jsInvoke(thisObj, methodName) {
|
||||
try {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
return [0, window[methodName].apply(thisObj, args)];
|
||||
} catch (e) {
|
||||
return [1, e];
|
||||
}
|
||||
}
|
||||
|
||||
var __gwt_javaInvokes = [];
|
||||
function __gwt_makeJavaInvoke(argCount) {
|
||||
return __gwt_javaInvokes[argCount] || __gwt_doMakeJavaInvoke(argCount);
|
||||
}
|
||||
|
||||
function __gwt_doMakeJavaInvoke(argCount) {
|
||||
// IE6 won't eval() anonymous functions except as r-values
|
||||
var argList = "";
|
||||
for (var i = 0; i < argCount; i++) {
|
||||
argList += ",p" + i;
|
||||
}
|
||||
var argListNoComma = argList.substring(1);
|
||||
|
||||
return eval(
|
||||
"__gwt_javaInvokes[" + argCount + "] =\n" +
|
||||
" function(thisObj, dispId" + argList + ") {\n" +
|
||||
" var result = __static(dispId, thisObj" + argList + ");\n" +
|
||||
" if (result[0]) {\n" +
|
||||
" throw result[1];\n" +
|
||||
" } else {\n" +
|
||||
" return result[1];\n" +
|
||||
" }\n" +
|
||||
" }\n"
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is used to create tear-offs of Java methods. Each function corresponds
|
||||
* to exactly one dispId, and also embeds the argument count. We get the "this"
|
||||
* value from the context in which the function is being executed.
|
||||
* Function-object identity is preserved by caching in a sparse array.
|
||||
*/
|
||||
var __gwt_tearOffs = [];
|
||||
var __gwt_tearOffGenerators = [];
|
||||
function __gwt_makeTearOff(proxy, dispId, argCount) {
|
||||
return __gwt_tearOffs[dispId] || __gwt_doMakeTearOff(dispId, argCount);
|
||||
}
|
||||
|
||||
function __gwt_doMakeTearOff(dispId, argCount) {
|
||||
return __gwt_tearOffs[dispId] =
|
||||
(__gwt_tearOffGenerators[argCount] || __gwt_doMakeTearOffGenerator(argCount))(dispId);
|
||||
}
|
||||
|
||||
function __gwt_doMakeTearOffGenerator(argCount) {
|
||||
// IE6 won't eval() anonymous functions except as r-values
|
||||
var argList = "";
|
||||
for (var i = 0; i < argCount; i++) {
|
||||
argList += ",p" + i;
|
||||
}
|
||||
var argListNoComma = argList.substring(1);
|
||||
|
||||
return eval(
|
||||
"__gwt_tearOffGenerators[" + argCount + "] =\n" +
|
||||
" function(dispId) {\n" +
|
||||
" return function(" + argListNoComma + ") {\n" +
|
||||
" var result = __static(dispId, this" + argList + ");\n" +
|
||||
" if (result[0]) {\n" +
|
||||
" throw result[1];\n" +
|
||||
" } else {\n" +
|
||||
" return result[1];\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n"
|
||||
);
|
||||
}
|
||||
|
||||
function __gwt_makeResult(isException, result) {
|
||||
return [isException, result];
|
||||
}
|
||||
|
||||
function __gwt_disconnected() {
|
||||
// Prevent double-invocation.
|
||||
window.__gwt_disconnected = new Function();
|
||||
// Do it in a timeout so we can be sure we have a clean stack.
|
||||
window.setTimeout(__gwt_disconnected_impl, 1);
|
||||
}
|
||||
|
||||
function __gwt_disconnected_impl() {
|
||||
__gwt_displayGlassMessage('GWT Code Server Disconnected',
|
||||
'Most likely, you closed GWT Development Mode. Or, you might have lost '
|
||||
+ 'network connectivity. To fix this, try restarting GWT Development Mode and '
|
||||
+ 'refresh this page.');
|
||||
}
|
||||
|
||||
// Keep track of z-index to allow layering of multiple glass messages
|
||||
var __gwt_glassMessageZIndex = 2147483647;
|
||||
|
||||
// Note this method is also used by ModuleSpace.java
|
||||
function __gwt_displayGlassMessage(summary, details) {
|
||||
var topWin = window.top;
|
||||
var topDoc = topWin.document;
|
||||
var outer = topDoc.createElement("div");
|
||||
// Do not insert whitespace or outer.firstChild will get a text node.
|
||||
outer.innerHTML =
|
||||
'<div style="position:absolute;z-index:' + __gwt_glassMessageZIndex-- +
|
||||
';left:50px;top:50px;width:600px;color:#FFF;font-family:verdana;text-align:left;">' +
|
||||
'<div style="font-size:30px;font-weight:bold;">' + summary + '</div>' +
|
||||
'<div style="font-size:15px;">' + details + '</div>' +
|
||||
'</div>' +
|
||||
'<div style="position:absolute;z-index:' + __gwt_glassMessageZIndex-- +
|
||||
';left:0px;top:0px;right:0px;bottom:0px;filter:alpha(opacity=60);opacity:0.6;background-color:#000;"></div>'
|
||||
;
|
||||
topDoc.body.appendChild(outer);
|
||||
var glass = outer.firstChild;
|
||||
var glassStyle = glass.style;
|
||||
|
||||
// Scroll to the top and remove scrollbars.
|
||||
topWin.scrollTo(0, 0);
|
||||
if (topDoc.compatMode == "BackCompat") {
|
||||
topDoc.body.style["overflow"] = "hidden";
|
||||
} else {
|
||||
topDoc.documentElement.style["overflow"] = "hidden";
|
||||
}
|
||||
|
||||
// Steal focus.
|
||||
glass.focus();
|
||||
|
||||
if ((navigator.userAgent.indexOf("MSIE") >= 0) && (topDoc.compatMode == "BackCompat")) {
|
||||
// IE quirks mode doesn't support right/bottom, but does support this.
|
||||
glassStyle.width = "125%";
|
||||
glassStyle.height = "100%";
|
||||
} else if (navigator.userAgent.indexOf("MSIE 6") >= 0) {
|
||||
// IE6 doesn't have a real standards mode, so we have to use hacks.
|
||||
glassStyle.width = "125%"; // Get past scroll bar area.
|
||||
// Nasty CSS; onresize would be better but the outer window won't let us add a listener IE.
|
||||
glassStyle.setExpression("height", "document.documentElement.clientHeight");
|
||||
}
|
||||
|
||||
$doc.title = summary + " [" + $doc.title + "]";
|
||||
}
|
||||
|
||||
function findPluginObject() {
|
||||
try {
|
||||
return document.getElementById('pluginObject');
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function findPluginEmbed() {
|
||||
try {
|
||||
return document.getElementById('pluginEmbed')
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function findPluginXPCOM() {
|
||||
try {
|
||||
return __gwt_HostedModePlugin;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
gwtOnLoad = function(errFn, modName, modBase){
|
||||
$moduleName = modName;
|
||||
$moduleBase = modBase;
|
||||
|
||||
// Note that the order is important
|
||||
var pluginFinders = [
|
||||
findPluginXPCOM,
|
||||
findPluginObject,
|
||||
findPluginEmbed,
|
||||
];
|
||||
var topWin = window.top;
|
||||
var url = topWin.location.href;
|
||||
if (!topWin.__gwt_SessionID) {
|
||||
var ASCII_EXCLAMATION = 33;
|
||||
var ASCII_TILDE = 126;
|
||||
var chars = [];
|
||||
for (var i = 0; i < 16; ++i) {
|
||||
chars.push(Math.floor(ASCII_EXCLAMATION
|
||||
+ Math.random() * (ASCII_TILDE - ASCII_EXCLAMATION + 1)));
|
||||
}
|
||||
topWin.__gwt_SessionID = String.fromCharCode.apply(null, chars);
|
||||
}
|
||||
var plugin = null;
|
||||
for (var i = 0; i < pluginFinders.length; ++i) {
|
||||
try {
|
||||
var maybePlugin = pluginFinders[i]();
|
||||
if (maybePlugin != null && maybePlugin.init(window)) {
|
||||
plugin = maybePlugin;
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
if (!plugin) {
|
||||
// try searching for a v1 plugin for backwards compatibility
|
||||
var found = false;
|
||||
for (var i = 0; i < pluginFinders.length; ++i) {
|
||||
try {
|
||||
plugin = pluginFinders[i]();
|
||||
if (plugin != null && plugin.connect($hosted, $moduleName, window)) {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
loadIframe("http://gwt.google.com/missing-plugin");
|
||||
} else {
|
||||
if (plugin.connect(url, topWin.__gwt_SessionID, $hosted, $moduleName,
|
||||
$hostedHtmlVersion)) {
|
||||
window.onUnload = function() {
|
||||
try {
|
||||
// wrap in try/catch since plugins are not required to supply this
|
||||
plugin.disconnect();
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (errFn) {
|
||||
errFn(modName);
|
||||
} else {
|
||||
__gwt_displayGlassMessage(
|
||||
"Plugin failed to connect to Development Mode server at " + simpleEscape($hosted),
|
||||
"Follow the troubleshooting instructions at "
|
||||
+ "<a href='http://code.google.com/p/google-web-toolkit/wiki/TroubleshootingOOPHM'>"
|
||||
+ "http://code.google.com/p/google-web-toolkit/wiki/TroubleshootingOOPHM</a>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function simpleEscape(originalString) {
|
||||
return originalString.replace(/&/g,"&")
|
||||
.replace(/</g,"<")
|
||||
.replace(/>/g,">")
|
||||
.replace(/\'/g, "'")
|
||||
.replace(/\"/g,""");
|
||||
}
|
||||
|
||||
window.onunload = function() {
|
||||
};
|
||||
|
||||
// Lightweight metrics
|
||||
window.fireOnModuleLoadStart = function(className) {
|
||||
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'onModuleLoadStart', className:className});
|
||||
};
|
||||
|
||||
window.__gwt_module_id = 0;
|
||||
</script></head>
|
||||
<body>
|
||||
<font face='arial' size='-1'>This html file is for Development Mode support.</font>
|
||||
<script><!--
|
||||
// Lightweight metrics
|
||||
$stats && $stats({moduleName:$moduleName, sessionId:$sessionId, subSystem:'startup', evtGroup:'moduleStartup', millis:(new Date()).getTime(), type:'moduleEvalEnd'});
|
||||
|
||||
// OOPHM currently only supports IFrameLinker
|
||||
var query = parent.location.search;
|
||||
if (!findPluginXPCOM()) {
|
||||
document.write('<embed id="pluginEmbed" type="application/x-gwt-hosted-mode" width="10" height="10">');
|
||||
document.write('</embed>');
|
||||
document.write('<object id="pluginObject" CLASSID="CLSID:1D6156B6-002B-49E7-B5CA-C138FB843B4E">');
|
||||
document.write('</object>');
|
||||
}
|
||||
|
||||
// look for the old query parameter if we don't find the new one
|
||||
var idx = query.indexOf("gwt.codesvr=");
|
||||
if (idx >= 0) {
|
||||
idx += 12; // "gwt.codesvr=".length() == 12
|
||||
} else {
|
||||
idx = query.indexOf("gwt.hosted=");
|
||||
if (idx >= 0) {
|
||||
idx += 11; // "gwt.hosted=".length() == 11
|
||||
}
|
||||
}
|
||||
if (idx >= 0) {
|
||||
var amp = query.indexOf("&", idx);
|
||||
if (amp >= 0) {
|
||||
$hosted = query.substring(idx, amp);
|
||||
} else {
|
||||
$hosted = query.substring(idx);
|
||||
}
|
||||
|
||||
// According to RFC 3986, some of this component's characters (e.g., ':')
|
||||
// are reserved and *may* be escaped.
|
||||
$hosted = decodeURIComponent($hosted);
|
||||
}
|
||||
|
||||
query = window.location.search.substring(1);
|
||||
if (query && $wnd[query]) setTimeout($wnd[query].onScriptLoad, 1);
|
||||
--></script></body></html>
|
||||
Reference in New Issue
Block a user