Permalink
Browse files

Removed lib

  • Loading branch information...
1 parent 9b1d377 commit b1d813f4d6cbe7fbdf17728ad5fd099bc8c30ba3 Nikolai Onken committed May 3, 2011
Showing with 3 additions and 285 deletions.
  1. +0 −41 lib/delegate.js
  2. +0 −14 lib/dojo.xd.js
  3. +0 −13 lib/json_resource.js
  4. +0 −105 lib/mixins.js
  5. +0 −32 lib/require.js
  6. +0 −80 lib/resource.js
  7. +3 −0 src/index.html
View
@@ -1,41 +0,0 @@
-define(function(){
- var delegate = function delegate(){
- if (!(this instanceof delegate)){
- return new delegate(arguments);
- }
- this.delegates = [];
- };
-
- delegate.delegate = function(obj, delegate, map){
- return obj.delegates.push({
- obj: delegate,
- map: map
- }); /* handle */
- };
-
- delegate.prototype = {
- delegate: function(receiver, map){
- return delegate.delegate(this, receiver, map);
- },
- emit: function(event){
- var args = Array.prototype.slice.call(arguments, 1);
- dojo.forEach(this.delegates, function(delegate){
- if (delegate){
- var e = (delegate.map && delegate.map[event]) ? delegate.map[event] : event;
- var f = typeof e === 'function' ? e : delegate.obj[e];
- f && f.apply(delegate.obj, args);
- }
- }, this);
- },
- removeDelegate: function(handle){
- handle--; // Handle is the array length not the position
- // TODO: This way we're building a bloated array in the long term
- // Maybe we should use a hash as a delegate identifier?
- if (this.delegates[handle]){
- delete this.delegates[handle];
- }
- }
- };
-
- return delegate;
-});
View
View
@@ -1,13 +0,0 @@
-// JSONFileResource
-define(function(){
- return {
- list: function(){
- return dojo.xhrGet({
- url: 'data/schedule.json',
- handleAs: 'json'
- }).then(function(data){
- return data.objects;
- });
- }
- };
-});
View
@@ -1,105 +0,0 @@
-define([
- 'lib/delegate'
-], function(delegate){
- var place = dojo.place;
- var query = dojo.query;
-
- // event delegation: event on selector -> method
-
- var Mixins = {};
-
- Mixins.Events = {};
- Mixins.Events.bindings = function(bindings){
- for (selector in bindings){ if (bindings.hasOwnProperty(selector)){ var events = bindings[selector];
- var node = query(selector, this.containerNode);
- for (event in events){ if (events.hasOwnProperty(event)){ var handler = events[event];
- node.connect(event, this, handler);
- }}
- }}
- };
-
- // data binding: model -> view
- Mixins.Data = {
- _validations: {},
- bindObjToDom: function(resource, setters){
- var root = this.containerNode;
- var rebind = function(){
- var object = resource.properties;
- for (key in setters){ if (setters.hasOwnProperty(key)){ var setter = setters[key];
- // We check whether the root node has the given class or query its children
- var node = dojo.hasClass(root, key) ? root : query('.' + key, root);
- var value = typeof resource[key] === 'function' ? resource[key].call(object, resource) : object[key];
- typeof value !== 'undefined' && setter(node, value);
- }}
- };
- var handle = resource.delegate({ changed: rebind });
-
- // I now stored the binding references as a data attribute which in some way seems fine
- // since it is related to the DOM node where the binding is applied on.
- // We are getting the existing bindings from the DOM node and then add the new binding
- // reference.
-
- // Still should check whether this is the way we want to go.
-
- var b = dojo.attr(this.containerNode, 'data-bindings');
- b = b ? dojo.fromJson(b) : {};
- !b[resource._uuid] && (b[resource._uuid] = []);
- b[resource._uuid].push(handle);
- dojo.attr(this.containerNode, 'data-bindings', dojo.toJson(b));
- rebind();
- },
- unbindObjFromDom: function(resource){
- var bindings = dojo.attr(this.containerNode, 'data-bindings');
- if (bindings){
- bindings = dojo.fromJson(bindings);
- bindings[resource._uuid] && dojo.forEach(bindings[resource._uuid], function(handle){
- resource.removeDelegate(handle);
- });
- delete bindings[resource._uuid];
- dojo.attr(this.containerNode, 'data-bindings', dojo.toJson(bindings));
- }
- },
- validate: function(resource){
- var handle = resource.delegate({
- 'error': dojo.hitch(this, function(err){
- this.clearValidation();
- var type, str;
- for (type in err){
- str = err[type].pop();
- dojo.query('.error-'+type, this.containerNode).attr('innerHTML', str);
- }
- })
- });
- if (!this._validations[resource._uuid]){
- this._validations[resource._uuid] = [];
- }
- this._validations[resource._uuid].push(handle);
- },
- unbindValidate: function(resource){
- this._validations[resource._uuid] && dojo.forEach(this._validations[resource._uuid], function(handle){
- resource.removeDelegate(handle);
- });
- delete this._validations[resource._uuid];
- },
- clearValidation: function(){
- dojo.query('.error-container', this.containerNode).attr('innerHTML', '');
- }
- };
-
-
- // template rendering
- Mixins.Template = function(domNode, template, position){
- dojo.mixin(this, {
- containerNode: dojo._toDom(template),
- domNode: domNode,
- template: template,
- position: position
- });
- };
-
- Mixins.Template.prototype.render = function(){
- place(this.containerNode, this.domNode, this.position);
- };
-
- return Mixins;
-});
View
@@ -1,32 +0,0 @@
-/*
- RequireJS 0.24.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- Available via the MIT or new BSD license.
- see: http://github.com/jrburke/requirejs for details
-*/
-var require,define;
-(function(){function Q(e){return da.call(e)==="[object Function]"}function V(e){return da.call(e)==="[object Array]"}function W(e,g,l){for(var k in g)if(!(k in F)&&(!(k in e)||l))e[k]=g[k];return h}function ea(e,g,l){var k,p,n;for(k=0;n=g[k];k++){n=typeof n==="string"?{name:n}:n;p=n.location;if(l&&(!p||p.indexOf("/")!==0&&p.indexOf(":")===-1))p=l+"/"+(p||n.name);e[n.name]={name:n.name,location:p||n.name,lib:n.lib||"lib",main:(n.main||"lib/main").replace(qa,"").replace(fa,"")}}}function ra(e){function g(a){var b,
-c;for(b=0;c=a[b];b++)if(c==="."){a.splice(b,1);b-=1}else if(c==="..")if(b===1&&(a[2]===".."||a[0]===".."))break;else if(b>0){a.splice(b-1,2);b-=2}}function l(a,b){var c;if(a.charAt(0)===".")if(b){if(t.pkgs[b])b=[b];else{b=b.split("/");b=b.slice(0,b.length-1)}a=b.concat(a.split("/"));g(a);c=t.pkgs[b=a[0]];a=a.join("/");if(c&&a===b+"/"+c.main)a=b}return a}function k(a,b){var c=a?a.indexOf("!"):-1,d=null,f=b?b.name:null,j=a,o,m;if(c!==-1){d=a.substring(0,c);a=a.substring(c+1,a.length)}if(d)d=l(d,f);
-if(a){if(d)o=(c=q[d])?c.normalize?c.normalize(a,function(u){return l(u,f)}):l(a,f):"__$p"+f+"@"+a;else o=l(a,f);m=X[o];if(!m){m=h.toModuleUrl?h.toModuleUrl(i,a,b):i.nameToUrl(a,null,b);X[o]=m}}return{prefix:d,name:o,parentMap:b,url:m,originalName:j,fullName:d?d+"!"+o:o}}function p(){var a=true,b=t.priorityWait,c,d;if(b){for(d=0;c=b[d];d++)if(!v[c]){a=false;break}a&&delete t.priorityWait}return a}function n(a){return function(b){a.exports=b}}function R(a,b,c){return function(){var d=[].concat(sa.call(arguments,
-0)),f;if(c&&Q(f=d[d.length-1]))f.__requireJsBuild=true;d.push(b);return a.apply(null,d)}}function ga(a,b){b=R(i.require,a,b);W(b,{nameToUrl:R(i.nameToUrl,a),toUrl:R(i.toUrl,a),isDefined:R(i.isDefined,a),ready:h.ready,isBrowser:h.isBrowser});if(h.paths)b.paths=h.paths;return b}function ta(a){var b,c,d,f,j,o,m,u=S[a];if(u)for(f=0;c=u[f];f++){b=c.fullName;c=k(c.originalName,c.parentMap);c=c.fullName;d=w[b]||[];j=w[c];if(c!==b){if(b in z){delete z[b];z[c]=true}w[c]=j?j.concat(d):d;delete w[b];for(j=0;j<
-d.length;j++){m=d[j].depArray;for(o=0;o<m.length;o++)if(m[o]===b)m[o]=c}}}delete S[a]}function ha(a){var b=a.prefix,c=a.fullName;if(!(z[c]||c in q)){if(b&&!G[b]){G[b]=undefined;(S[b]||(S[b]=[])).push(a);(w[b]||(w[b]=[])).push({onDep:function(d){d===b&&ta(b)}});ha(k(b))}i.paused.push(a)}}function Y(a){var b,c,d;b=a.callback;var f=a.fullName;d=[];var j=a.depArray;if(b&&Q(b)){if(j)for(b=0;b<j.length;b++)d.push(a.deps[j[b]]);c=h.execCb(f,a.callback,d);if(f)if(a.usingExports&&c===undefined&&(!a.cjsModule||
-!("exports"in a.cjsModule)))c=q[f];else if(a.cjsModule&&"exports"in a.cjsModule)c=q[f]=a.cjsModule.exports;else{if(f in q&&!a.usingExports)return h.onError(new Error(f+" has already been defined"));q[f]=c}}else if(f)c=q[f]=b;if(f)if(d=w[f]){for(b=0;b<d.length;b++)d[b].onDep(f,c);delete w[f]}if(B[a.waitId]){delete B[a.waitId];a.isDone=true;i.waitCount-=1;if(i.waitCount===0)Z=[]}}function ia(a,b,c,d){a=k(a,d);var f=a.name,j=a.fullName,o={},m={waitId:f||ua+va++,depCount:0,depMax:0,prefix:a.prefix,name:f,
-fullName:j,deps:{},depArray:b,callback:c,onDep:function(ja,wa){if(!(ja in m.deps)){m.deps[ja]=wa;m.depCount+=1;m.depCount===m.depMax&&Y(m)}}},u,s;if(j){if(j in q||v[j]===true)return;z[j]=true;v[j]=true;i.jQueryDef=j==="jquery"}for(c=0;c<b.length;c++)if(u=b[c]){u=k(u,f?a:d);s=u.fullName;b[c]=s;if(s==="require")m.deps[s]=ga(a);else if(s==="exports"){m.deps[s]=q[j]={};m.usingExports=true}else if(s==="module"){m.cjsModule=u=m.deps[s]={id:f,uri:f?i.nameToUrl(f,null,d):undefined};u.setExports=n(u)}else if(s in
-q&&!(s in B))m.deps[s]=q[s];else if(!o[s]){m.depMax+=1;ha(u);(w[s]||(w[s]=[])).push(m);o[s]=true}}if(m.depCount===m.depMax)Y(m);else{B[m.waitId]=m;Z.push(m);i.waitCount+=1}}function J(a){ia.apply(null,a);v[a[0]]=true}function ka(a){if(!i.jQuery)if((a=a||(typeof jQuery!=="undefined"?jQuery:null))&&"readyWait"in a){i.jQuery=a;J(["jquery",[],function(){return jQuery}]);if(i.scriptCount){a.readyWait+=1;i.jQueryIncremented=true}}}function la(a,b){if(!a.isDone){var c=a.fullName,d=a.depArray,f,j;if(c){if(b[c])return q[c];
-b[c]=true}for(j=0;j<d.length;j++)(f=d[j])&&!a.deps[f]&&B[f]&&a.onDep(f,la(B[f],b));return c?q[c]:undefined}}function $(){var a=t.waitSeconds*1E3,b=a&&i.startTime+a<(new Date).getTime();a="";var c=false,d=false,f;if(!(i.pausedCount>0)){if(t.priorityWait)if(p())C();else return;for(f in v)if(!(f in F)){c=true;if(!v[f])if(b)a+=f+" ";else{d=true;break}}if(c||i.waitCount){if(b&&a){f=new Error("require.js load timeout for modules: "+a);f.requireType="timeout";f.requireModules=a;return h.onError(f)}if(d||
-i.scriptCount){if(A||ma)setTimeout($,50)}else if(i.waitCount){for(D=0;a=Z[D];D++)la(a,{});$()}else h.checkReadyState()}}}function na(a,b){var c=b.name,d=b.fullName,f;if(!(d in q||d in v)){G[a]||(G[a]=q[a]);v[d]||(v[d]=false);f=function(j){require.onPluginLoad&&require.onPluginLoad(i,a,c,j);Y({prefix:b.prefix,name:b.name,fullName:b.fullName,callback:function(){return j}});v[d]=true};f.fromText=function(j,o){var m=K;i.loaded[j]=false;i.scriptCount+=1;if(m)K=false;eval(o);if(m)K=true;i.completeLoad(j)};
-G[a].load(c,ga(b.parentMap,true),f,t)}}function xa(a){if(a.prefix&&a.name.indexOf("__$p")===0&&q[a.prefix])a=k(a.originalName,a.parentMap);var b=a.prefix,c=a.fullName;if(!(z[c]||v[c])){z[c]=true;if(b)if(q[b])na(b,a);else{if(!L[b]){L[b]=[];(w[b]||(w[b]=[])).push({onDep:function(d){if(d===b){var f,j=L[b];for(d=0;d<j.length;d++){f=j[d];na(b,k(f.originalName,f.parentMap))}delete L[b]}}})}L[b].push(a)}else h.load(i,c,a.url)}}var i,C,t={waitSeconds:7,baseUrl:r.baseUrl||"./",paths:{},pkgs:{}},M=[],z={require:true,
-exports:true,module:true},X={},q={},v={},B={},Z=[],va=0,w={},G={},L={},aa=0,S={};C=function(){var a,b,c;aa+=1;if(i.scriptCount<=0)i.scriptCount=0;for(;M.length;){a=M.shift();if(a[0]===null)return h.onError(new Error("Mismatched anonymous require.def modules"));else J(a)}if(!t.priorityWait||p())for(;i.paused.length;){c=i.paused;i.pausedCount+=c.length;i.paused=[];for(b=0;a=c[b];b++)xa(a);i.startTime=(new Date).getTime();i.pausedCount-=c.length}aa===1&&$();aa-=1};i={contextName:e,config:t,defQueue:M,
-waiting:B,waitCount:0,specified:z,loaded:v,urlMap:X,scriptCount:0,urlFetched:{},defined:q,paused:[],pausedCount:0,plugins:G,managerCallbacks:w,makeModuleMap:k,normalize:l,configure:function(a){var b,c,d;if(a.baseUrl)if(a.baseUrl.charAt(a.baseUrl.length-1)!=="/")a.baseUrl+="/";b=t.paths;d=t.pkgs;W(t,a,true);if(a.paths){for(c in a.paths)c in F||(b[c]=a.paths[c]);t.paths=b}if((b=a.packagePaths)||a.packages){if(b)for(c in b)c in F||ea(d,b[c],c);a.packages&&ea(d,a.packages);t.pkgs=d}if(a.priority){c=i.requireWait;
-i.requireWait=false;i.takeGlobalQueue();C();i.require(a.priority);C();i.requireWait=c;t.priorityWait=a.priority}if(a.deps||a.callback)i.require(a.deps||[],a.callback);a.ready&&h.ready(a.ready)},isDefined:function(a,b){return k(a,b).fullName in q},require:function(a,b,c){if(typeof a==="string"){if(h.get)return h.get(i,a,b);c=b;b=k(a,c);a=q[b.fullName];if(a===undefined)return h.onError(new Error("require: module name '"+b.fullName+"' has not been loaded yet for context: "+e));return a}ia(null,a,b,c);
-if(!i.requireWait)for(;!i.scriptCount&&i.paused.length;)C()},takeGlobalQueue:function(){if(T.length){ya.apply(i.defQueue,[i.defQueue.length-1,0].concat(T));T=[]}},completeLoad:function(a){var b;for(i.takeGlobalQueue();M.length;){b=M.shift();if(b[0]===null){b[0]=a;break}else if(b[0]===a)break;else{J(b);b=null}}b?J(b):J([a,[],a==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);v[a]=true;ka();if(h.isAsync)i.scriptCount-=1;C();h.isAsync||(i.scriptCount-=1)},toUrl:function(a,b){var c=
-a.lastIndexOf("."),d=null;if(c!==-1){d=a.substring(c,a.length);a=a.substring(0,c)}return i.nameToUrl(a,d,b)},nameToUrl:function(a,b,c){var d,f,j,o,m=i.config;if(a.indexOf("./")===0||a.indexOf("../")===0){c=c&&c.url?c.url.split("/"):[];c.length&&c.pop();c=c.concat(a.split("/"));g(c);b=c.join("/")+(b?b:h.jsExtRegExp.test(a)?"":".js")}else{a=l(a,c);if(h.jsExtRegExp.test(a))b=a+(b?b:"");else{d=m.paths;f=m.pkgs;c=a.split("/");for(o=c.length;o>0;o--){j=c.slice(0,o).join("/");if(d[j]){c.splice(0,o,d[j]);
-break}else if(j=f[j]){a=a===j.name?j.location+"/"+j.main:j.location+"/"+j.lib;c.splice(0,o,a);break}}b=c.join("/")+(b||".js");b=(b.charAt(0)==="/"||b.match(/^\w+:/)?"":m.baseUrl)+b}}return m.urlArgs?b+((b.indexOf("?")===-1?"?":"&")+m.urlArgs):b}};i.jQueryCheck=ka;i.resume=C;return i}function za(){var e,g,l;if(N&&N.readyState==="interactive")return N;e=document.getElementsByTagName("script");for(g=e.length-1;g>-1&&(l=e[g]);g--)if(l.readyState==="interactive")return N=l;return null}var Aa=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
-Ba=/require\(["']([^'"\s]+)["']\)/g,qa=/^\.\//,fa=/\.js$/,da=Object.prototype.toString,x=Array.prototype,sa=x.slice,ya=x.splice,A=!!(typeof window!=="undefined"&&navigator&&document),ma=!A&&typeof importScripts!=="undefined",Ca=A&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,oa=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",ua="_r@@",F={},H={},T=[],N=null,Da=false,K=false,h;x={};var ba,r,I,U,y,O,P,D,ca,pa,E;if(typeof require!=="undefined")if(Q(require))return;
-else x=require;h=require=function(e,g,l){var k="_",p;if(!V(e)&&typeof e!=="string"){p=e;if(V(g)){e=g;g=l}else e=[]}if(p&&p.context)k=p.context;l=H[k]||(H[k]=ra(k));p&&l.configure(p);return l.require(e,g)};h.version="0.24.0";h.isArray=V;h.isFunction=Q;h.mixin=W;h.jsExtRegExp=/^\/|:|\?|\.js$/;r=h.s={contexts:H,skipAsync:{},isPageLoaded:!A,readyCalls:[]};if(h.isAsync=h.isBrowser=A){I=r.head=document.getElementsByTagName("head")[0];if(U=document.getElementsByTagName("base")[0])I=r.head=U.parentNode}h.onError=
-function(e){throw e;};h.load=function(e,g,l){var k=e.contextName,p=e.urlFetched,n=e.loaded;Da=false;n[g]||(n[g]=false);if(!p[l]){e.scriptCount+=1;h.attach(l,k,g);p[l]=true;if(e.jQuery&&!e.jQueryIncremented){e.jQuery.readyWait+=1;e.jQueryIncremented=true}}};define=h.def=function(e,g,l){var k;if(typeof e!=="string"){l=g;g=e;e=null}if(!h.isArray(g)){l=g;g=[]}if(!e&&!g.length&&h.isFunction(l))if(l.length){l.toString().replace(Aa,"").replace(Ba,function(p,n){g.push(n)});g=["require","exports","module"].concat(g)}if(K){k=
-ba||za();if(!k)return h.onError(new Error("ERROR: No matching script interactive for "+l));e||(e=k.getAttribute("data-requiremodule"));k=H[k.getAttribute("data-requirecontext")]}(k?k.defQueue:T).push([e,g,l])};define.amd={multiversion:true,plugins:true};h.execCb=function(e,g,l){return g.apply(null,l)};h.onScriptLoad=function(e){var g=e.currentTarget||e.srcElement,l;if(e.type==="load"||Ca.test(g.readyState)){N=null;e=g.getAttribute("data-requirecontext");l=g.getAttribute("data-requiremodule");H[e].completeLoad(l);
-g.detachEvent&&!oa?g.detachEvent("onreadystatechange",h.onScriptLoad):g.removeEventListener("load",h.onScriptLoad,false)}};h.attach=function(e,g,l,k,p){var n;if(A){k=k||h.onScriptLoad;n=document.createElement("script");n.type=p||"text/javascript";n.charset="utf-8";n.async=!r.skipAsync[e];n.setAttribute("data-requirecontext",g);n.setAttribute("data-requiremodule",l);if(n.attachEvent&&!oa){K=true;n.attachEvent("onreadystatechange",k)}else n.addEventListener("load",k,false);n.src=e;ba=n;U?I.insertBefore(n,
-U):I.appendChild(n);ba=null;return n}else if(ma){k=H[g];g=k.loaded;g[l]=false;importScripts(e);k.completeLoad(l)}return null};if(A){y=document.getElementsByTagName("script");for(D=y.length-1;D>-1&&(O=y[D]);D--){if(!I)I=O.parentNode;if(P=O.getAttribute("data-main")){if(!x.baseUrl){y=P.split("/");O=y.pop();y=y.length?y.join("/")+"/":"./";x.baseUrl=y;P=O.replace(fa,"")}x.deps=x.deps?x.deps.concat(P):[P];break}}}r.baseUrl=x.baseUrl;h.pageLoaded=function(){if(!r.isPageLoaded){r.isPageLoaded=true;ca&&clearInterval(ca);
-if(pa)document.readyState="complete";h.callReady()}};h.checkReadyState=function(){var e=r.contexts,g;for(g in e)if(!(g in F))if(e[g].waitCount)return;r.isDone=true;h.callReady()};h.callReady=function(){var e=r.readyCalls,g,l,k;if(r.isPageLoaded&&r.isDone){if(e.length){r.readyCalls=[];for(g=0;l=e[g];g++)l()}e=r.contexts;for(k in e)if(!(k in F)){g=e[k];if(g.jQueryIncremented){g.jQuery.ready(true);g.jQueryIncremented=false}}}};h.ready=function(e){r.isPageLoaded&&r.isDone?e():r.readyCalls.push(e);return h};
-if(A){if(document.addEventListener){document.addEventListener("DOMContentLoaded",h.pageLoaded,false);window.addEventListener("load",h.pageLoaded,false);if(!document.readyState){pa=true;document.readyState="loading"}}else if(window.attachEvent){window.attachEvent("onload",h.pageLoaded);if(self===self.top)ca=setInterval(function(){try{if(document.body){document.documentElement.doScroll("left");h.pageLoaded()}}catch(e){}},30)}document.readyState==="complete"&&h.pageLoaded()}h(x);if(h.isAsync&&typeof setTimeout!==
-"undefined"){E=r.contexts[x.context||"_"];E.requireWait=true;setTimeout(function(){E.requireWait=false;E.takeGlobalQueue();E.jQueryCheck();E.scriptCount||E.resume();h.checkReadyState()},0)}})();
Oops, something went wrong. Retry.

0 comments on commit b1d813f

Please sign in to comment.