Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/delibero.git

Ability to include URLs as well as files.

AuthorDave Jarvis <email>
Date2014-12-10 00:25:57 GMT-0800
Commitfb9a944e7a9fad7f73f3483dbdf550d413a81dab
Parent6fa0436
xml/css/common.css
-@import url( reset.min.css );
+@import url( 'reset.min.css' );
body {
xml/css/reset.min.css
/* reset5 © 2011 opensource.736cs.com MIT */
-html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}body{line-height:1;}article,aside,dialog,figure,footer,header,hgroup,nav,section,blockquote{display:block;}nav ul{list-style:none;}ol{list-style:decimal;}ul{list-style:disc;}ul ul{list-style:circle;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:none;}ins{text-decoration:underline;}del{text-decoration:line-through;}mark{background:none;}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help;}table{border-collapse:collapse;border-spacing:0;}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}input[type=submit],input[type=button],button{margin:0!important;padding:0!important;}input,select,a img{vertical-align:middle;}
+html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,audio,canvas,details,figcaption,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video{border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;margin:0;padding:0;}body{line-height:1;}article,aside,dialog,figure,footer,header,hgroup,nav,section,blockquote{display:block;}nav ul{list-style:none;}ol{list-style:decimal;}ul{list-style:disc;}ul ul{list-style:circle;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:none;}ins{text-decoration:underline;}del{text-decoration:line-through;}mark{background:none;}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help;}table{border-collapse:collapse;border-spacing:0;}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0;}input[type=submit],input[type=button],button{margin:0!important;padding:0!important;}input,select,a img{vertical-align:middle;}
xml/js/common.js
];
+/**
+ * Provides a cross-browser mechanism to retrieve the XMLHttpRequest object
+ * used for performing Ajax requests.
+ */
function get_request_object() {
for( var i = 0; i < REQ_OBJECTS.length; i++ ) {
try {
return REQ_OBJECTS[ i ]();
}
catch( e ) { continue; }
}
}
+/**
+ * This is used to perform an asynchronous injection of a code resource
+ * (JavaScript or CSS) into a web page element.
+ */
function inject( path, parent, element, callback ) {
var req = get_request_object();
}
-function include( file, type, callback ) {
- var src = type + '/' + file.substr( 0, file.lastIndexOf( '.' ) ) + '.' + type;
+/**
+ * Downloads the contents of a resource (specified by src) and inserts
+ * those contents directly into a corresponding tag.
+ *
+ * @param src - Filname or URL.
+ * @param type - 'css' or 'js' to denote style or JavaScript, respectively.
+ * @param callback - Function to call after the code is downloaded.
+ */
+function include( src, type, callback ) {
var parent, element;
inject( src, parent, element, callback );
+}
+
+/**
+ * Includes a file local to the web server.
+ */
+function include_file( file, type, callback ) {
+ var src = type + '/' + file.substr( 0, file.lastIndexOf( '.' ) ) + '.' + type;
+ include( src, type, callback );
}
+/**
+ * Returns the last directory name from the URL so that relative files can
+ * be referenced.
+ */
function path() {
return location.pathname.split( '/' ).pop();
}
-include( path(), 'css' );
-include( path(), 'js' );
+include_file( path(), 'css' );
+include_file( path(), 'js' );
xml/js/support.js
-include( 'aloha.editor.js', 'js', function() {
- jQuery(".support").aloha();//aloha( document.querySelector('.support') );
+include_file( 'editor.min.js', 'js', function() {
+ aloha( document.querySelector('.support') );
});
Delta35 lines added, 8 lines removed, 27-line increase