Merge branch 'feature/cale/cms-master' into feature/christina/tiny-mce
This commit is contained in:
@@ -249,7 +249,10 @@ class @DiscussionUtil
|
||||
$3
|
||||
else if RE_DISPLAYMATH.test(text)
|
||||
text = text.replace RE_DISPLAYMATH, ($0, $1, $2, $3) ->
|
||||
processedText += $1 + processor("$$" + $2 + "$$", 'display')
|
||||
#processedText += $1 + processor("$$" + $2 + "$$", 'display')
|
||||
#bug fix, ordering is off
|
||||
processedText = processor("$$" + $2 + "$$", 'display') + processedText
|
||||
processedText = $1 + processedText
|
||||
$3
|
||||
else
|
||||
processedText += text
|
||||
|
||||
BIN
common/static/images/info-icon.png
Normal file
BIN
common/static/images/info-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 302 B |
57
common/static/js/vendor/RequireJS.js
vendored
Normal file
57
common/static/js/vendor/RequireJS.js
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is a wrapper for the Require JS file and module loader. Please see
|
||||
* the discussion at:
|
||||
*
|
||||
* https://edx-wiki.atlassian.net/wiki/display/LMS/Integration+of+Require+JS+into+the+system
|
||||
*/
|
||||
|
||||
var RequireJS = function() {
|
||||
|
||||
// Below is the unmodified minified version of Require JS. The latest can be
|
||||
// found at:
|
||||
//
|
||||
// http://requirejs.org/docs/download.html
|
||||
|
||||
/*
|
||||
RequireJS 2.1.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
var requirejs,require,define;
|
||||
(function(Y){function H(b){return"[object Function]"===L.call(b)}function I(b){return"[object Array]"===L.call(b)}function x(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function M(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function r(b,c){return da.call(b,c)}function i(b,c){return r(b,c)&&b[c]}function E(b,c){for(var d in b)if(r(b,d)&&c(b[d],d))break}function Q(b,c,d,i){c&&E(c,function(c,h){if(d||!r(b,h))i&&"string"!==typeof c?(b[h]||(b[h]={}),Q(b[h],
|
||||
c,d,i)):b[h]=c});return b}function t(b,c){return function(){return c.apply(b,arguments)}}function Z(b){if(!b)return b;var c=Y;x(b.split("."),function(b){c=c[b]});return c}function J(b,c,d,i){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=i;d&&(c.originalError=d);return c}function ea(b){function c(a,g,v){var e,n,b,c,d,j,f,h=g&&g.split("/");e=h;var l=m.map,k=l&&l["*"];if(a&&"."===a.charAt(0))if(g){e=i(m.pkgs,g)?h=[g]:h.slice(0,h.length-1);g=a=e.concat(a.split("/"));
|
||||
for(e=0;g[e];e+=1)if(n=g[e],"."===n)g.splice(e,1),e-=1;else if(".."===n)if(1===e&&(".."===g[2]||".."===g[0]))break;else 0<e&&(g.splice(e-1,2),e-=2);e=i(m.pkgs,g=a[0]);a=a.join("/");e&&a===g+"/"+e.main&&(a=g)}else 0===a.indexOf("./")&&(a=a.substring(2));if(v&&(h||k)&&l){g=a.split("/");for(e=g.length;0<e;e-=1){b=g.slice(0,e).join("/");if(h)for(n=h.length;0<n;n-=1)if(v=i(l,h.slice(0,n).join("/")))if(v=i(v,b)){c=v;d=e;break}if(c)break;!j&&(k&&i(k,b))&&(j=i(k,b),f=e)}!c&&j&&(c=j,d=f);c&&(g.splice(0,d,
|
||||
c),a=g.join("/"))}return a}function d(a){z&&x(document.getElementsByTagName("script"),function(g){if(g.getAttribute("data-requiremodule")===a&&g.getAttribute("data-requirecontext")===j.contextName)return g.parentNode.removeChild(g),!0})}function y(a){var g=i(m.paths,a);if(g&&I(g)&&1<g.length)return d(a),g.shift(),j.require.undef(a),j.require([a]),!0}function f(a){var g,b=a?a.indexOf("!"):-1;-1<b&&(g=a.substring(0,b),a=a.substring(b+1,a.length));return[g,a]}function h(a,g,b,e){var n,u,d=null,h=g?g.name:
|
||||
null,l=a,m=!0,k="";a||(m=!1,a="_@r"+(L+=1));a=f(a);d=a[0];a=a[1];d&&(d=c(d,h,e),u=i(p,d));a&&(d?k=u&&u.normalize?u.normalize(a,function(a){return c(a,h,e)}):c(a,h,e):(k=c(a,h,e),a=f(k),d=a[0],k=a[1],b=!0,n=j.nameToUrl(k)));b=d&&!u&&!b?"_unnormalized"+(M+=1):"";return{prefix:d,name:k,parentMap:g,unnormalized:!!b,url:n,originalName:l,isDefine:m,id:(d?d+"!"+k:k)+b}}function q(a){var g=a.id,b=i(k,g);b||(b=k[g]=new j.Module(a));return b}function s(a,g,b){var e=a.id,n=i(k,e);if(r(p,e)&&(!n||n.defineEmitComplete))"defined"===
|
||||
g&&b(p[e]);else q(a).on(g,b)}function C(a,g){var b=a.requireModules,e=!1;if(g)g(a);else if(x(b,function(g){if(g=i(k,g))g.error=a,g.events.error&&(e=!0,g.emit("error",a))}),!e)l.onError(a)}function w(){R.length&&(fa.apply(F,[F.length-1,0].concat(R)),R=[])}function A(a,g,b){var e=a.map.id;a.error?a.emit("error",a.error):(g[e]=!0,x(a.depMaps,function(e,c){var d=e.id,h=i(k,d);h&&(!a.depMatched[c]&&!b[d])&&(i(g,d)?(a.defineDep(c,p[d]),a.check()):A(h,g,b))}),b[e]=!0)}function B(){var a,g,b,e,n=(b=1E3*m.waitSeconds)&&
|
||||
j.startTime+b<(new Date).getTime(),c=[],h=[],f=!1,l=!0;if(!T){T=!0;E(k,function(b){a=b.map;g=a.id;if(b.enabled&&(a.isDefine||h.push(b),!b.error))if(!b.inited&&n)y(g)?f=e=!0:(c.push(g),d(g));else if(!b.inited&&(b.fetched&&a.isDefine)&&(f=!0,!a.prefix))return l=!1});if(n&&c.length)return b=J("timeout","Load timeout for modules: "+c,null,c),b.contextName=j.contextName,C(b);l&&x(h,function(a){A(a,{},{})});if((!n||e)&&f)if((z||$)&&!U)U=setTimeout(function(){U=0;B()},50);T=!1}}function D(a){r(p,a[0])||
|
||||
q(h(a[0],null,!0)).init(a[1],a[2])}function G(a){var a=a.currentTarget||a.srcElement,b=j.onScriptLoad;a.detachEvent&&!V?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=j.onScriptError;(!a.detachEvent||V)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function K(){var a;for(w();F.length;){a=F.shift();if(null===a[0])return C(J("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));D(a)}}var T,W,j,N,U,m={waitSeconds:7,
|
||||
baseUrl:"./",paths:{},pkgs:{},shim:{},map:{},config:{}},k={},X={},F=[],p={},S={},L=1,M=1;N={require:function(a){return a.require?a.require:a.require=j.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=p[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return m.config&&i(m.config,a.map.id)||{}},exports:p[a.map.id]}}};W=function(a){this.events=i(X,a.id)||{};this.map=a;this.shim=
|
||||
i(m.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};W.prototype={init:function(a,b,c,e){e=e||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=t(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=e.ignore;e.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=
|
||||
b)},fetch:function(){if(!this.fetched){this.fetched=!0;j.startTime=(new Date).getTime();var a=this.map;if(this.shim)j.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],t(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;S[a]||(S[a]=!0,j.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var e=this.exports,n=this.factory;
|
||||
if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(H(n)){if(this.events.error)try{e=j.execCb(c,n,b,e)}catch(d){a=d}else e=j.execCb(c,n,b,e);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==this.exports?e=b.exports:void 0===e&&this.usingExports&&(e=this.exports));if(a)return a.requireMap=this.map,a.requireModules=[this.map.id],a.requireType="define",C(this.error=a)}else e=n;this.exports=e;if(this.map.isDefine&&
|
||||
!this.ignore&&(p[c]=e,l.onResourceLoad))l.onResourceLoad(j,this.map,this.depMaps);delete k[c];this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=h(a.prefix);this.depMaps.push(d);s(d,"defined",t(this,function(e){var n,d;d=this.map.name;var v=this.map.parentMap?this.map.parentMap.name:null,f=j.makeRequire(a.parentMap,{enableBuildCallback:!0,
|
||||
skipMap:!0});if(this.map.unnormalized){if(e.normalize&&(d=e.normalize(d,function(a){return c(a,v,!0)})||""),e=h(a.prefix+"!"+d,this.map.parentMap),s(e,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=i(k,e.id)){this.depMaps.push(e);if(this.events.error)d.on("error",t(this,function(a){this.emit("error",a)}));d.enable()}}else n=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),n.error=t(this,function(a){this.inited=!0;this.error=
|
||||
a;a.requireModules=[b];E(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&delete k[a.map.id]});C(a)}),n.fromText=t(this,function(e,c){var d=a.name,u=h(d),v=O;c&&(e=c);v&&(O=!1);q(u);r(m.config,b)&&(m.config[d]=m.config[b]);try{l.exec(e)}catch(k){throw Error("fromText eval for "+d+" failed: "+k);}v&&(O=!0);this.depMaps.push(u);j.completeLoad(d);f([d],n)}),e.load(a.name,f,n,m)}));j.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){this.enabling=this.enabled=!0;x(this.depMaps,t(this,function(a,
|
||||
b){var c,e;if("string"===typeof a){a=h(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=i(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",t(this,function(a){this.defineDep(b,a);this.check()}));this.errback&&s(a,"error",this.errback)}c=a.id;e=k[c];!r(N,c)&&(e&&!e.enabled)&&j.enable(a,this)}));E(this.pluginMaps,t(this,function(a){var b=i(k,a.id);b&&!b.enabled&&j.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=
|
||||
this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){x(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};j={config:m,contextName:b,registry:k,defined:p,urlFetched:S,defQueue:F,Module:W,makeModuleMap:h,nextTick:l.nextTick,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=m.pkgs,c=m.shim,e={paths:!0,config:!0,map:!0};E(a,function(a,b){e[b]?"map"===b?Q(m[b],a,!0,!0):Q(m[b],a,!0):m[b]=a});a.shim&&(E(a.shim,function(a,
|
||||
b){I(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=j.makeShimExports(a);c[b]=a}),m.shim=c);a.packages&&(x(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ga,"").replace(aa,"")}}),m.pkgs=b);E(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=h(b))});if(a.deps||a.callback)j.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(Y,arguments));
|
||||
return b||a.exports&&Z(a.exports)}},makeRequire:function(a,d){function f(e,c,u){var i,m;d.enableBuildCallback&&(c&&H(c))&&(c.__requireJsBuild=!0);if("string"===typeof e){if(H(c))return C(J("requireargs","Invalid require call"),u);if(a&&r(N,e))return N[e](k[a.id]);if(l.get)return l.get(j,e,a);i=h(e,a,!1,!0);i=i.id;return!r(p,i)?C(J("notloaded",'Module name "'+i+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[i]}K();j.nextTick(function(){K();m=q(h(null,a));m.skipMap=d.skipMap;
|
||||
m.init(e,c,u,{enabled:!0});B()});return f}d=d||{};Q(f,{isBrowser:z,toUrl:function(b){var d=b.lastIndexOf("."),g=null;-1!==d&&(g=b.substring(d,b.length),b=b.substring(0,d));return j.nameToUrl(c(b,a&&a.id,!0),g)},defined:function(b){return r(p,h(b,a,!1,!0).id)},specified:function(b){b=h(b,a,!1,!0).id;return r(p,b)||r(k,b)}});a||(f.undef=function(b){w();var c=h(b,a,!0),d=i(k,b);delete p[b];delete S[c.url];delete X[b];d&&(d.events.defined&&(X[b]=d.events),delete k[b])});return f},enable:function(a){i(k,
|
||||
a.id)&&q(a).enable()},completeLoad:function(a){var b,c,d=i(m.shim,a)||{},h=d.exports;for(w();F.length;){c=F.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);D(c)}c=i(k,a);if(!b&&!r(p,a)&&c&&!c.inited){if(m.enforceDefine&&(!h||!Z(h)))return y(a)?void 0:C(J("nodefine","No define call for "+a,null,[a]));D([a,d.deps||[],d.exportsFn])}B()},nameToUrl:function(a,b){var c,d,h,f,j,k;if(l.jsExtRegExp.test(a))f=a+(b||"");else{c=m.paths;d=m.pkgs;f=a.split("/");for(j=f.length;0<j;j-=1)if(k=
|
||||
f.slice(0,j).join("/"),h=i(d,k),k=i(c,k)){I(k)&&(k=k[0]);f.splice(0,j,k);break}else if(h){c=a===h.name?h.location+"/"+h.main:h.location;f.splice(0,j,c);break}f=f.join("/");f+=b||(/\?/.test(f)?"":".js");f=("/"===f.charAt(0)||f.match(/^[\w\+\.\-]+:/)?"":m.baseUrl)+f}return m.urlArgs?f+((-1===f.indexOf("?")?"?":"&")+m.urlArgs):f},load:function(a,b){l.load(j,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ha.test((a.currentTarget||a.srcElement).readyState))P=
|
||||
null,a=G(a),j.completeLoad(a.id)},onScriptError:function(a){var b=G(a);if(!y(b.id))return C(J("scripterror","Script error",a,[b.id]))}};j.require=j.makeRequire();return j}var l,w,A,D,s,G,P,K,ba,ca,ia=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ja=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,aa=/\.js$/,ga=/^\.\//;w=Object.prototype;var L=w.toString,da=w.hasOwnProperty,fa=Array.prototype.splice,z=!!("undefined"!==typeof window&&navigator&&document),$=!z&&"undefined"!==typeof importScripts,ha=z&&
|
||||
"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,V="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),B={},q={},R=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(H(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!H(require)&&(q=require,require=void 0);l=requirejs=function(b,c,d,y){var f,h="_";!I(b)&&"string"!==typeof b&&(f=b,I(c)?(b=c,c=d,d=y):b=[]);f&&f.context&&(h=f.context);(y=i(B,h))||(y=B[h]=l.s.newContext(h));
|
||||
f&&y.configure(f);return y.require(b,c,d)};l.config=function(b){return l(b)};l.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=l);l.version="2.1.2";l.jsExtRegExp=/^\/|:|\?|\.js$/;l.isBrowser=z;w=l.s={contexts:B,newContext:ea};l({});x(["toUrl","undef","defined","specified"],function(b){l[b]=function(){var c=B._;return c.require[b].apply(c,arguments)}});if(z&&(A=w.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))A=
|
||||
w.head=D.parentNode;l.onError=function(b){throw b;};l.load=function(b,c,d){var i=b&&b.config||{},f;if(z)return f=i.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),f.type=i.scriptType||"text/javascript",f.charset="utf-8",f.async=!0,f.setAttribute("data-requirecontext",b.contextName),f.setAttribute("data-requiremodule",c),f.attachEvent&&!(f.attachEvent.toString&&0>f.attachEvent.toString().indexOf("[native code"))&&!V?(O=!0,f.attachEvent("onreadystatechange",
|
||||
b.onScriptLoad)):(f.addEventListener("load",b.onScriptLoad,!1),f.addEventListener("error",b.onScriptError,!1)),f.src=d,K=f,D?A.insertBefore(f,D):A.appendChild(f),K=null,f;$&&(importScripts(d),b.completeLoad(c))};z&&M(document.getElementsByTagName("script"),function(b){A||(A=b.parentNode);if(s=b.getAttribute("data-main"))return q.baseUrl||(G=s.split("/"),ba=G.pop(),ca=G.length?G.join("/")+"/":"./",q.baseUrl=ca,s=ba),s=s.replace(aa,""),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var i,
|
||||
f;"string"!==typeof b&&(d=c,c=b,b=null);I(c)||(d=c,c=[]);!c.length&&H(d)&&d.length&&(d.toString().replace(ia,"").replace(ja,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c));if(O){if(!(i=K))P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),i=P;i&&(b||(b=i.getAttribute("data-requiremodule")),f=B[i.getAttribute("data-requirecontext")])}(f?f.defQueue:R).push([b,c,d])};define.amd=
|
||||
{jQuery:!0};l.exec=function(b){return eval(b)};l(q)}})(this);
|
||||
|
||||
// The object which will be globally available via RequireJS variable.
|
||||
return {
|
||||
'requirejs': requirejs,
|
||||
'require': require,
|
||||
'define': define
|
||||
};
|
||||
}(); // End-of: var RequireJS = function()
|
||||
@@ -1,18 +1,17 @@
|
||||
.ui-timepicker-list {
|
||||
overflow-y: auto;
|
||||
height: 150px;
|
||||
width: 7.5em;
|
||||
width: 6.5em;
|
||||
background: #fff;
|
||||
border: 1px solid #8891a1;
|
||||
border: 1px solid #ddd;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.1);
|
||||
-moz-box-shadow: 0 5px 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
|
||||
-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
box-shadow:0 5px 10px rgba(0,0,0,0.2);
|
||||
outline: none;
|
||||
z-index: 100001;
|
||||
font-size: 12px;
|
||||
z-index: 10001;
|
||||
}
|
||||
|
||||
.ui-timepicker-list.ui-timepicker-with-duration {
|
||||
|
||||
246
common/static/js/vendor/timepicker/jquery.timepicker.js
vendored
Executable file → Normal file
246
common/static/js/vendor/timepicker/jquery.timepicker.js
vendored
Executable file → Normal file
@@ -2,16 +2,22 @@
|
||||
jquery-timepicker
|
||||
http://jonthornton.github.com/jquery-timepicker/
|
||||
|
||||
requires jQuery 1.6+
|
||||
|
||||
version: 1.2.2
|
||||
requires jQuery 1.7+
|
||||
************************/
|
||||
|
||||
|
||||
!(function($)
|
||||
{
|
||||
var _baseDate = new Date(); _baseDate.setHours(0); _baseDate.setMinutes(0); _baseDate.setSeconds(0);
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
var _baseDate = _generateBaseDate();
|
||||
var _ONE_DAY = 86400;
|
||||
var _closeEvent = 'ontouchstart' in document ? 'touchstart' : 'mousedown';
|
||||
var _defaults = {
|
||||
className: null,
|
||||
minTime: null,
|
||||
@@ -22,7 +28,9 @@ version: 1.2.2
|
||||
timeFormat: 'g:ia',
|
||||
scrollDefaultNow: false,
|
||||
scrollDefaultTime: false,
|
||||
selectOnBlur: false
|
||||
selectOnBlur: false,
|
||||
forceRoundTime: false,
|
||||
appendTo: 'body'
|
||||
};
|
||||
var _lang = {
|
||||
decimal: '.',
|
||||
@@ -30,6 +38,7 @@ version: 1.2.2
|
||||
hr: 'hr',
|
||||
hrs: 'hrs'
|
||||
};
|
||||
var globalInit = false;
|
||||
|
||||
var methods =
|
||||
{
|
||||
@@ -78,31 +87,45 @@ version: 1.2.2
|
||||
|
||||
self.data('timepicker-settings', settings);
|
||||
self.attr('autocomplete', 'off');
|
||||
self.click(methods.show).focus(methods.show).blur(_formatValue).keydown(_keyhandler);
|
||||
self.on('click.timepicker focus.timepicker', methods.show);
|
||||
self.on('blur.timepicker', _formatValue);
|
||||
self.on('keydown.timepicker', _keyhandler);
|
||||
self.addClass('ui-timepicker-input');
|
||||
|
||||
if (self.val()) {
|
||||
var prettyTime = _int2time(_time2int(self.val()), settings.timeFormat);
|
||||
self.val(prettyTime);
|
||||
_formatValue.call(self.get(0));
|
||||
|
||||
if (!globalInit) {
|
||||
// close the dropdown when container loses focus
|
||||
$('body').on(_closeEvent, function(e) {
|
||||
var target = $(e.target);
|
||||
var input = target.closest('.ui-timepicker-input');
|
||||
if (input.length === 0 && target.closest('.ui-timepicker-list').length === 0) {
|
||||
methods.hide();
|
||||
}
|
||||
});
|
||||
globalInit = true;
|
||||
}
|
||||
|
||||
// close the dropdown when container loses focus
|
||||
$("body").attr("tabindex", -1).focusin(function(e) {
|
||||
if ($(e.target).closest('.ui-timepicker-input').length == 0 && $(e.target).closest('.ui-timepicker-list').length == 0) {
|
||||
methods.hide();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
show: function(e)
|
||||
{
|
||||
var self = $(this);
|
||||
|
||||
if ('ontouchstart' in document) {
|
||||
// block the keyboard on mobile devices
|
||||
self.blur();
|
||||
}
|
||||
|
||||
var list = self.data('timepicker-list');
|
||||
|
||||
// check if input is readonly
|
||||
if (self.attr('readonly')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// check if list needs to be rendered
|
||||
if (!list || list.length == 0) {
|
||||
if (!list || list.length === 0) {
|
||||
_render(self);
|
||||
list = self.data('timepicker-list');
|
||||
}
|
||||
@@ -121,16 +144,12 @@ version: 1.2.2
|
||||
// make sure other pickers are hidden
|
||||
methods.hide();
|
||||
|
||||
|
||||
var topMargin = parseInt(self.css('marginTop').slice(0, -2));
|
||||
if (!topMargin) topMargin = 0; // correct for IE returning "auto"
|
||||
|
||||
if ((self.offset().top + self.outerHeight(true) + list.outerHeight()) > $(window).height() + $(window).scrollTop()) {
|
||||
// position the dropdown on top
|
||||
list.css({ 'left':(self.offset().left), 'top': self.offset().top + topMargin - list.outerHeight() });
|
||||
list.css({ 'left':(self.offset().left), 'top': self.offset().top - list.outerHeight() });
|
||||
} else {
|
||||
// put it under the input
|
||||
list.css({ 'left':(self.offset().left), 'top': self.offset().top + topMargin + self.outerHeight() });
|
||||
list.css({ 'left':(self.offset().left), 'top': self.offset().top + self.outerHeight() });
|
||||
}
|
||||
|
||||
list.show();
|
||||
@@ -140,13 +159,13 @@ version: 1.2.2
|
||||
var selected = list.find('.ui-timepicker-selected');
|
||||
|
||||
if (!selected.length) {
|
||||
if (self.val()) {
|
||||
selected = _findRow(self, list, _time2int(self.val()));
|
||||
} else if (settings.minTime === null && settings.scrollDefaultNow) {
|
||||
selected = _findRow(self, list, _time2int(new Date()));
|
||||
} else if (settings.scrollDefaultTime !== false) {
|
||||
selected = _findRow(self, list, _time2int(settings.scrollDefaultTime));
|
||||
}
|
||||
if (self.val()) {
|
||||
selected = _findRow(self, list, _time2int(self.val()));
|
||||
} else if (settings.scrollDefaultNow) {
|
||||
selected = _findRow(self, list, _time2int(new Date()));
|
||||
} else if (settings.scrollDefaultTime !== false) {
|
||||
selected = _findRow(self, list, _time2int(settings.scrollDefaultTime));
|
||||
}
|
||||
}
|
||||
|
||||
if (selected && selected.length) {
|
||||
@@ -165,7 +184,8 @@ version: 1.2.2
|
||||
var list = $(this);
|
||||
var self = list.data('timepicker-input');
|
||||
var settings = self.data('timepicker-settings');
|
||||
if (settings.selectOnBlur) {
|
||||
|
||||
if (settings && settings.selectOnBlur) {
|
||||
_selectValue(self);
|
||||
}
|
||||
|
||||
@@ -226,8 +246,29 @@ version: 1.2.2
|
||||
var self = $(this);
|
||||
var prettyTime = _int2time(_time2int(value), self.data('timepicker-settings').timeFormat);
|
||||
self.val(prettyTime);
|
||||
}
|
||||
},
|
||||
|
||||
remove: function()
|
||||
{
|
||||
var self = $(this);
|
||||
|
||||
// check if this element is a timepicker
|
||||
if (!self.hasClass('ui-timepicker-input')) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.removeAttr('autocomplete', 'off');
|
||||
self.removeClass('ui-timepicker-input');
|
||||
self.removeData('timepicker-settings');
|
||||
self.off('.timepicker');
|
||||
|
||||
// timepicker-list won't be present unless the user has interacted with this timepicker
|
||||
if (self.data('timepicker-list')) {
|
||||
self.data('timepicker-list').remove();
|
||||
}
|
||||
|
||||
self.removeData('timepicker-list');
|
||||
}
|
||||
};
|
||||
|
||||
// private methods
|
||||
@@ -251,7 +292,7 @@ version: 1.2.2
|
||||
|
||||
list.css({'display':'none', 'position': 'absolute' });
|
||||
|
||||
if (settings.minTime !== null && settings.showDuration) {
|
||||
if ((settings.minTime !== null || settings.durationTime !== null) && settings.showDuration) {
|
||||
list.addClass('ui-timepicker-with-duration');
|
||||
}
|
||||
|
||||
@@ -267,14 +308,14 @@ version: 1.2.2
|
||||
for (var i=start; i <= end; i += settings.step*60) {
|
||||
var timeInt = i%_ONE_DAY;
|
||||
var row = $('<li />');
|
||||
row.data('time', timeInt)
|
||||
row.data('time', timeInt);
|
||||
row.text(_int2time(timeInt, settings.timeFormat));
|
||||
|
||||
if (settings.minTime !== null && settings.showDuration) {
|
||||
if ((settings.minTime !== null || settings.durationTime !== null) && settings.showDuration) {
|
||||
var duration = $('<span />');
|
||||
duration.addClass('ui-timepicker-duration');
|
||||
duration.text(' ('+_int2duration(i - durStart)+')');
|
||||
row.append(duration)
|
||||
row.append(duration);
|
||||
}
|
||||
|
||||
list.append(row);
|
||||
@@ -283,10 +324,16 @@ version: 1.2.2
|
||||
list.data('timepicker-input', self);
|
||||
self.data('timepicker-list', list);
|
||||
|
||||
$('body').append(list);
|
||||
var appendTo = settings.appendTo;
|
||||
if (typeof appendTo === 'string') {
|
||||
appendTo = $(appendTo);
|
||||
} else if (typeof appendTo === 'function') {
|
||||
appendTo = appendTo(self);
|
||||
}
|
||||
appendTo.append(list);
|
||||
_setSelected(self, list);
|
||||
|
||||
list.delegate('li', 'click', { 'timepicker': self }, function(e) {
|
||||
list.on('click', 'li', function(e) {
|
||||
self.addClass('ui-timepicker-hideme');
|
||||
self[0].focus();
|
||||
|
||||
@@ -297,7 +344,17 @@ version: 1.2.2
|
||||
_selectValue(self);
|
||||
list.hide();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function _generateBaseDate()
|
||||
{
|
||||
var _baseDate = new Date();
|
||||
var _currentTimezoneOffset = _baseDate.getTimezoneOffset()*60000;
|
||||
_baseDate.setHours(0); _baseDate.setMinutes(0); _baseDate.setSeconds(0);
|
||||
var _baseDateTimezoneOffset = _baseDate.getTimezoneOffset()*60000;
|
||||
|
||||
return new Date(_baseDate.valueOf() - _baseDateTimezoneOffset + _currentTimezoneOffset);
|
||||
}
|
||||
|
||||
function _findRow(self, list, value)
|
||||
{
|
||||
@@ -307,13 +364,16 @@ version: 1.2.2
|
||||
|
||||
var settings = self.data('timepicker-settings');
|
||||
var out = false;
|
||||
var halfStep = settings.step*30;
|
||||
|
||||
// loop through the menu items
|
||||
list.find('li').each(function(i, obj) {
|
||||
var jObj = $(obj);
|
||||
|
||||
var offset = jObj.data('time') - value;
|
||||
|
||||
// check if the value is less than half a step from each row
|
||||
if (Math.abs(jObj.data('time') - value) <= settings.step*30) {
|
||||
if (Math.abs(offset) < halfStep || offset == halfStep) {
|
||||
out = jObj;
|
||||
return false;
|
||||
}
|
||||
@@ -333,12 +393,33 @@ version: 1.2.2
|
||||
|
||||
function _formatValue()
|
||||
{
|
||||
if (this.value == '') {
|
||||
if (this.value === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = $(this);
|
||||
var prettyTime = _int2time(_time2int(this.value), self.data('timepicker-settings').timeFormat);
|
||||
var seconds = _time2int(this.value);
|
||||
|
||||
if (seconds === null) {
|
||||
self.trigger('timeFormatError');
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = self.data('timepicker-settings');
|
||||
|
||||
if (settings.forceRoundTime) {
|
||||
var offset = seconds % (settings.step*60); // step is in minutes
|
||||
|
||||
if (offset >= settings.step*30) {
|
||||
// if offset is larger than a half step, round up
|
||||
seconds += (settings.step*60) - offset;
|
||||
} else {
|
||||
// round down
|
||||
seconds -= offset;
|
||||
}
|
||||
}
|
||||
|
||||
var prettyTime = _int2time(seconds, settings.timeFormat);
|
||||
self.val(prettyTime);
|
||||
}
|
||||
|
||||
@@ -353,7 +434,7 @@ version: 1.2.2
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
switch (e.keyCode) {
|
||||
|
||||
@@ -362,13 +443,11 @@ version: 1.2.2
|
||||
methods.hide.apply(this);
|
||||
e.preventDefault();
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 38: // up
|
||||
var selected = list.find('.ui-timepicker-selected');
|
||||
|
||||
if (!selected.length) {
|
||||
var selected;
|
||||
list.children().each(function(i, obj) {
|
||||
if ($(obj).position().top > 0) {
|
||||
selected = $(obj);
|
||||
@@ -389,10 +468,9 @@ version: 1.2.2
|
||||
break;
|
||||
|
||||
case 40: // down
|
||||
var selected = list.find('.ui-timepicker-selected');
|
||||
selected = list.find('.ui-timepicker-selected');
|
||||
|
||||
if (selected.length == 0) {
|
||||
var selected;
|
||||
if (selected.length === 0) {
|
||||
list.children().each(function(i, obj) {
|
||||
if ($(obj).position().top > 0) {
|
||||
selected = $(obj);
|
||||
@@ -417,7 +495,10 @@ version: 1.2.2
|
||||
list.hide();
|
||||
break;
|
||||
|
||||
case 9:
|
||||
case 9: //tab
|
||||
methods.hide();
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
@@ -436,11 +517,11 @@ version: 1.2.2
|
||||
list.find('li').removeClass('ui-timepicker-selected');
|
||||
return;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function _selectValue(self)
|
||||
{
|
||||
var settings = self.data('timepicker-settings')
|
||||
var settings = self.data('timepicker-settings');
|
||||
var list = self.data('timepicker-list');
|
||||
var timeValue = null;
|
||||
|
||||
@@ -448,12 +529,12 @@ version: 1.2.2
|
||||
|
||||
if (cursor.length) {
|
||||
// selected value found
|
||||
var timeValue = cursor.data('time');
|
||||
timeValue = cursor.data('time');
|
||||
|
||||
} else if (self.val()) {
|
||||
|
||||
// no selected value; fall back on input value
|
||||
var timeValue = _time2int(self.val());
|
||||
timeValue = _time2int(self.val());
|
||||
|
||||
_setSelected(self, list);
|
||||
}
|
||||
@@ -464,14 +545,14 @@ version: 1.2.2
|
||||
}
|
||||
|
||||
self.trigger('change').trigger('changeTime');
|
||||
};
|
||||
}
|
||||
|
||||
function _int2duration(seconds)
|
||||
{
|
||||
var minutes = Math.round(seconds/60);
|
||||
var duration;
|
||||
|
||||
if (minutes < 60) {
|
||||
if (Math.abs(minutes) < 60) {
|
||||
duration = [minutes, _lang.mins];
|
||||
} else if (minutes == 60) {
|
||||
duration = ['1', _lang.hr];
|
||||
@@ -482,16 +563,21 @@ version: 1.2.2
|
||||
}
|
||||
|
||||
return duration.join(' ');
|
||||
};
|
||||
}
|
||||
|
||||
function _int2time(seconds, format)
|
||||
{
|
||||
if (seconds === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var time = new Date(_baseDate.valueOf() + (seconds*1000));
|
||||
var output = '';
|
||||
var hour, code;
|
||||
|
||||
for (var i=0; i<format.length; i++) {
|
||||
|
||||
var code = format.charAt(i);
|
||||
code = format.charAt(i);
|
||||
switch (code) {
|
||||
|
||||
case 'a':
|
||||
@@ -503,8 +589,8 @@ version: 1.2.2
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
var hour = time.getHours() % 12;
|
||||
output += (hour == 0) ? '12' : hour;
|
||||
hour = time.getHours() % 12;
|
||||
output += (hour === 0) ? '12' : hour;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
@@ -512,17 +598,17 @@ version: 1.2.2
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
var hour = time.getHours() % 12;
|
||||
hour = time.getHours() % 12;
|
||||
|
||||
if (hour != 0 && hour < 10) {
|
||||
if (hour !== 0 && hour < 10) {
|
||||
hour = '0'+hour;
|
||||
}
|
||||
|
||||
output += (hour == 0) ? '12' : hour;
|
||||
output += (hour === 0) ? '12' : hour;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
var hour = time.getHours();
|
||||
hour = time.getHours();
|
||||
output += (hour > 9) ? hour : '0'+hour;
|
||||
break;
|
||||
|
||||
@@ -532,7 +618,7 @@ version: 1.2.2
|
||||
break;
|
||||
|
||||
case 's':
|
||||
var seconds = time.getSeconds();
|
||||
seconds = time.getSeconds();
|
||||
output += (seconds > 9) ? seconds : '0'+seconds;
|
||||
break;
|
||||
|
||||
@@ -542,40 +628,42 @@ version: 1.2.2
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
function _time2int(timeString)
|
||||
{
|
||||
if (timeString == '') return null;
|
||||
if (timeString === '') return null;
|
||||
if (timeString+0 == timeString) return timeString;
|
||||
|
||||
if (typeof(timeString) == 'object') {
|
||||
timeString = timeString.getHours()+':'+timeString.getMinutes();
|
||||
timeString = timeString.getHours()+':'+timeString.getMinutes()+':'+timeString.getSeconds();
|
||||
}
|
||||
|
||||
var d = new Date(0);
|
||||
var time = timeString.toLowerCase().match(/(\d+)(?::(\d\d))?\s*([pa]?)/);
|
||||
var time = timeString.toLowerCase().match(/(\d{1,2})(?::(\d{1,2}))?(?::(\d{2}))?\s*([pa]?)/);
|
||||
|
||||
if (!time) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var hour = parseInt(time[1]*1);
|
||||
var hour = parseInt(time[1]*1, 10);
|
||||
var hours;
|
||||
|
||||
if (time[3]) {
|
||||
if (time[4]) {
|
||||
if (hour == 12) {
|
||||
var hours = (time[3] == 'p') ? 12 : 0;
|
||||
hours = (time[4] == 'p') ? 12 : 0;
|
||||
} else {
|
||||
var hours = (hour + (time[3] == 'p' ? 12 : 0));
|
||||
hours = (hour + (time[4] == 'p' ? 12 : 0));
|
||||
}
|
||||
|
||||
} else {
|
||||
var hours = hour;
|
||||
hours = hour;
|
||||
}
|
||||
|
||||
var minutes = ( time[2]*1 || 0 );
|
||||
return hours*3600 + minutes*60;
|
||||
};
|
||||
var seconds = ( time[3]*1 || 0 );
|
||||
return hours*3600 + minutes*60 + seconds;
|
||||
}
|
||||
|
||||
// Plugin entry
|
||||
$.fn.timepicker = function(method)
|
||||
@@ -584,4 +672,4 @@ version: 1.2.2
|
||||
else if(typeof method === "object" || !method) { return methods.init.apply(this, arguments); }
|
||||
else { $.error("Method "+ method + " does not exist on jQuery.timepicker"); }
|
||||
};
|
||||
})(jQuery);
|
||||
}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,5 +2,5 @@
|
||||
// content-box | border-box | inherit
|
||||
-webkit-box-sizing: $box;
|
||||
-moz-box-sizing: $box;
|
||||
box-sizing: $box;
|
||||
box-sizing: $box; *behavior: url(/static/scripts/boxsizing.htc);
|
||||
}
|
||||
|
||||
504
common/static/scripts/boxsizing.htc
Normal file
504
common/static/scripts/boxsizing.htc
Normal file
@@ -0,0 +1,504 @@
|
||||
/**
|
||||
* box-sizing Polyfill
|
||||
*
|
||||
* A polyfill for box-sizing: border-box for IE6 & IE7.
|
||||
*
|
||||
* JScript
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* See <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*
|
||||
* @category JScript
|
||||
* @package box-sizing-polyfill
|
||||
* @author Christian Schepp Schaefer <schaepp@gmx.de> <http://twitter.com/derSchepp>
|
||||
* @copyright 2012 Christian Schepp Schaefer
|
||||
* @license http://www.gnu.org/copyleft/lesser.html The GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0
|
||||
* @link http://github.com/Schepp/box-sizing-polyfill
|
||||
*
|
||||
* PREFACE:
|
||||
*
|
||||
* This box-sizing polyfill is based on previous work done by Erik Arvidsson,
|
||||
* which he published in 2002 on http://webfx.eae.net/dhtml/boxsizing/boxsizing.html.
|
||||
*
|
||||
* USAGE:
|
||||
*
|
||||
* Add the behavior/HTC after every `box-sizing: border-box;` that you assign:
|
||||
*
|
||||
* box-sizing: border-box;
|
||||
* *behavior: url(/scripts/boxsizing.htc);`
|
||||
*
|
||||
* Prefix the `behavior` property with a star, like seen above, so it will only be seen by
|
||||
* IE6 & IE7, not by IE8+ who already implement box-sizing.
|
||||
*
|
||||
* The URL to the HTC file must be relative to your HTML(!) document, not relative to your CSS.
|
||||
* That's why I'd advise you to use absolute paths like in the example.
|
||||
*
|
||||
*/
|
||||
<component lightWeight="true">
|
||||
<attach event="onpropertychange" onevent="checkPropertyChange()" />
|
||||
<attach event="ondetach" onevent="restore()" />
|
||||
<attach event="onresize" for="window" onevent="update()" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
var viewportwidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : element.document.documentElement.clientWidth);
|
||||
|
||||
// Shortcut for the document object
|
||||
var doc = element.document;
|
||||
|
||||
// Buffer for multiple resize events
|
||||
var resizetimeout = null;
|
||||
|
||||
// Don't apply box-sizing to certain elements
|
||||
var apply = false;
|
||||
switch(element.nodeName){
|
||||
case '#comment':
|
||||
case 'HTML':
|
||||
case 'HEAD':
|
||||
case 'TITLE':
|
||||
case 'SCRIPT':
|
||||
case 'STYLE':
|
||||
case 'LINK':
|
||||
case 'META':
|
||||
break;
|
||||
|
||||
default:
|
||||
apply = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* update gets called during resize events, then waits until there are no further resize events, and finally triggers a recalculation
|
||||
*/
|
||||
function update(){
|
||||
if(resizetimeout !== null){
|
||||
window.clearTimeout(resizetimeout);
|
||||
}
|
||||
resizetimeout = window.setTimeout(function(){
|
||||
restore();
|
||||
try {
|
||||
init();
|
||||
}
|
||||
catch (err) {}
|
||||
resizetimeout = null;
|
||||
},100);
|
||||
}
|
||||
|
||||
/*
|
||||
* restore gets called when the behavior is being detached (see event binding at the top),
|
||||
* resets everything like it was before applying the behavior
|
||||
*/
|
||||
function restore(){
|
||||
if(apply){
|
||||
try{
|
||||
element.runtimeStyle.removeAttribute("width");
|
||||
element.runtimeStyle.removeAttribute("height");
|
||||
}
|
||||
catch(e){}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* init gets called once at the start and then never again,
|
||||
* triggers box-sizing calculations and updates width and height
|
||||
*/
|
||||
function init(){
|
||||
if(apply){
|
||||
updateBorderBoxWidth();
|
||||
updateBorderBoxHeight();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* checkPropertyChange gets called as soon as an element property changes
|
||||
* (see event binding at the top), it then checks if any property influencing its
|
||||
* dimensions was changed and if yes recalculates width and height
|
||||
*/
|
||||
function checkPropertyChange(){
|
||||
if(apply){
|
||||
var pn = event.propertyName;
|
||||
if(pn === "style.boxSizing" && element.style.boxSizing === ""){
|
||||
element.style.removeAttribute("boxSizing");
|
||||
element.runtimeStyle.removeAttribute("boxSizing");
|
||||
element.runtimeStyle.removeAttribute("width");
|
||||
element.runtimeStyle.removeAttribute("height");
|
||||
}
|
||||
switch (pn){
|
||||
case "style.width":
|
||||
case "style.minWidth":
|
||||
case "style.maxWidth":
|
||||
case "style.borderLeftWidth":
|
||||
case "style.borderLeftStyle":
|
||||
case "style.borderRightWidth":
|
||||
case "style.borderRightStyle":
|
||||
case "style.paddingLeft":
|
||||
case "style.paddingRight":
|
||||
updateBorderBoxWidth();
|
||||
break;
|
||||
|
||||
case "style.height":
|
||||
case "style.minHeight":
|
||||
case "style.maxHeight":
|
||||
case "style.borderTopWidth":
|
||||
case "style.borderTopStyle":
|
||||
case "style.borderBottomWidth":
|
||||
case "style.borderBottomStyle":
|
||||
case "style.paddingTop":
|
||||
case "style.paddingBottom":
|
||||
updateBorderBoxHeight();
|
||||
break;
|
||||
|
||||
case "className":
|
||||
case "style.boxSizing":
|
||||
updateBorderBoxWidth();
|
||||
updateBorderBoxHeight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function, taken from Dean Edward's IE7 framework,
|
||||
* added by Schepp on 12.06.2010.
|
||||
* http://code.google.com/p/ie7-js/
|
||||
*
|
||||
* Allows us to convert from relative to pixel-values.
|
||||
*/
|
||||
function getPixelValue(value){
|
||||
var PIXEL = /^\d+(px)?$/i;
|
||||
if (PIXEL.test(value)) return parseInt(value);
|
||||
var style = element.style.left;
|
||||
var runtimeStyle = element.runtimeStyle.left;
|
||||
element.runtimeStyle.left = element.currentStyle.left;
|
||||
element.style.left = value || 0;
|
||||
value = parseInt(element.style.pixelLeft);
|
||||
element.style.left = style;
|
||||
element.runtimeStyle.left = runtimeStyle;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function getPixelWidth(object, value){
|
||||
// For Pixel Values
|
||||
var PIXEL = /^\d+(px)?$/i;
|
||||
if (PIXEL.test(value)) return parseInt(value);
|
||||
|
||||
// For Percentage Values
|
||||
var PERCENT = /^[\d\.]+%$/i;
|
||||
if (PERCENT.test(value)){
|
||||
try{
|
||||
var parentPaddingLeft = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingLeft);
|
||||
var parentPaddingRight = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingRight);
|
||||
var parentBorderLeft = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderLeft);
|
||||
var parentBorderRight = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderRight);
|
||||
|
||||
//var parentWidth = getPixelWidth(object.parentElement,(object.parentElement.currentStyle.width != "auto" ? object.parentElement.currentStyle.width : "100%"));
|
||||
var parentWidth = object.parentElement.offsetWidth - parentPaddingLeft - parentPaddingRight - parentBorderLeft - parentBorderRight;
|
||||
var value = (parseFloat(value) / 100) * parentWidth;
|
||||
}
|
||||
catch(e){
|
||||
var value = (parseFloat(value) / 100) * element.document.documentElement.clientWidth;
|
||||
}
|
||||
return parseInt(value);
|
||||
}
|
||||
|
||||
// For EM Values
|
||||
var style = object.style.left;
|
||||
var runtimeStyle = object.runtimeStyle.left;
|
||||
object.runtimeStyle.left = object.currentStyle.left;
|
||||
object.style.left = value || 0;
|
||||
value = parseInt(object.style.pixelLeft);
|
||||
object.style.left = style;
|
||||
object.runtimeStyle.left = runtimeStyle;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function getPixelHeight(object, value){
|
||||
// For Pixel Values
|
||||
var PIXEL = /^\d+(px)?$/i;
|
||||
if (PIXEL.test(value)) return parseInt(value);
|
||||
|
||||
// For Percentage Values
|
||||
var PERCENT = /^[\d\.]+%$/i;
|
||||
if (PERCENT.test(value)){
|
||||
try{
|
||||
if(object.parentElement.currentStyle.height != "auto"){
|
||||
switch(object.parentElement.nodeName){
|
||||
default:
|
||||
if(object.parentElement.currentStyle.height !== "auto"){
|
||||
var parentPaddingTop = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingTop);
|
||||
var parentPaddingBottom = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingBottom);
|
||||
var parentBorderTop = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderTop);
|
||||
var parentBorderBottom = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderBottom);
|
||||
|
||||
var parentHeight = object.parentElement.offsetHeight - parentPaddingTop - parentPaddingBottom - parentBorderTop - parentBorderBottom;
|
||||
//var parentHeight = getPixelHeight(object.parentElement,object.parentElement.currentStyle.height);
|
||||
|
||||
value = (parseFloat(value) / 100) * parentHeight;
|
||||
}
|
||||
else {
|
||||
value = "auto";
|
||||
}
|
||||
break;
|
||||
|
||||
case 'HTML':
|
||||
parentHeight = element.document.documentElement.clientHeight;
|
||||
if(parentHeight !== "auto"){
|
||||
value = (parseFloat(value) / 100) * parentHeight;
|
||||
}
|
||||
else {
|
||||
value = "auto";
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(value !== "auto") value = parseInt(value);
|
||||
}
|
||||
else {
|
||||
value = "auto";
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
value = "auto";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// For EM Values
|
||||
var style = object.style.left;
|
||||
var runtimeStyle = object.runtimeStyle.left;
|
||||
object.runtimeStyle.left = object.currentStyle.left;
|
||||
object.style.left = value || 0;
|
||||
value = parseInt(object.style.pixelLeft);
|
||||
object.style.left = style;
|
||||
object.runtimeStyle.left = runtimeStyle;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* getBorderWidth & friends
|
||||
* Border width getters
|
||||
*/
|
||||
function getBorderWidth(sSide){
|
||||
if(element.currentStyle["border" + sSide + "Style"] == "none"){
|
||||
return 0;
|
||||
}
|
||||
var n = getPixelValue(element.currentStyle["border" + sSide + "Width"]);
|
||||
return n || 0;
|
||||
}
|
||||
function getBorderLeftWidth() { return getBorderWidth("Left"); }
|
||||
function getBorderRightWidth() { return getBorderWidth("Right"); }
|
||||
function getBorderTopWidth() { return getBorderWidth("Top"); }
|
||||
function getBorderBottomWidth() { return getBorderWidth("Bottom"); }
|
||||
|
||||
|
||||
/*
|
||||
* getPadding & friends
|
||||
* Padding width getters
|
||||
*/
|
||||
function getPadding(sSide) {
|
||||
var n = getPixelValue(element.currentStyle["padding" + sSide]);
|
||||
return n || 0;
|
||||
}
|
||||
function getPaddingLeft() { return getPadding("Left"); }
|
||||
function getPaddingRight() { return getPadding("Right"); }
|
||||
function getPaddingTop() { return getPadding("Top"); }
|
||||
function getPaddingBottom() { return getPadding("Bottom"); }
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* getBoxSizing
|
||||
* Get the box-sizing value for the current element
|
||||
*/
|
||||
function getBoxSizing(){
|
||||
var s = element.style;
|
||||
var cs = element.currentStyle
|
||||
if(typeof s.boxSizing != "undefined" && s.boxSizing != ""){
|
||||
return s.boxSizing;
|
||||
}
|
||||
if(typeof s["box-sizing"] != "undefined" && s["box-sizing"] != ""){
|
||||
return s["box-sizing"];
|
||||
}
|
||||
if(typeof cs.boxSizing != "undefined" && cs.boxSizing != ""){
|
||||
return cs.boxSizing;
|
||||
}
|
||||
if(typeof cs["box-sizing"] != "undefined" && cs["box-sizing"] != ""){
|
||||
return cs["box-sizing"];
|
||||
}
|
||||
return getDocumentBoxSizing();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* getDocumentBoxSizing
|
||||
* Get the default document box sizing (check for quirks mode)
|
||||
*/
|
||||
function getDocumentBoxSizing(){
|
||||
if(doc.compatMode === null || doc.compatMode === "BackCompat"){
|
||||
return "border-box";
|
||||
}
|
||||
return "content-box"
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* setBorderBoxWidth & friends
|
||||
* Width and height setters
|
||||
*/
|
||||
function setBorderBoxWidth(n){
|
||||
element.runtimeStyle.width = Math.max(0, n - getBorderLeftWidth() -
|
||||
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setBorderBoxMinWidth(n){
|
||||
element.runtimeStyle.minWidth = Math.max(0, n - getBorderLeftWidth() -
|
||||
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setBorderBoxMaxWidth(n){
|
||||
element.runtimeStyle.maxWidth = Math.max(0, n - getBorderLeftWidth() -
|
||||
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setBorderBoxHeight(n){
|
||||
element.runtimeStyle.height = Math.max(0, n - getBorderTopWidth() -
|
||||
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
||||
}
|
||||
function setBorderBoxMinHeight(n){
|
||||
element.runtimeStyle.minHeight = Math.max(0, n - getBorderTopWidth() -
|
||||
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
||||
}
|
||||
function setBorderBoxMaxHeight(n){
|
||||
element.runtimeStyle.maxHeight = Math.max(0, n - getBorderTopWidth() -
|
||||
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
||||
}
|
||||
function setContentBoxWidth(n){
|
||||
element.runtimeStyle.width = Math.max(0, n + getBorderLeftWidth() +
|
||||
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setContentBoxMinWidth(n){
|
||||
element.runtimeStyle.minWidth = Math.max(0, n + getBorderLeftWidth() +
|
||||
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setContentBoxMaxWidth(n){
|
||||
element.runtimeStyle.maxWidth = Math.max(0, n + getBorderLeftWidth() +
|
||||
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
||||
}
|
||||
function setContentBoxHeight(n){
|
||||
element.runtimeStyle.height = Math.max(0, n + getBorderTopWidth() +
|
||||
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
||||
}
|
||||
function setContentBoxMinHeight(n){
|
||||
element.runtimeStyle.minHeight = Math.max(0, n + getBorderTopWidth() +
|
||||
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
||||
}
|
||||
function setContentBoxMaxHeight(n){
|
||||
element.runtimeStyle.maxHeight = Math.max(0, n + getBorderTopWidth() +
|
||||
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* updateBorderBoxWidth & updateBorderBoxHeight
|
||||
*
|
||||
*/
|
||||
function updateBorderBoxWidth() {
|
||||
if(getDocumentBoxSizing() == getBoxSizing()){
|
||||
return;
|
||||
}
|
||||
|
||||
var csw = element.currentStyle.width;
|
||||
if(csw != "auto"){
|
||||
csw = getPixelWidth(element,csw);
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxWidth(parseInt(csw));
|
||||
}
|
||||
else{
|
||||
setContentBoxWidth(parseInt(csw));
|
||||
}
|
||||
}
|
||||
|
||||
csw = element.currentStyle.minWidth;
|
||||
if(csw != "none"){
|
||||
csw = getPixelWidth(element,csw);
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxMinWidth(parseInt(csw));
|
||||
}
|
||||
else{
|
||||
setContentBoxMinWidth(parseInt(csw));
|
||||
}
|
||||
}
|
||||
|
||||
csw = element.currentStyle.maxWidth;
|
||||
if(csw != "none"){
|
||||
csw = getPixelWidth(element,csw);
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxMaxWidth(parseInt(csw));
|
||||
}
|
||||
else{
|
||||
setContentBoxMaxWidth(parseInt(csw));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateBorderBoxHeight() {
|
||||
if(getDocumentBoxSizing() == getBoxSizing()){
|
||||
return;
|
||||
}
|
||||
|
||||
var csh = element.currentStyle.height;
|
||||
if(csh != "auto"){
|
||||
csh = getPixelHeight(element,csh);
|
||||
if(csh !== "auto"){
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxHeight(parseInt(csh));
|
||||
}
|
||||
else{
|
||||
setContentBoxHeight(parseInt(csh));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
csh = element.currentStyle.minHeight;
|
||||
if(csh != "none"){
|
||||
csh = getPixelHeight(element,csh);
|
||||
if(csh !== "none"){
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxMinHeight(parseInt(csh));
|
||||
}
|
||||
else{
|
||||
setContentBoxMinHeight(parseInt(csh));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
csh = element.currentStyle.maxHeight;
|
||||
if(csh != "none"){
|
||||
csh = getPixelHeight(element,csh);
|
||||
if(csh !== "none"){
|
||||
if(getBoxSizing() == "border-box"){
|
||||
setBorderBoxMaxHeight(parseInt(csh));
|
||||
}
|
||||
else{
|
||||
setContentBoxMaxHeight(parseInt(csh));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Run the calculations
|
||||
init();
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
</component>
|
||||
Reference in New Issue
Block a user