Plugin Directory

Changeset 157112


Ignore:
Timestamp:
09/22/2009 10:25:46 PM (17 years ago)
Author:
jwriteclub
Message:
  • Removed Jplayer.swf, it doesn't work
  • Added SoundManager back
  • Got SoundManager working
  • Got the sidebar (basic) working
Location:
microaudio/trunk
Files:
4 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • microaudio/trunk/jstemplates/microAudio.init.js

    r157087 r157112  
    2828    if (ma.sidebar) {
    2929        ma.log("Loading sidebar . . .");
    30         ma.JqueryInit();
    31         ma.loadJs(ma.url + "js/" + ma.files.sidebar + "-" + ma.filekey + ".js",function(){ma.WidgetInit();});
     30        ma.JqueryInit(function() {
     31            ma.loadJs(ma.url + "js/" + ma.files.sidebar + "-" + ma.filekey + ".js",function(){ma.WidgetInit();});
     32        });
    3233    }
    3334   
     
    5253            ma.loadJs(ma.url + "js/" + ma.files.ui + "-" + ma.filekey + ".js",function(){
    5354                ma.log("Loaded jQuery UI:" + ma.files.ui + ". . . ");
    54                 ma.loadJs(ma.url + "js/" + ma.files.jplayer + "-" + ma.filekey + ".js",function(){
    55                     ma.log("Loaded jPlayer:" + ma.files.jplayer + ". . . ");
     55                ma.loadJs(ma.url + "js/" + ma.files.sm + "-" + ma.filekey + ".js",function(){
     56                    ma.log("Loaded Player:" + ma.files.sm + ". . . ");
    5657                    ma.jsloaded = "done";
    57                     if(callback != null) callback();
     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();
    5871                });
    5972            });
  • microaudio/trunk/jstemplates/microAudio.js

    r157087 r157112  
    88ma.Player = function(target) {
    99    ma.log("Playing " + target);
    10     var turl = jQuery(target).attr('href');
    11     jQuery(target).after("<div class='microAudio-player'></div>").next().jPlayer( {
    12         ready: function () {
    13           ma.log("Setting file " + turl);
    14           jQuery(this).setFile(turl).play(); // Defines the counterpart mp3 and ogg files
    15         },
    16         swfPath: (ma.url).substring(0,(ma.url).length -1)
    17       });
    1810}
  • microaudio/trunk/jstemplates/microAudio.widget.js

    r157078 r157112  
    11ma.WidgetInit = function() {
    2     jQuery("#microAudio-widget-container").html('').append("<div class='microAudio-widget-control'></div>").append("<ul id='microAudio-widget-list'></ul>");
     2    ma.current = null;
     3    jQuery("#microAudio-widget-container").html('').append("<div id='microAudio-widget-control'></div>").append("<ul id='microAudio-widget-list'></ul>");
    34    jQuery("a[href$='mp3']").each(function() {
    45            ma.log("Adding widget item: " + jQuery(this).html());
    5             jQuery("#microAudio-widget-list").append("<li class='microAudio-widget-list-item'><a href='" + jQuery(this).attr('href') + "' class='ma-widget-link'>" + jQuery(this).html() + "</a></li>");
     6            jQuery("#microAudio-widget-list").append("<li class='microAudio-widget-list-item'><a href='" + jQuery(this).attr('href') + "' class='microAudio-widget-link'>" + jQuery(this).html() + "</a></li>");
    67    });
    7     soundManager.debugMode = true;
    8     soundManager.url = ma.url;
    9     jQuery(".ma-widget-link").click(function() {
    10         ma.log("Clicked on " + jQuery(this).html());
    11         soundManager.play(jQuery(this).html(),jQuery(this).attr('href'));
    12         jQuery("#microAudio-widget-control").html("Playing");
     8    jQuery(".microAudio-widget-link").click(ma.handleWidgetClick);
     9}
     10ma.handleWidgetClick = function(element) {
     11    if(ma.current !== null) {
     12        ma.current.stop();
     13        jQuery(ma.currentLink).removeClass("microAudio-widget-playing").unbind('click').click(ma.handleWidgetClick);
     14    }
     15    ma.log("Clicked on " + jQuery(this).html());
     16    ma.currentLink = this;
     17    ma.current = soundManager.createSound({
     18                                            id:jQuery(this).html(),
     19                                            url:jQuery(this).attr('href'),
     20                                            autoPlay:true
     21                                            });
     22    jQuery(this).addClass("microAudio-widget-playing").unbind('click').click(function(){ // Pause Handler
     23        ma.current.togglePause();
    1324        return false;
    1425    });
    15     soundManager.onload = function() {
    16         ma.log('Sound Manager Loaded');
    17     }
     26    ma.current.whileloading = function(arg) {
     27        output = "Loaded " + ma.current.bytesLoaded + " of " + ma.sidebar.current.bytesTotal;
     28        ma.log(output);
     29        jQuery("#microAudio-widget-control").html(output);
     30    };
     31    jQuery("#microAudio-widget-control").html("Loading . . .");
     32    return false;
    1833}
  • microaudio/trunk/microAudio.admin.php

    r121430 r157112  
    1717        (isset($_POST['ma_clear_errors'])) ? $options->clear_errors() : $a;
    1818    }
    19     if(isset($_GET['build'])) {
     19    if( isset($_GET['build']) || isset($_POST['build']) ) {
    2020        require_once('microAudio.jsbuilder.php');
    2121        ?><div class="updated"><p><strong>Files Built</strong></p></div><?php
     
    8888    <p class="submit">
    8989        <input type="hidden" name="action" value="update" />
     90        <input type="hidden" name="build" value="true" />
    9091        <?php wp_nonce_field('ma-update_options'); ?>
    9192        <input type="submit" name="Submit" value="Configureate >" class="button" />
  • microaudio/trunk/microAudio.jsbuilder.php

    r157087 r157112  
    99            "microAudio",
    1010            "microAudio.widget",
    11             "soundmanager2",
    12             "jquery.jplayer"
     11            "jquery.jplayer",
     12            "soundmanager2"
    1313            );
    1414
     
    3030   
    3131    // Delete old files
    32     $filename = __FILE__."/../js/".$file."-".$old_key.".js";
     32    $filename = dirname(__FILE__)."/js/".$file."-".$old_key.".js";
    3333    try {
    3434        unlink($filename);
    3535    } catch (Exception $e) {
    36         $options->log_error("Unable to unlink $filename.",2);
     36        $options->log_error("Unable to unlink $filename.".$e,2);
    3737    }
    3838   
    3939    // Read js template
    40     $filename = __FILE__."/../jstemplates/".$file.".js";
     40    $filename = dirname(__FILE__)."/jstemplates/".$file.".js";
    4141    $contents = '';
    4242    try {
    4343        $fhandle = fopen($filename, 'r');
    4444    } catch (Exception $e) {
    45         $options->log_error("Unable to process fopen for $filename.");
     45        $options->log_error("Unable to process fopen for $filename. ".$e);
    4646    }
    4747    try {
     
    4949        fclose($fhandle);   
    5050    } catch (Exception $e) {
    51         $options->log_error("Unable to process fread for $filename.");
     51        $options->log_error("Unable to process fread for $filename. ".$e);
    5252    }
    5353   
     
    5555   
    5656    // Write output js
    57     $filename = __FILE__."/../js/".$file."-".$options->key.".js";
     57    $filename = dirname(__FILE__)."/js/".$file."-".$options->key.".js";
    5858    try {
    5959        $fhandle = fopen($filename, 'w');
    6060    } catch (Exception $e) {
    61         $options->log_error("Unable to process fopen for $filename.");
     61        $options->log_error("Unable to process fopen for $filename. ".$e);
    6262    }
    6363    try {
     
    6565        fclose($fhandle);
    6666    } catch (Exception $s) {
    67         $options->log_error("Unable to process frwite for $filename.");
     67        $options->log_error("Unable to process frwite for $filename.".$e);
    6868    }
    6969}
     
    7171function ma_replace_tokens($matches) {
    7272    $options = microAudioOptions::getInstance();
    73     if (is_bool($options->$matches[2])) {
    74         return ($options->$matches[2]) ? 'true' : 'false'
     73    if(is_bool($options->$matches[2]) || $options->$matches[2] === "") {
     74        return ((bool)$options->$matches[2])?"true":"false";   
    7575    }
    7676    return $options->$matches[2];
  • microaudio/trunk/microAudio.options.php

    r157060 r157112  
    4040        date_default_timezone_set("America/Los_Angeles");
    4141        $this->data = get_option('ma_options');
     42        foreach($this->options as $option) {
     43            if($this->data[$option] == null)
     44                $this->data[$option] = "";
     45        }
    4246    }
    4347   
     
    5155   
    5256    function __get($name) {
     57        if($name == "true") return "true";
     58        if($name == "false") return "false";
    5359        if(in_array($name, $this->options)) {
    54             return $this->data[$name];
     60            return $this->data[$name] == null ? "" : $this->data[$name];
    5561        } else {
    5662            $this->log_error("Tried to retrieve unknown key $name from options.");
     
    95101    }
    96102}
    97 
Note: See TracChangeset for help on using the changeset viewer.