Changeset 157134
- Timestamp:
- 09/23/2009 01:15:17 AM (17 years ago)
- Location:
- microaudio/trunk
- Files:
-
- 2 added
- 5 edited
-
jsmin-1.1.1.php (added)
-
jstemplates/microAudio.bootstrap.js (added)
-
jstemplates/microAudio.init.js (modified) (2 diffs)
-
microAudio.admin.php (modified) (2 diffs)
-
microAudio.jsbuilder.php (modified) (3 diffs)
-
microAudio.options.php (modified) (1 diff)
-
microAudio.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
microaudio/trunk/jstemplates/microAudio.init.js
r157112 r157134 3 3 // http://compu.terlicio.us/ 4 4 5 // First, implment staticvars5 // First, implment minimum vars 6 6 var ma = { 7 7 url:"{[$location]}", 8 8 filekey:"{[$key]}", 9 sidebar:{[$enable_widget]}, 10 files:{ 11 'jquery':'jquery-1.3.2', 12 'ui':'jquery-ui-1.7.2.min', 13 'sidebar':'microAudio.widget', 14 'ma':'microAudio', 15 'sm':'soundmanager2', 16 'jplayer':'jquery.jplayer', 17 }, 18 loaded:false, 19 jsloaded:"none" 9 files:{'bootstrap':'microAudio.bootstrap',}, 10 debug:{[$debug]}, 20 11 }; 12 13 // Second, set logging based on debugging 21 14 ma.log = function(string) { 22 console.log(string);23 } 15 if(ma.debug) console.log(string); 16 }; 24 17 25 // Third, get the onload event, and start running18 // Third, get the onload event, and bootstrap 26 19 onload = function() { 27 ma.log("Starting microAudio load sequence . . ."); 28 if (ma.sidebar) { 29 ma.log("Loading sidebar . . ."); 30 ma.JqueryInit(function() { 31 ma.loadJs(ma.url + "js/" + ma.files.sidebar + "-" + ma.filekey + ".js",function(){ma.WidgetInit();}); 32 }); 33 } 34 35 // Prepare links (simple) 36 ma.log("Preparing links . . ."); 37 var links = document.getElementsByTagName("a"); 38 for (var i = 0; i < links.length; i++) { 39 if(links[i].href.indexOf('mp3') != -1) { 40 links[i].className = "ma-link"; 41 links[i].onclick = ma.ClickInit; 42 } 43 } 44 ma.log("microAudio setup complete . . ."); 45 } 46 47 ma.JqueryInit = function(callback) { 48 if(ma.jsloaded == "none") { 49 ma.jsloaded = "loading"; 50 ma.log("Loading files with key: " + ma.filekey); 51 ma.loadJs(ma.url + "js/" + ma.files.jquery + "-" + ma.filekey + ".js",function(){ 52 ma.log("Loaded jQuery:" + ma.files.jquery + ". . . "); 53 ma.loadJs(ma.url + "js/" + ma.files.ui + "-" + ma.filekey + ".js",function(){ 54 ma.log("Loaded jQuery UI:" + ma.files.ui + ". . . "); 55 ma.loadJs(ma.url + "js/" + ma.files.sm + "-" + ma.filekey + ".js",function(){ 56 ma.log("Loaded Player:" + ma.files.sm + ". . . "); 57 ma.jsloaded = "done"; 58 soundManager.onready(function(oStatus){ 59 if (oStatus.success) { 60 ma.log('Yay, SM2 loaded OK!'); 61 } else { 62 ma.log('Oh snap, SM2 could not start.'); 63 } 64 if(callback != null) callback(); 65 }); 66 soundManager.flashLoadTimeout = 750; 67 soundManager.debugMode = true; 68 soundManager.consoleOnly = true; 69 soundManager.url = ma.url; 70 soundManager.reboot(); 71 }); 72 }); 73 }); 74 } else if(ma.jsloaded == "loading") { 75 setTimeout(ma.JqueryInit(callback),100); 76 } else { 77 if(callback != null) callback(); 78 } 79 } 80 81 // Start loading code when we've been clicked 82 ma.ClickInit = function(e) { 83 e = e||window.event; 84 var target = e.target||e.srcElement; 85 ma.log(target); 86 if(!ma.loaded) { 87 ma.JqueryInit(function() { 88 ma.loadJs(ma.url + "js/" + ma.files.ma + "-" + ma.filekey + ".js",function(){ 89 ma.PageInit(); 90 ma.Player(target); 91 }); 92 }); 93 ma.loaded = true; 94 } else { 95 ma.Player(target); 96 } 97 return false; 98 } 20 ma.log("Loading microAudio bootstrapper . . ."); 21 ma.loadJs(ma.url + "js/" + ma.files.bootstrap + "-" + ma.filekey + ".js",function(){ma.bootstrap();}); 22 }; 99 23 100 24 // Loads a js file 101 ma.loadJs = function(url,c allbackFunction) {102 ma.log("Requesting file " + url + " with callback " + c allbackFunction);25 ma.loadJs = function(url,c) { 26 ma.log("Requesting file " + url + " with callback " + c); 103 27 var s=document.createElement("script"); 104 28 s.src=url; … … 106 30 var h = document.getElementsByTagName("head")[0]; 107 31 if(h) { 108 if(c allbackFunction != null) {109 var l oadCallback= function() {110 if(this.readyState == 'complete' || this.readyState == 'loaded') c allbackFunction();32 if(c !== null) { 33 var lc = function() { 34 if(this.readyState == 'complete' || this.readyState == 'loaded') c(); 111 35 } 112 s.onreadystatechange = l oadCallback;113 s.onload = c allbackFunction;36 s.onreadystatechange = lc; 37 s.onload = c; 114 38 } 115 39 h.appendChild(s); 116 40 } 117 } 41 }; -
microaudio/trunk/microAudio.admin.php
r157112 r157134 15 15 (isset($_POST['ma_download'])) ? $options->download = true : $options->download = false; 16 16 (isset($_POST['ma_enable_widget'])) ? $options->enable_widget = true : $options->enable_widget = false; 17 (isset($_POST['ma_debug'])) ? $options->debug = true : $options->debug = false; 17 18 (isset($_POST['ma_clear_errors'])) ? $options->clear_errors() : $a; 18 19 } … … 83 84 <span class="explanatory-text">Whether to include a link next to the flash player to download the file. Marginally increases the javascript size.</span> 84 85 </td> 86 </tr> 87 <tr valign="top"> 88 <th scope="row">Debug</th> 89 <td> 90 <input type="checkbox" name="ma_debug" id="ma_debug" <?php if ($options->debug) echo "checked"; ?> /> 91 <label for="ma_debug">Include dedugging information</label> 92 <br /> 93 <span class="explanatory-text">Whether to include debugging information in the code. Significantly increases the code size and runtime.</span> 94 </td> 85 95 </tr> 86 96 </tbody> -
microaudio/trunk/microAudio.jsbuilder.php
r157112 r157134 10 10 "microAudio.widget", 11 11 "jquery.jplayer", 12 "soundmanager2" 12 "soundmanager2", 13 "microAudio.bootstrap" 13 14 ); 14 15 … … 19 20 set_error_handler('jsBuilderHandler'); 20 21 21 22 // Include JSMin 23 require_once(dirname(__FILE__)."/jsmin-1.1.1.php"); 22 24 23 25 // Builds js files for your installation. … … 52 54 } 53 55 56 // Replace template tags 54 57 $contents = preg_replace_callback("|(\\{\\[\\$((?:[a-z][a-z_]+))\\]\\})|",'ma_replace_tokens',$contents); 58 59 // Minify 60 if(!$options->debug) $contents = JSMin::minify($contents); 55 61 56 62 // Write output js -
microaudio/trunk/microAudio.options.php
r157112 r157134 29 29 'key', 30 30 'location', 31 'debug', 31 32 ); 32 33 -
microaudio/trunk/microAudio.php
r157087 r157134 13 13 <?php 14 14 15 $MICROAUDIO_VERSION = "0.7 Dev 3";15 $MICROAUDIO_VERSION = "0.7 Dev 4"; 16 16 17 17 // Include classes
Note: See TracChangeset
for help on using the changeset viewer.