Wordpress Soundwalk Plugin for Mugako bidea

This commit is contained in:
lrullo 2022-12-26 17:43:17 +01:00
commit 01849116d7
22 changed files with 4101 additions and 0 deletions

221
admin.php Normal file
View File

@ -0,0 +1,221 @@
<?php
//var_dump($GLOBALS['wp_scripts']->registered);
?>
<div class="wrap">
<div id="icon-post" class="icon32"><br/></div>
<div id="soundwalk-messages">
<div>
</div>
</div><!--soundwalk-messages-->
<h2>Add New Walk</h2>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
<form id="soundwalk-new-walk" method="POST">
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<div id="soundwalk-tabs">
<ul>
<li><a href="#soundwalk-datos">Datos del paseo</a></li>
<li><a href="#soundwalk-paseo">Puntos</a></li>
</ul>
<!-- -------------------------- -->
<div id="soundwalk-datos">
<div id="walk-data" class="box">
<div class="panel-left">
<div id="titlediv" class="">
<h3 class="hndle"><span>Title</span></h3>
<div class="inside">
<label class="screen-reader-text" for="title">Title</label>
<input type="text" name="walk_title" size="30" tabindex="1" id="title" autocomplete="off" />
</div>
</div><!-- titlediv -->
<div id="walk-excerpt-box" class="">
<h3 class="hndle"><span>Description</span></h3>
<div class="inside">
<label class="screen-reader-text" for="walk-excerpt">Description</label>
<textarea id="walk-excerpt" rows="10" name="walk"></textarea>
</div>
</div><!-- excerpt -->
</div><!--panel-left-->
<div class="panel-right">
<div class="panel-wrap">
<div id="language" class="">
<h3 class="hndle"><span>Language</span></h3>
<div class="inside">
<label class="screen-reader-text" for="walk-language">Language</label>
<input name="walk_language" id="walk-language" type="text" tabindex="2" size="10" autocomplete="on"/>
</div>
</div><!-- language -->
<div id="walk-picture-wrapper" class="">
<h3 class="hndle"><span>Picture</span></h3>
<div class="inside">
<p>
<a title="Imagenes" href="#" class="button image" data-type="image">Choose Image</a>
</p>
<div id="walk-picture-preview">
</div>
<input name="walk_picture" id="walk-picture" type="hidden" />
</div>
</div><!-- language -->
<div id="walk-actions" class="">
<h3 class="hndle"><span>Actions</span></h3>
<div class="inside">
<p class="submit">
<input type="submit" name="Submit" class="button-primary" id="walk-submit" value="<?php esc_attr_e('Save Changes') ?>" />
</p>
</div>
</div><!-- areago-actions -->
</div>
</div><!--panel-right-->
<div class="clear"></div>
</div><!--walk-data-->
</div> <!--soundwalk-datos-->
<div id="soundwalk-paseo">
<div id="walk-editor" class="box">
<div id="editor-toolbar">
<ul>
<li id="add-point"><a title="Añadir Punto" href="#TB_inline?height=500&width=800&height=500&inlineId=markersMapWindow&modal=false" class="thickbox">Añadir Punto</a></li>
<li id="create-point"><a title="Crear Punto" href="#">Crear Punto</a></li>
<li id="edit-point"><a title="Editar Punto" href="#">Editar Punto</a></li>
<li id="delete-point"><a title="Borrar Punto" href="#">Borrar Punto</a></li>
<li id="kml-add"><a title="Añadir KML" href="#">Añadir KML</a></li>
</ul>
</div><!--editor-toolbar-->
<div id="editor-panels">
<div id="walk-preview">
<div id="walk-map"></div>
</div><!--walk-preview-->
<div id="walk-point-editor">
<!--TEMPLATE: tmpl-point-editor-template -->
</div><!--walk-point-data-->
<div class="clear"></div>
</div><!--editor-panels-->
</div><!--walk-editor-->
</div><!--soundwalk-paseo-->
</div><!--soundwalk-tabs-->
<div id="markersMapWindow">
<div id="markersWrapper">
<div id="markersMap"></div>
<div id="markerInfo">
<div id="marker-info-text"></div>
<div id="marker-player"></div>
</div>
<div id="marker-add-button"><button>Añadir</button></div>
</div>
</div>
</form>
</div> <!--wrap-->
<script type="text/html" id="tmpl-point-editor-template">
<div class="panel-wrapper">
<div class="title">
<h3>{{data.title}}</h3>
</div>
<div class="point-info">
<p>
<strong>Autor: </strong>{{data.autor}}
</p>
</div>
<div id="point-player"></div>
<div class="editor-option">
<label>Tipo de punto {{data.type}}</label>
<div class="toggle-control" id="toggle-tipos">
<ul>
<li id="tipo-once" class="first-leaf"><a <# if (data.type == 1) { #> class="selected" <# } #> data-type="play" href="#">Play</a></li>
<li id="tipo-loop"><a <# if (data.type == 2) { #> class="selected" <# } #> data-type="loop" href="#">Play Loop</a></li>
<li id="tipo-end"><a <# if (data.type == 3) { #> class="selected" <# } #> data-type="end" href="#">Play To End</a></li>
<li id="tipo-wifi"><a <# if (data.type == 4) { #> class="selected" <# } #> data-type="wifi" href="#">Wifi</a></li>
<li id="tipo-layer"><a <# if (data.type == 5) { #> class="selected" <# } #> data-type="layer" href="#">Layer</a></li>
</ul>
</div><!--toggle-control-->
</div><!--editor-option-->
<div class="editor-option">
<label class="slider-radio-value">Radio: {{data.radio}}m</label>
<div class="slider-control">
<div class="slider-wrapper">
<div class="slider-radio"></div>
</div>
</div>
</div><!--editor-option-->
<div id="layer-point" class="editor-option">
<label>Capa</label>
<div class="layer-control">
<ul>
<li class="first-leaf"><a <# if (data.layer == 0) { #> class="selected" <# } #> data-layer='0' href="#">Todas</a></li>
<li><a <# if (data.layer == 1) { #> class="selected" <# } #> data-layer='1' href="#">1</a></li>
<li><a <# if (data.layer == 2) { #> class="selected" <# } #> data-layer='2' href="#">2</a></li>
<li><a <# if (data.layer == 3) { #> class="selected" <# } #> data-layer='3' href="#">3</a></li>
<li><a <# if (data.layer == 4) { #> class="selected" <# } #> data-layer='4' href="#">4</a></li>
<li><a <# if (data.layer == 5) { #> class="selected" <# } #> data-layer='5' href="#">5</a></li>
<li><a <# if (data.layer == 6) { #> class="selected" <# } #> data-layer='6' href="#">6</a></li>
</ul>
</div>
</div><!--editor-option-->
<div id="layer-change-point" class="editor-option">
<label>Capa destino</label>
<div class="layer-control">
<ul>
<li class="first-leaf"><a <# if (data.toLayer == 1) { #> class="selected" <# } #> data-layer='1' href="#">1</a></li>
<li><a <# if (data.toLayer == 2) { #> class="selected" <# } #> data-layer='2' href="#">2</a></li>
<li><a <# if (data.toLayer == 3) { #> class="selected" <# } #> data-layer='3' href="#">3</a></li>
<li><a <# if (data.toLayer == 4) { #> class="selected" <# } #> data-layer='4' href="#">4</a></li>
<li><a <# if (data.toLayer == 5) { #> class="selected" <# } #> data-layer='5' href="#">5</a></li>
<li><a <# if (data.toLayer == 6) { #> class="selected" <# } #> data-layer='6' href="#">6</a></li>
</ul>
</div>
</div><!--editor-option-->
<div id="wifi-point" class="editor-option">
<label>Wifi ESSID</label>
<div class="text-control">
<div class="text-control-wrapper">
<input type="text" name="wifi-essid" id="wifi-point-essid">{{data.wifi}}</input>
</div>
</div>
</div><!--editor-option-->
<div id="options-change-point" class="editor-option">
<label>Opciones</label>
<div class="toggle-control" id="toogle-options">
<ul>
<li class="first-leaf"><a <# if (data.vibrate) { #> class="selected" <# } #> id="option-vibrate" href="#">Vibrate</a></li>
<li><a <# if (data.autofade) { #> class="selected" <# } #> id="option-autofade" href="#">AutoFade</a></li>
</ul>
</div>
</div><!--editor-option-->
</div><!--panel-wrapper-->
</script>
<script type="text/html" id="tmpl-audio-player">
<audio src="{{data.url}}"></audio>
</script>
<script type="text/html" id="tmpl-marker-info">
<h3>{{data.title}}</h3>
</script>
<script type="text/html" id="tmpl-point-info-picture">
<img src="{{data.url}}"/>
</script>

24
descarga.php Normal file
View File

@ -0,0 +1,24 @@
<?php
if(!isset($_GET['paseo']))
die();
$id = $_GET['paseo'];
require_once( dirname(dirname(dirname(dirname( __FILE__ )))) . '/wp-load.php' );
require_once (dirname( __FILE__ ) . '/libs/classes.php');
$file_helper = new Soundwalk_File_Helper();
$path = $file_helper->get_Path($id);
if (!file_exists($path . '/data.zip'))
die();
$file = $path . '/data.zip';
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=soundwalk.zip");
header("Content-Length: " . filesize($file));
readfile($file);
?>

BIN
img/controls.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

1
img/controls.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/markers_end.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
img/markers_layer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/markers_loop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/markers_play.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/markers_wifi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tipos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/toolbar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

22
js/app.js Normal file
View File

@ -0,0 +1,22 @@
(function($){
var soundwalk = window.soundwalk.walk;
var ui = {
initialize: function(){
$('#soundwalk-tabs').tabs({active: 1});
var editor = new soundwalk.view.WalkEditor;
}
};
$(document).ready(function(){
ui.initialize();
});
}(jQuery));

174
js/mediaelement-and-player.min.js vendored Normal file
View File

@ -0,0 +1,174 @@
/*!
* MediaElement.js
* HTML5 <video> and <audio> shim and player
* http://mediaelementjs.com/
*
* Creates a JavaScript object that mimics HTML5 MediaElement API
* for browsers that don't understand HTML5 or can't play the provided codec
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
*
* Copyright 2010-2013, John Dyer (http://j.hn)
* License: MIT
*
*/var mejs=mejs||{};mejs.version="2.13.1";mejs.meIndex=0;
mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo",
"video/x-vimeo"]}]};
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g,h=document.getElementsByTagName("script"),l=h.length,j=a.length;b<l;b++){f=h[b].src;c=f.lastIndexOf("/");if(c>-1){g=f.substring(c+
1);f=f.substring(0,c+1)}else{g=f;f=""}for(c=0;c<j;c++){e=a[c];e=g.indexOf(e);if(e>-1){d=f;break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d==
"undefined")d=25;a=a.split(":");b=parseInt(a[0],10);var e=parseInt(a[1],10),f=parseInt(a[2],10),g=0,h=0;if(c)g=parseInt(a[3])/d;return h=b*3600+e*60+f+g},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(e>0)d=Math.pow(60,e);b+=Number(a[e])*d}return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);if(b&&/object|embed/i.test(b.nodeName))if(mejs.MediaFeatures.isIE){b.style.display=
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,f=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isBustedNativeHTTPS=location.protocol==="https:"&&(d.match(/android [12]\./)!==null||d.match(/macintosh.* version.* safari/)!==null);a.isIE=c.appName.toLowerCase().match(/trident/gi)!==
null;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit&&!a.isIE;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window&&window.ontouchstart!=null;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<f.length;c++)e=document.createElement(f[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;
try{e.canPlayType("video/mp4")}catch(g){a.supportsMediaTag=false}a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasNativeFullscreen=typeof e.requestFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasMsNativeFullScreen=typeof e.msRequestFullscreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen||a.hasMsNativeFullScreen;
a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=document.mozFullScreenEnabled;else if(a.hasMsNativeFullScreen)a.nativeFullScreenEnabled=document.msFullscreenEnabled;if(a.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName="";if(a.hasWebkitNativeFullScreen)a.fullScreenEventName="webkitfullscreenchange";else if(a.hasMozNativeFullScreen)a.fullScreenEventName="mozfullscreenchange";else if(a.hasMsNativeFullScreen)a.fullScreenEventName=
"MSFullscreenChange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen;else if(e.hasMsNativeFullScreen)return b.msFullscreenElement!==null};a.requestFullScreen=function(h){if(a.hasWebkitNativeFullScreen)h.webkitRequestFullScreen();else if(a.hasMozNativeFullScreen)h.mozRequestFullScreen();else a.hasMsNativeFullScreen&&h.msRequestFullscreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();
else if(a.hasMozNativeFullScreen)document.mozCancelFullScreen();else a.hasMsNativeFullScreen&&document.msExitFullscreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably"}return""},
positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}},hasAttribute:function(a){return a in
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}};
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a];delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);
b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e;if(a=this.pluginMediaElements[a]){b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}}};
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,
defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),f=e==="audio"||e==="video",g=f?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];g=typeof g=="undefined"||g===null||g==""?null:g;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,f,g);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
determinePlayback:function(a,b,c,d,e){var f=[],g,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")f.push({type:b.type,url:e});else for(g=0;g<b.type.length;g++)f.push({type:b.type[g],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));f.push({type:l,url:e})}else for(g=0;g<a.childNodes.length;g++){h=a.childNodes[g];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)f.push({type:l,url:e})}}if(!d&&f.length>0&&f[0].url!==null&&this.getTypeFromFile(f[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")&&!(mejs.MediaFeatures.isBustedNativeHTTPS&&
b.httpsBasicAuthSite===true)){if(!d){g=document.createElement(j.isVideo?"video":"audio");a.parentNode.insertBefore(g,a);a.style.display="none";j.htmlMediaElement=a=g}for(g=0;g<f.length;g++)if(a.canPlayType(f[g].type).replace(/no/,"")!==""||a.canPlayType(f[g].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=f[g].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(g=
0;g<f.length;g++){l=f[g].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=f[g].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&f.length>0)j.url=f[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},
getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+1).toLowerCase();return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className=
"me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(f){}e.innerHTML=b.customError?b.customError:c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,f){c=a.htmlMediaElement;var g=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),
m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){g=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.pluginHeight>0?b.pluginHeight:b.videoHeight>
0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;g=mejs.Utility.encodeUrl(g);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){g=320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+
g,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h,"pseudostreamstart="+b.pseudoStreamingStartQueryParam];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");b.enablePseudoStreaming&&d.push("pseudostreaming=true");f&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML=
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="initParams" value="'+d.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=
document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.join("&amp;")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else k.innerHTML=
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+g+'" height="'+h+'" class="mejs-shim"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,
videoId:b,height:h,width:g};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+g+'" height="'+h+'" frameborder="0" class="mejs-shim"></iframe>'}c.style.display="none";c.removeAttribute("autoplay");return j},updateNative:function(a,
b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="//www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
a;var b,c="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+
c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=
document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;
c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
(function(a,b){var c={locale:{language:"",strings:{}},methods:{}};c.locale.getLanguage=function(){return c.locale.language||navigator.language};if(typeof mejsL10n!="undefined")c.locale.language=mejsL10n.language;c.locale.INIT_LANGUAGE=c.locale.getLanguage();c.methods.checkPlain=function(d){var e,f,g={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};d=String(d);for(e in g)if(g.hasOwnProperty(e)){f=RegExp(e,"g");d=d.replace(f,g[e])}return d};c.methods.formatString=function(d,e){for(var f in e){switch(f.charAt(0)){case "@":e[f]=
c.methods.checkPlain(e[f]);break;case "!":break;default:e[f]='<em class="placeholder">'+c.methods.checkPlain(e[f])+"</em>"}d=d.replace(f,e[f])}return d};c.methods.t=function(d,e,f){if(c.locale.strings&&c.locale.strings[f.context]&&c.locale.strings[f.context][d])d=c.locale.strings[f.context][d];if(e)d=c.methods.formatString(d,e);return d};c.t=function(d,e,f){if(typeof d==="string"&&d.length>0){var g=c.locale.getLanguage();f=f||{context:g};return c.methods.t(d,e,f)}else throw{name:"InvalidArgumentException",
message:"First argument is either not a string or empty."};};b.i18n=c})(document,mejs);(function(a){if(typeof mejsL10n!="undefined")a[mejsL10n.language]=mejsL10n.strings})(mejs.i18n.locale.strings);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
(function(a){a.zh={Fullscreen:"\u5168\u87a2\u5e55","Go Fullscreen":"\u5168\u5c4f\u6a21\u5f0f","Turn off Fullscreen":"\u9000\u51fa\u5168\u5c4f\u6a21\u5f0f",Close:"\u95dc\u9589"}})(mejs.i18n.locale.strings);
/*!
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5 <video> add <audio> tags
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
*
* Copyright 2010-2013, John Dyer (http://j.hn/)
* License: MIT
*
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
(function(f){mejs.MepDefaults={poster:"",showPosterWhenEnded:false,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
hideVideoControlsOnLoad:false,clickToPlayPause:true,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-
0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!=
"undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players={};mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);this.id="mep_"+mejs.mepIndex++;
mejs.players[this.id]=this;this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(d,g){a.meReady(d,g)},error:function(d){a.handleError(d)}}),e=a.media.tagName.toLowerCase();a.isDynamic=e!=="audio"&&e!=="video";a.isVideo=a.isDynamic?a.options.isVideo:e!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls",
"controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(b.isAndroid&&a.options.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
a.container.addClass((b.isAndroid?"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";e=b.substring(0,
1).toUpperCase()+b.substring(1);a.width=a.options[b+"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+e+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==
null?a.$media.attr("height"):a.options["default"+e+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.width;c.pluginHeight=a.height}mejs.MediaElement(a.$media[0],c);typeof a.container!="undefined"&&a.controlsAreVisible&&a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});
b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!(!b.controlsAreVisible||b.options.alwaysShowControls))if(a){b.controls.stop(true,
true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},
controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);
this.controlsEnabled=true},meReady:function(a,b){var c=this,e=mejs.MediaFeatures,d=b.getAttribute("autoplay");d=!(typeof d=="undefined"||d===null||d==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(e.isAndroid&&c.options.AndroidUseNativeControls)&&!(e.isiPad&&c.options.iPadUseNativeControls)&&!(e.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);
c.findTracks();for(g in c.options.features){e=c.options.features[g];if(c["build"+e])try{c["build"+e](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{mejs.MediaElementPlayer.prototype.clickToPlayPauseCallback=function(){if(c.options.clickToPlayPause)c.media.paused?
c.media.play():c.media.pause()};c.media.addEventListener("click",c.clickToPlayPauseCallback,false);c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&
c.startControlsTimer(1E3)})}c.options.hideVideoControlsOnLoad&&c.hideControls(false);d&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(j){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&!isNaN(j.target.videoHeight)){c.setPlayerSize(j.target.videoWidth,j.target.videoHeight);c.setControlsSize();c.media.setVideoSize(j.target.videoWidth,j.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var j in mejs.players){var m=
mejs.players[j];m.id!=c.id&&c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(j){}c.media.pause();c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&
c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);c.globalBind("resize",function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(d&&a.pluginType=="native"){a.load();
a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||parseInt(this.$node.css("max-width").replace(/px/,""),10)/this.$node.offsetParent().width()===
1||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(this.container.parent()[0].tagName.toLowerCase()===
"body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)}d=this.layers.find(".mejs-overlay-play");c=d.find(".mejs-overlay-button");
d.height(this.container.height()-this.controls.height());c.css("margin-top","-"+(c.height()/2-this.controls.height()/2).toString()+"px")},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var d=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){d.each(function(){var g=f(this);if(g.css("position")!=
"absolute"&&g.is(":visible"))a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.width())-1}c.width(b);e.width(b-(e.outerWidth(true)-e.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,e){var d=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},
false);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,c,e){var d=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),
k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),j=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(d.options.clickToPlayPause)e.paused?e.play():e.pause()});e.addEventListener("play",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);e.addEventListener("playing",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();
k.hide()},false);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||j.show()},false);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("canplay",
function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,e){this.globalBind("keydown",function(d){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var j=a.options.keyActions[g],m=0,q=j.keys.length;m<q;m++)if(d.keyCode==j.keys[m]){d.preventDefault();
j.action(a,e,d.keyCode);return false}return true});this.globalBind("click",function(d){if(f(d.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,e){e=f(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,
this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;for(a in this.options.features){b=
this.options.features[a];if(this["clean"+b])try{this["clean"+b](this)}catch(c){}}if(this.isDynamic)this.$node.insertBefore(this.container);else{this.$media.prop("controls",true);this.$node.clone().show().insertBefore(this.container);this.$node.remove()}this.media.pluginType!=="native"&&this.media.remove();delete mejs.players[this.id];this.container.remove();this.globalUnbind();delete this.node.player}};(function(){function a(c,e){var d={d:[],w:[]};f.each((c||"").split(" "),function(g,k){var j=k+"."+
e;if(j.indexOf(".")===0){d.d.push(j);d.w.push(j)}else d[b.test(k)?"w":"d"].push(j)});d.d=d.d.join(" ");d.w=d.w.join(" ");return d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,e,d){c=a(c,this.id);c.d&&f(document).bind(c.d,e,d);c.w&&f(window).bind(c.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(c,e){c=a(c,this.id);c.d&&f(document).unbind(c.d,e);c.w&&f(window).unbind(c.w,
e)}})();if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){a===false?this.each(function(){var b=jQuery(this).data("mediaelementplayer");b&&b.remove();jQuery(this).removeData("mediaelementplayer")}):this.each(function(){jQuery(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,a))});return this};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{playpauseText:mejs.i18n.t("Play/Pause")});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,e){var d=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'" aria-label="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();e.paused?e.play():e.pause();return false});e.addEventListener("play",function(){d.removeClass("mejs-play").addClass("mejs-pause")},
false);e.addEventListener("playing",function(){d.removeClass("mejs-play").addClass("mejs-pause")},false);e.addEventListener("pause",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false);e.addEventListener("paused",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,e){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'" aria-label="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){e.paused||e.pause();if(e.currentTime>0){e.setCurrentTime(0);e.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left",
"0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,e){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(b);b.find(".mejs-time-buffering").hide();var d=
this,g=b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var k=b.find(".mejs-time-current"),j=b.find(".mejs-time-handle"),m=b.find(".mejs-time-float"),q=b.find(".mejs-time-float-current"),p=function(h){h=h.pageX;var l=g.offset(),r=g.outerWidth(true),n=0,o=n=0;if(e.duration){if(h<l.left)h=l.left;else if(h>r+l.left)h=r+l.left;o=h-l.left;n=o/r;n=n<=0.02?0:n*e.duration;t&&n!==e.currentTime&&e.setCurrentTime(n);if(!mejs.MediaFeatures.hasTouch){m.css("left",o);q.html(mejs.Utility.secondsToTimeCode(n));
m.show()}}},t=false;g.bind("mousedown",function(h){if(h.which===1){t=true;p(h);d.globalBind("mousemove.dur",function(l){p(l)});d.globalBind("mouseup.dur",function(){t=false;m.hide();d.globalUnbind(".dur")});return false}}).bind("mouseenter",function(){d.globalBind("mousemove.dur",function(h){p(h)});mejs.MediaFeatures.hasTouch||m.show()}).bind("mouseleave",function(){if(!t){d.globalUnbind(".dur");m.hide()}});e.addEventListener("progress",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);
e.addEventListener("timeupdate",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);d.loaded=c;d.total=g;d.current=k;d.handle=j},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==null){c=Math.min(1,
Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=Math.round(this.total.width()*this.media.currentTime/this.media.duration),b=a-Math.round(this.handle.outerWidth(true)/2);this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,e){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,b,
c,e){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate",function(){a.updateDuration()},
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.durationD&&(this.options.duration>0||this.media.duration))this.durationD.html(mejs.Utility.secondsToTimeCode(this.options.duration>0?this.options.duration:
this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,e){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var d=this,g=d.isVideo?d.options.videoVolume:d.options.audioVolume,k=g=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+
'" aria-label="'+d.options.muteText+'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(b),
j=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),m=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),q=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),p=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),t=function(n,o){if(!j.is(":visible")&&typeof o=="undefined"){j.show();t(n,true);j.hide()}else{n=Math.max(0,n);n=Math.min(n,1);n==0?k.removeClass("mejs-mute").addClass("mejs-unmute"):k.removeClass("mejs-unmute").addClass("mejs-mute");
if(g=="vertical"){var s=m.height(),u=m.position(),v=s-s*n;p.css("top",Math.round(u.top+v-p.height()/2));q.height(s-v);q.css("top",u.top+v)}else{s=m.width();u=m.position();s=s*n;p.css("left",Math.round(u.left+s-p.width()/2));q.width(Math.round(s))}}},h=function(n){var o=null,s=m.offset();if(g=="vertical"){o=m.height();parseInt(m.css("top").replace(/px/,""),10);o=(o-(n.pageY-s.top))/o;if(s.top==0||s.left==0)return}else{o=m.width();o=(n.pageX-s.left)/o}o=Math.max(0,o);o=Math.min(o,1);t(o);o==0?e.setMuted(true):
e.setMuted(false);e.setVolume(o)},l=false,r=false;k.hover(function(){j.show();r=true},function(){r=false;!l&&g=="vertical"&&j.hide()});j.bind("mouseover",function(){r=true}).bind("mousedown",function(n){h(n);d.globalBind("mousemove.vol",function(o){h(o)});d.globalBind("mouseup.vol",function(){l=false;d.globalUnbind(".vol");!r&&g=="vertical"&&j.hide()});l=true;return false});k.find("button").click(function(){e.setMuted(!e.muted)});e.addEventListener("volumechange",function(){if(!l)if(e.muted){t(0);
k.removeClass("mejs-mute").addClass("mejs-unmute")}else{t(e.volume);k.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(d.container.is(":visible")){t(a.options.startVolume);a.options.startVolume===0&&e.setMuted(true);e.pluginType==="native"&&e.setVolume(a.options.startVolume)}}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,isInIframe:false,buildfullscreen:function(a,b,c,e){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=function(){if(a.isFullScreen)if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=
false;a.exitFullScreen()}};mejs.MediaFeatures.hasMozNativeFullScreen?a.globalBind(mejs.MediaFeatures.fullScreenEventName,c):a.container.bind(mejs.MediaFeatures.fullScreenEventName,c)}var d=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+d.id+'" title="'+d.options.fullscreenText+'" aria-label="'+d.options.fullscreenText+'"></button></div>').appendTo(b);if(d.media.pluginType==="native"||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&
mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var h=document.createElement("x"),l=document.documentElement,r=window.getComputedStyle;if(!("pointerEvents"in h.style))return false;h.style.pointerEvents="auto";h.style.pointerEvents="x";l.appendChild(h);r=r&&r(h,"").pointerEvents==="auto";l.removeChild(h);return!!r}()&&!mejs.MediaFeatures.isOpera){var j=false,m=function(){if(j){for(var h in q)q[h].hide();g.css("pointer-events",
"");d.controls.css("pointer-events","");d.media.removeEventListener("click",d.clickToPlayPauseCallback);j=false}},q={};b=["top","left","right","bottom"];var p,t=function(){var h=g.offset().left-d.container.offset().left,l=g.offset().top-d.container.offset().top,r=g.outerWidth(true),n=g.outerHeight(true),o=d.container.width(),s=d.container.height();for(p in q)q[p].css({position:"absolute",top:0,left:0});q.top.width(o).height(l);q.left.width(h).height(n).css({top:l});q.right.width(o-h-r).height(n).css({top:l,
left:h+r});q.bottom.width(o).height(s-n-l).css({top:l+n})};d.globalBind("resize",function(){t()});p=0;for(c=b.length;p<c;p++)q[b[p]]=f('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(m).hide();g.on("mouseover",function(){if(!d.isFullScreen){var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,false);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(p in q)q[p].show();
t();j=true}});e.addEventListener("fullscreenchange",function(){d.isFullScreen=!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);m()});d.globalBind("mousemove",function(h){if(j){var l=g.offset();if(h.pageY<l.top||h.pageY>l.top+g.outerHeight(true)||h.pageX<l.left||h.pageX>l.left+g.outerWidth(true)){g.css("pointer-events","");d.controls.css("pointer-events","");j=false}}})}else g.on("mouseover",
function(){if(k!==null){clearTimeout(k);delete k}var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,true)}).on("mouseout",function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(h){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&h.keyCode==27)a.exitFullScreen()})}},cleanfullscreen:function(a){a.exitFullScreen()},
containerSizeTimeout:null,enterFullScreen:function(){var a=this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){f(document.documentElement).addClass("mejs-fullscreen");normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==
screen.width?a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,
"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.media.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find(".mejs-shim").width("100%").height("100%");a.media.setVideoSize(f(window).width(),
f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){clearTimeout(this.containerSizeTimeout);if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();
f(document.documentElement).removeClass("mejs-fullscreen");this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.media.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find(".mejs-shim").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");
this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),hideCaptionsButtonWhenEmpty:true,toggleCaptionsButtonWhenOnlyOne:false,slidesSelector:""});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,e){if(a.tracks.length!=0){var d;if(this.domNode.textTracks)for(d=this.domNode.textTracks.length-1;d>=0;d--)this.domNode.textTracks[d].mode="hidden";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).hide();a.captions=
f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover"><span class="mejs-captions-text"></span></div></div>').prependTo(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'" aria-label="'+this.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+
a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(b);for(d=b=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&b++;this.options.toggleCaptionsButtonWhenOnlyOne&&b==1?a.captionsButton.on("click",function(){a.setTrack(a.selectedTrack==null?a.tracks[0].srclang:"none")}):a.captionsButton.hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},
function(){f(this).find(".mejs-captions-selector").css("visibility","hidden")}).on("click","input[type=radio]",function(){lang=this.value;a.setTrack(lang)});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});
a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(d=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&a.addTrackButton(a.tracks[d].srclang,a.tracks[d].label);a.loadNextTrack();e.addEventListener("timeupdate",function(){a.displayCaptions()},false);if(a.options.slidesSelector!=""){a.slidesContainer=f(a.options.slidesSelector);e.addEventListener("timeupdate",function(){a.displaySlides()},false)}e.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!e.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},setTrack:function(a){var b;if(a=="none"){this.selectedTrack=null;this.captionsButton.removeClass("mejs-captions-enabled")}else for(b=0;b<this.tracks.length;b++)if(this.tracks[b].srclang==a){this.selectedTrack==
null&&this.captionsButton.addClass("mejs-captions-enabled");this.selectedTrack=this.tracks[b];this.captions.attr("lang",this.selectedTrack.srclang);this.displayCaptions();break}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else{this.isLoadingTrack=false;this.checkForTracks()}},loadTrack:function(a){var b=this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(e){c.entries=typeof e=="string"&&
/<tt\s+xml/ig.exec(e)?mejs.TrackFormatParser.dfxp.parse(e):mejs.TrackFormatParser.webvvt.parse(e);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false);c.kind=="slides"&&b.setupSlides(c)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+a+"]").prop("disabled",false).siblings("label").html(b);
this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},
adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},checkForTracks:function(){var a=false;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i<this.tracks.length;i++)if(this.tracks[i].kind=="subtitles"){a=true;break}if(!a){this.captionsButton.hide();this.setControlsSize()}}},displayCaptions:function(){if(typeof this.tracks!=
"undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);this.captions.show().height(0);return}this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if(!(typeof this.tracks=="undefined"||typeof this.slidesContainer==
"undefined")){var b=this,c=b.slides.entries.text[a],e=b.slides.entries.imgs[a];if(typeof e=="undefined"||typeof e.fadeIn=="undefined")b.slides.entries.imgs[a]=e=f('<img src="'+c+'">').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()});else!e.is(":visible")&&!e.is(":animated")&&e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if(typeof this.slides!="undefined"){var a=this.slides,b;for(b=0;b<a.entries.times.length;b++)if(this.media.currentTime>=
a.entries.times[b].start&&this.media.currentTime<=a.entries.times[b].stop){this.showSlide(b);break}}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,e,d=e=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){e=a.entries.times[c].stop-a.entries.times[c].start;e=Math.floor(e/b.media.duration*100);if(e+d>100||c==a.entries.times.length-
1&&e+d<100)e=100-d;b.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[c].start+'" style="left: '+d.toString()+"%;width: "+e.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));d+=e}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},e,d;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((e=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;d=a[b];for(b++;a[b]!==""&&b<a.length;){d=d+"\n"+a[b];b++}d=f.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(d);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(e[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(e[1]),
stop:mejs.Utility.convertSMPTEtoSeconds(e[3]),settings:e[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var e,d;a={text:[],times:[]};if(b.length){d=b.removeAttr("id").get(0).attributes;if(d.length){e={};for(b=0;b<d.length;b++)e[d[b].name.split(":")[1]]=d[b].value}}for(b=0;b<c.length;b++){var g;d={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
if(!d.start&&c.eq(b-1).attr("end"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!d.stop&&c.eq(b+1).attr("begin"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(e){g="";for(var k in e)g+=k+":"+e[k]+";"}if(g)d.style=g;if(d.start==0)d.start=0.2;a.times.push(d);d=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
"<a href='$1' target='_blank'>$1</a>");a.text.push(d);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],e="",d;for(d=0;d<a.length;d++){e+=a.substring(d,d+1);if(b.test(e)){c.push(e.replace(b,""));e=""}}c.push(e);return c}})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?mejs.i18n.t("Turn off Fullscreen"):mejs.i18n.t("Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("Unmute"):mejs.i18n.t("Mute")},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return mejs.i18n.t("Download Video")},
click:function(a){window.location.href=a.media.currentSrc}}]});f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},
isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,
b){for(var c=this,e="",d=c.options.contextMenuItems,g=0,k=d.length;g<k;g++)if(d[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var j=d[g].render(c);if(j!=null)e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+j+"</div>"}c.contextMenu.empty().append(f(e)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var m=f(this),q=parseInt(m.data("itemindex"),10),p=c.options.contextMenuItems[q];typeof p.show!=
"undefined"&&p.show(m,c);m.click(function(){typeof p.click!="undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var e=this.container.find('link[rel="postroll"]').attr("href");if(typeof e!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
function(){f.ajax({dataType:"html",url:e,success:function(d){c.find(".mejs-postroll-layer-content").html(d)}});a.postroll.show()},false)}}})})(mejs.$);

253
js/models.js Normal file
View File

@ -0,0 +1,253 @@
window.soundwalk = window.soundwalk || {};
(function($){
var Info, Point, Points, walk, Marker, Markers;
walk = soundwalk.walk = function () {
}
_.extend(walk, { model: {}, view: {}, controller: {}, frames: {}, constants: {}, icons:{} });
_.extend(walk, {
/**
* media.template( id )
*
* Fetches a template by id.
* See wp.template() in `wp-includes/js/wp-util.js`.
*/
template: wp.template,
/**
* media.post( [action], [data] )
*
* Sends a POST request to WordPress.
* See wp.ajax.post() in `wp-includes/js/wp-util.js`.
*/
post: wp.ajax.post,
/**
* media.ajax( [action], [options] )
*
* Sends an XHR request to WordPress.
* See wp.ajax.send() in `wp-includes/js/wp-util.js`.
*/
ajax: wp.ajax.send
});
//Define constants
walk.constants.PLAY_POINT = 1;
walk.constants.LOOP_POINT = 2;
walk.constants.END_POINT = 3;
walk.constants.WIFI_POINT = 4;
walk.constants.LAYER_POINT = 5;
walk.icons.Play = new L.Icon({
iconUrl: '../wp-content/plugins/soundwalk/img/markers_play.png',
iconSize: [25, 41],
iconAnchor: [12,41]
});
walk.icons.Loop = new L.Icon({
iconUrl: '../wp-content/plugins/soundwalk/img/markers_loop.png',
iconSize: [25, 41],
iconAnchor: [12,41]
});
walk.icons.End = new L.Icon({
iconUrl: '../wp-content/plugins/soundwalk/img/markers_end.png',
iconSize: [25, 41],
iconAnchor: [12,41]
});
walk.icons.Wifi = new L.Icon({
iconUrl: '../wp-content/plugins/soundwalk/img/markers_wifi.png',
iconSize: [25, 41],
iconAnchor: [12,41]
});
walk.icons.Layer = new L.Icon({
iconUrl: '../wp-content/plugins/soundwalk/img/markers_layer.png',
iconSize: [25, 41],
iconAnchor: [12,41]
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
Info = walk.model.Info = Backbone.Model.extend({
}); //Model Info
/* ----------------------------------------------------------------------------------------------------------------------------*/
Point = walk.model.Point = Backbone.Model.extend({
toGeoJSON: function(){
var r = {
type: "Feature",
geometry: {
type: "Circle",
coordinates: [parseFloat(this.attributes.lng), parseFloat(this.attributes.lat)],
radius: parseFloat(this.get('radius'))
},
properties:{
id: this.attributes.id,
title: this.attributes.title,
radius_units: 'm',
layer: parseInt(this.get('layer')),
file: this.get('fileInfo').get('filename'),
type: parseInt(this.get('type'))
}
};
switch(this.get('type')){
case walk.constants.WIFI_POINT:
r.properties.wifi= this.get('wifi');
break;
case walk.constants.LAYER_POINT:
r.properties.toLayer= parseInt(this.get('toLayer'));
break;
}
return r;
}
}); //Model Point
/* ----------------------------------------------------------------------------------------------------------------------------*/
Points = walk.model.Points = Backbone.Collection.extend({
model: Point,
toGeoJSON: function(){
var r = {
type: "FeatureCollection",
features: []
};
this.forEach(function(element, index, list){
r.features.push(element.toGeoJSON());
}, this);
return r;
}
});// Collection Points
/* ----------------------------------------------------------------------------------------------------------------------------*/
Marker = walk.model.Marker = Backbone.Model.extend({
toGeoJSON: function(){
var r = {
type: "Feature",
geometry: {
type: "Point",
coordinates: [parseFloat(this.attributes.lng), parseFloat(this.attributes.lat)]
},
properties:{
id: this.attributes.id,
title: this.attributes.title
}
};
return r;
}
}); //Model Marker
/* ----------------------------------------------------------------------------------------------------------------------------*/
Markers = walk.model.Markers = Backbone.Collection.extend({
model: Marker,
sync: function (method, model, options){
if ('read' === method){
options = options || {};
options.context = this;
options.data = _.extend( options.data || {}, {
action: 'get-markers-collection'
});
return walk.ajax( options );
}
},//sync
toGeoJSON: function(){
var r = {
type: "FeatureCollection",
features: []
};
this.forEach(function(element, index, list){
r.features.push(element.toGeoJSON());
}, this);
return r;
},//toGeoJSON
parse: function( resp, xhr ) {
if ( ! resp )
return resp;
return resp;
}//parse
}); // Collection Markers
/* ----------------------------------------------------------------------------------------------------------------------------*/
Audio = walk.model.Audio = Backbone.Model.extend({
sync: function (method, model, options){
if ('read' === method){
options = options || {};
options.context = this;
options.data = _.extend( options.data || {}, {
action: 'get-attachment',
id: options.id
});
return walk.ajax( options );
}
}//sync
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
WalkM = walk.model.Walk = Backbone.Model.extend({
sync: function (method, model, options){
if ('create' === method && model){
options = options || {};
options.context = this;
options.data = _.extend( options.data || {}, {
action: 'save-walk',
data: JSON.stringify(model.toJSON())
});
return walk.ajax( options );
}
if ('update' === method && model){
options = options || {};
options.context = this;
options.data = _.extend( options.data || {}, {
action: 'save-walk',
data: JSON.stringify(model.toJSON()),
id: model.get('id')
});
return walk.ajax( options );
}
if ('read' === method && model){
options = options || {};
options.context = this;
options.data = _.extend( options.data || {}, {
action: 'get-walk',
id: options.id
});
return walk.ajax( options );
}
}//sync
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
}(jQuery));

7
js/route.js Normal file
View File

@ -0,0 +1,7 @@
/**
* Created with JetBrains PhpStorm.
* User: xavi
* Date: 06/11/13
* Time: 15:06
* To change this template use File | Settings | File Templates.
*/

795
js/views.js Normal file
View File

@ -0,0 +1,795 @@
(function($){
var soundwalk = window.soundwalk.walk,
config = SoundwalkOptions; // Configuración inicial del mapa
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW WALKMAP
Este view se encarga del mapa general de preview de un paseo.
*/
soundwalk.view.WalkMap = Backbone.View.extend({
el: $('#walk-preview'),
map: undefined,
collection: new soundwalk.model.Points,
layers: [],
state: 0, //0 = normal, 1 = añadir punto , 2 = delete, 3 = edit
initialize: function(){
this.render();
this.listenTo(this.collection, 'add', this.addPoint);
this.listenTo(this.collection, 'reset', this.resetCollection);
},
render: function(){
if(this.map === undefined){
//No existe el mapa y por lo tanto tenemos que crearlo para el renderizarlo.
this.map = L.map('walk-map').setView([config.lat, config.lng], config.zoom);
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 6, maxZoom: 19, attribution: osmAttrib});
this.map.addLayer(osm);
for (var i = 0; i<7; i++){
this.layers.push(L.layerGroup().addTo(this.map));
}
var oL = {
"Todos": this.layers[0],
"Capa 1": this.layers[1],
"Capa 2": this.layers[2],
"Capa 3": this.layers[3],
"Capa 4": this.layers[4],
"Capa 5": this.layers[5],
"Capa 6": this.layers[6]
}
L.control.layers({'Base': osm},oL).addTo(this.map);
}
},//render
deleteMode: function(){
this.state = 2;
},
editMode: function(){
this.state = 3;
},
changeType: function(point, type){
var _l = point.get('layer'),
_mLID = point.get('mLID'),
_m = this.layers[_l].getLayer(_mLID);
switch (type){
case soundwalk.constants.PLAY_POINT:
_m.setIcon(soundwalk.icons.Play);
break;
case soundwalk.constants.LOOP_POINT:
_m.setIcon(soundwalk.icons.Loop);
break;
case soundwalk.constants.END_POINT:
_m.setIcon(soundwalk.icons.End);
break;
case soundwalk.constants.WIFI_POINT:
_m.setIcon(soundwalk.icons.Wifi);
break;
case soundwalk.constants.LAYER_POINT:
_m.setIcon(soundwalk.icons.Layer);
break;
}
},
createPoint: function(){
this.state = 1;
this.map.addOneTimeEventListener('click', this.mapClicked, this);
},
mapClicked: function(event){
var latlng = event.latlng;
var marker = L.marker(latlng,{draggable: true, title: '', icon: soundwalk.icons.Layer});
var circle = L.circle(latlng, 5);
this.stopListening(this.collection);
var _p = new soundwalk.model.Point;
_p.set({
mID: '',
lat:latlng.lat,
lng: latlng.lng,
title: '',
files: '',
fileInfo: '',
autor: '',
type: soundwalk.constants.LAYER_POINT,
radius: 5,
layer: 0,
id: '',
toLayer: 1,
wifi: '',
vibrate: false,
autofade: false
});
this.collection.add(_p);
this.listenTo(this.collection, 'add', this.addPoint);
marker.pID = _p.cid;
this.layers[0].addLayer(circle);
this.layers[0].addLayer(marker);
marker.addEventListener('dragend', this.markerMoved, this);
marker.addEventListener('click', this.markerClicked, this);
_p.set({
mLID: this.layers[0].getLayerId(marker),
cLID: this.layers[0].getLayerId(circle),
id: _p.cid
});
this.state = 0;
this.trigger('createdPoint', _p);
},
changeLayer: function(point, layer){
var cLID = point.get('cLID');
var mLID = point.get('mLID');
var _l = point.get('layer');
var _c = this.layers[_l].getLayer(cLID);
var _m = this.layers[_l].getLayer(mLID);
this.layers[_l].removeLayer(_c);
this.layers[_l].removeLayer(_m);
this.layers[layer].addLayer(_c);
this.layers[layer].addLayer(_m);
},
changeRadius: function(point, radius){
var _p = this.collection.get(point.get('id'));
var cLID = _p.get('cLID');
var _l = _p.get('layer');
var _c = this.layers[_l].getLayer(cLID);
_c.setRadius(radius);
},
resetCollection: function(collection, options){
collection.forEach( function(element, index, list){
var marker = L.marker([element.get('lat'), element.get('lng')],{draggable: true, clickable: true, title: element.get('title'), icon: soundwalk.icons.Play});
var circle = L.circle([element.get('lat'), element.get('lng')], element.get('radius'));
var _l = element.get('layer');
marker.pID = element.get('id');
this.layers[_l].addLayer(circle);
this.layers[_l].addLayer(marker);
marker.addEventListener('dragend', this.markerMoved, this);
marker.addEventListener('click', this.markerClicked, this);
element.set({
mLID: this.layers[_l].getLayerId(marker),
cLID: this.layers[_l].getLayerId(circle)
});
}, this);
},
addPoint: function(model, collection, options){
var marker = L.marker([model.get('lat'), model.get('lng')],{draggable: true, clickable: true, title: model.get('title'), icon: soundwalk.icons.Play});
var circle = L.circle([model.get('lat'), model.get('lng')], model.get('radius'));
var _l = model.get('layer');
marker.pID = model.get('id');
this.layers[_l].addLayer(circle);
this.layers[_l].addLayer(marker);
marker.addEventListener('dragend', this.markerMoved, this);
marker.addEventListener('click', this.markerClicked, this);
model.set({
mLID: this.layers[_l].getLayerId(marker),
cLID: this.layers[_l].getLayerId(circle)
});
},
markerClicked: function(event){
switch(this.state){
case 2:
//delete mode
var _m = event.target,
_pID = event.target.pID,
_p = this.collection.get(_pID),
_l = _p.get('layer'),
_cLID = _p.get('cLID'),
_c = this.layers[_l].getLayer(_cLID);
this.layers[_l].removeLayer(_c);
this.layers[_l].removeLayer(_m);
this.collection.remove(_p);
this.trigger('deletedPoint', _p);
break;
case 3:
//edit mode
var _m = event.target,
_pID = event.target.pID,
_p = this.collection.get(_pID);
this.trigger('editPoint', _p);
break;
}
},
markerMoved:function(event){
var _m = event.target,
_pID = event.target.pID,
latlng = event.target.getLatLng(),
_p = this.collection.get(_pID),
_l = _p.get('layer'),
_cLID = _p.get('cLID'),
_c = this.layers[_l].getLayer(_cLID);
_p.set({
lat: latlng.lat,
lng: latlng.lng
})
_c.setLatLng(latlng);
}
}); // view.WalkMap
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW AudioPlayer
*/
soundwalk.view.AudioPlayer = Backbone.View.extend({
template: soundwalk.template('audio-player'),
model: new soundwalk.model.Audio,
initialize: function(){
this.listenTo(this.model, 'sync', this.render);
this.model.fetch({id: this.options.aID});
},
render: function(){
var _u = this.model.get('url');
this.$el.html(this.template({url: _u}));
this.$('audio').mediaelementplayer({
audioWidth: '100%',
audioHeight: 50,
features: ['playpause','progress','volume']
});
}
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW MARKERSMAP
Este view se encarga del mapa con los marcadores generales.
*/
soundwalk.view.MarkersMap = Backbone.View.extend({
el: $('#markersWrapper'),
map: undefined,
collection: new soundwalk.model.Markers,
self: undefined,
player: undefined,
template: soundwalk.template('marker-info'),
marker:undefined,
events:{
'click #marker-add-button button': 'addPoint'
},
initialize: function(){
self = this;
this.listenTo(this.collection, 'sync', this.render);
this.collection.fetch();
this.render();
},//initialize
render: function(){
if(this.map === undefined){
//No existe el mapa y por lo tanto tenemos que crearlo para el renderizarlo.
this.map = L.map('markersMap').setView([config.lat, config.lng], config.zoom);
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 6, maxZoom: 19, attribution: osmAttrib});
this.map.addLayer(osm);
}
if(!this.collection.isEmpty()){
//La colección no está vacia, por lo que tengo que poner los puntos en el mapa.
L.geoJson(this.collection.toGeoJSON(),{
onEachFeature: function(feature, layer){
layer.on('click', self.onMarkerClick);
}
}).addTo(this.map);
}
},//render
onMarkerClick: function(event){
//utilizar self porque no podemos acceder con THIS!!!!
var layer = event.target;
var feature = layer.feature;
var id = feature.properties.id;
//self.trigger('markerClick', self.collection.get(id));
self.markerClick(self.collection.get(id));
},
markerClick: function (marker){
this.marker = marker;
this.player = new soundwalk.view.AudioPlayer({aID: marker.get('files')});
this.player.setElement(this.$('#marker-player'));
this.$('#marker-info-text').html(this.template({title: marker.get('title')}));
this.$('#marker-add-button').show();
},
addPoint: function (event){
self.trigger('markerClick', this.marker );
tb_remove();
}
});//view.MarkersMap
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW PointInfo
Este view responde a las selecciones de un punto o de un marcador y permite
configurar los elementos de cada punto.
*/
soundwalk.view.PointInfo = Backbone.View.extend({
el: $('#soundwalk-datos'),
model: new soundwalk.model.Info,
file_frame: wp.media.frames.file_frame = wp.media({
multiple: false,
library: {
type: 'image'
}
}),
image_template: soundwalk.template('point-info-picture'),
events: {
'click #walk-submit': 'onSubmit',
'click #walk-picture-wrapper a': 'openMediaSelector'
},
initialize:function(){
this.file_frame.on('select',this.pictureSelected, this);
this.listenTo(this.model, 'change', this.updateFields);
this.model.set({fID: ''});
},
updateFields: function (model, options){
this.$('#title').val(model.get('title'));
this.$('#walk-excerpt').val(model.get('description'));
this.$('#walk-language').val(model.get('language'));
this.$('#walk-picture-preview').html(this.image_template({url: model.get('fileName')}));
},
validate: function(){
var _i = {
title: this.$('#title').val(),
description: this.$('#walk-excerpt').val(),
language: this.$('#walk-language').val()
}
this.model.set(_i);
if (_i.title == ""){
return false;
}
return true;
},
pictureSelected: function(){
var attachment = this.file_frame.state().get('selection').first().toJSON();
var thumb = attachment.sizes.thumbnail.url;
var id = attachment.id;
this.$('#walk-picture-preview').html(this.image_template({url: thumb}));
this.model.set({
fID: id,
fileName: attachment.filename
});
},
openMediaSelector: function(event){
event.preventDefault();
if ( this.file_frame ){
this.file_frame.open();
return;
};
},
onSubmit: function(event){
event.preventDefault();
this.trigger('submit');
//console.log(editor.toGeoJSON());
}
});// PointInfo
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW PointEditor
Este view responde a las selecciones de un punto o de un marcador y permite
configurar los elementos de cada punto.
*/
soundwalk.view.PointEditor = Backbone.View.extend({
el: $('#walk-point-editor'),
template: soundwalk.template('point-editor-template'),
events: {
'click #toggle-tipos a': 'toggleType',
'click #layer-point a': 'toggleLayer',
'click #layer-change-point a': 'changeToLayer',
'change #wifi-point-essid': 'wifiChange',
'click #option-vibrate': 'toggleVibrate',
'click #option-autofade': 'toggleAutofade'
},
initialize:function(){
this.render();
},
toggleVibrate: function(event){
event.preventDefault();
var _t = event.currentTarget;
this.$(_t).toggleClass('selected');
var _r = this.model.get('vibrate');
this.model.set({vibrate: !(_r)});
},
toggleAutofade: function(event){
event.preventDefault();
var _t = event.currentTarget;
this.$(_t).toggleClass('selected');
var _r = this.model.get('autofade');
this.model.set({autofade: !(_r)});
},
wifiChange: function(event){
var _t = event.currentTarget;
this.model.set({wifi: _t.value});
},
changeToLayer: function(event){
event.preventDefault();
var _t = event.currentTarget,
layer = _t.dataset.layer;
this.$('#layer-change-point a').removeClass('selected');
this.$(_t).addClass('selected');
this.trigger('layerToChange', this.model, layer );
this.model.set({toLayer: layer});
},
toggleLayer: function(event){
event.preventDefault();
var _t = event.currentTarget,
layer = _t.dataset.layer;
this.$('#layer-point a').removeClass('selected');
this.$(_t).addClass('selected');
this.trigger('layerChange', this.model, layer );
this.model.set({layer: layer});
},
toggleType: function(event){
var _t = event.currentTarget,
tipo = _t.dataset.type;
this.$('#toggle-tipos a').removeClass('selected');
this.$(_t).addClass('selected');
var _type = 0;
switch(tipo){
case 'play':
_type = soundwalk.constants.PLAY_POINT;
this.$('#wifi-point').hide();
this.$('#layer-change-point').hide();
break;
case 'loop':
_type = soundwalk.constants.LOOP_POINT;
this.$('#wifi-point').hide();
this.$('#layer-change-point').hide();
break;
case 'end':
_type = soundwalk.constants.END_POINT;
this.$('#wifi-point').hide();
this.$('#layer-change-point').hide();
break;
case 'wifi':
_type = soundwalk.constants.WIFI_POINT;
this.$('#wifi-point').show();
this.$('#layer-change-point').hide();
break;
case 'layer':
_type = soundwalk.constants.LAYER_POINT;
this.$('#wifi-point').hide();
this.$('#layer-change-point').show();
break;
}
event.preventDefault();
this.trigger('typeChange', this.model, _type );
this.model.set({type: _type});
},
render: function(){
if(_.isUndefined(this.model)){
return;
}
var _t = this.template({
title: this.model.get('title'),
type: this.model.get('type'),
autor: this.model.get('autor'),
radio: this.model.get('radius'),
layer: this.model.get('layer'),
toLayer: this.model.get('toLayer'),
wifi: this.model.get('wifi'),
autofade: this.model.get('autofade'),
vibrate: this.model.get('vibrate')
});
this.$el.html(_t);
this.audioplayer = new soundwalk.view.AudioPlayer({aID: this.model.get('files')});
this.audioplayer.setElement(this.$('#point-player'));
this.$('.slider-radio').slider({
min: 0,
max: 99,
value: 5
});
this.$('.slider-radio').bind('slide', _.bind(this.slide, this));
this.$('#layer-change-point').hide();
if(this.model.get('type') == 5){
this.$('#layer-change-point').show();
}
this.$('#wifi-point').hide();
if(this.model.get('type') == 4){
this.$('#wifi-point').show();
}
},
clean: function(){
this.$el.empty();
this.reset();
this.model = undefined;
},
reset:function(){
this.undelegateEvents();
},
slide: function(event, ui){
this.$('.slider-radio-value').text('Radio: ' + ui.value + 'm');
this.trigger('radiusChange', this.model, ui.value );
this.model.set({radius: ui.value});
}
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW MessagePanel
*/
soundwalk.view.Messages = Backbone.View.extend({
el:$('#soundwalk-messages'),
initialize: function(){
this.render();
},
render: function(){
this.$el.hide();
},
showMessage: function(mess, type){
this.$el.empty();
this.$el.html("<div class='" + type + "'><p>" + mess + "</p></div>");
this.$el.show();
this.$el.fadeIn('fast');
}
});
/* ----------------------------------------------------------------------------------------------------------------------------*/
/*
VIEW WALKEDITOR
Este view se encarga del mapa con los marcadores generales.
*/
soundwalk.view.WalkEditor = Backbone.View.extend({
el: $('#walk-editor'),
markersMap: new soundwalk.view.MarkersMap, //Vista de los marcadores
// points: new soundwalk.model.Points, Colección de puntos
pointEditor: undefined,
walkMap: new soundwalk.view.WalkMap,
pointInfo: new soundwalk.view.PointInfo,
walk: new soundwalk.model.Walk,
messages: new soundwalk.view.Messages,
events: {
"click #create-point": "createPoint",
"click #delete-point": "deletePoint",
"click #edit-point": "editPoint"
},
initialize: function(){
this.listenTo(this.markersMap, 'markerClick', this.addPoint);
this.listenTo(this.pointInfo, 'submit', this.submit);
this.walk.set({
points: new soundwalk.model.Points,
info: new soundwalk.model.Info
});
if (_.has(config,'edit_Walk')){
//tenemos que cargar el paseo para poder ponerlo!!!
var _id = config.edit_Walk;
this.listenToOnce(this.walk, 'sync', this.walkLoaded);
this.walk.fetch({id: _id});
}
//this.listenTo(this.points, 'add', this.addPointToMap);
},
submit: function(){
var valid_info = this.pointInfo.validate();
if (valid_info){
this.walk.set({info: this.pointInfo.model});
this.listenToOnce(this.walk, 'sync', this.walkSaved);
this.walk.save();
}
},
walkLoaded: function(model, resp, options){
//creo los puntos
this.walkMap.collection.reset(model.get('points'));
this.pointInfo.model = this.pointInfo.model.set(model.get('info'));
this.walk.set({
points: this.walkMap.collection,
info: this.pointInfo.model
})
},
walkSaved: function(model, resp, options){
this.messages.showMessage('Paseo guardado correctamente', 'updated');
},
editPoint: function(){
this.listenToOnce(this.walkMap, 'editPoint', this.editedPoint);
this.walkMap.editMode();
this.$('#editor-toolbar li').removeClass('selected');
this.$('#edit-point').addClass('selected');
},
editedPoint: function(point){
if(!_.isUndefined(this.pointEditor)){
this.pointEditor.reset();
this.stopListening(this.pointEditor);
}
this.pointEditor = new soundwalk.view.PointEditor({model: point});
this.listenTo(this.pointEditor, 'radiusChange', this.radiusChange);
this.listenTo(this.pointEditor, 'typeChange', this.typeChange);
this.listenTo(this.pointEditor, 'layerChange', this.layerChange);
this.$('#edit-point').removeClass('selected');
},
deletePoint:function(){
this.listenToOnce(this.walkMap, 'deletedPoint', this.deletedPoint);
this.walkMap.deleteMode();
this.$('#editor-toolbar li').removeClass('selected');
this.$('#delete-point').addClass('selected');
},
deletedPoint: function(point){
this.$('#editor-toolbar li').removeClass('selected');
this.walk.get('points').remove(point);
//this.points.remove(point);
if(this.pointEditor.model === point){
this.pointEditor.clean();
}
},
createPoint:function(){
this.listenToOnce(this.walkMap, 'createdPoint', this.createdPoint);
this.$('#editor-toolbar li').removeClass('selected');
this.$('#create-point').addClass('selected');
this.walkMap.createPoint();
},
createdPoint: function(point){
//this.points.add(point);
this.walk.get('points').add(point);
if(!_.isUndefined(this.pointEditor)){
// this.pointEditor.remove();
this.pointEditor.reset();
this.stopListening(this.pointEditor);
}
this.pointEditor = new soundwalk.view.PointEditor({model: point});
this.listenTo(this.pointEditor, 'radiusChange', this.radiusChange);
this.listenTo(this.pointEditor, 'typeChange', this.typeChange);
this.listenTo(this.pointEditor, 'layerChange', this.layerChange);
this.$('#editor-toolbar li').removeClass('selected');
},
layerChange: function(point, layer){
this.walkMap.changeLayer(point, layer);
},
radiusChange: function(point, radius){
this.walkMap.changeRadius(point, radius);
},
typeChange: function(point, type){
this.walkMap.changeType(point, type);
},
addPoint: function(marker){
var _p = new soundwalk.model.Point;
_p.set({
mID: marker.get('id'),
lat: marker.get('lat'),
lng: marker.get('lng'),
title: marker.get('title'),
files: marker.get('files'),
fileInfo: new soundwalk.model.Audio,
autor: marker.get('autor'),
type: soundwalk.constants.PLAY_POINT,
radius: 5,
layer: 0,
id: marker.get('id'),
toLayer: 0,
wifi: '',
autofade: false,
vibrate: false
});
_p.get('fileInfo').fetch({id: marker.get('files')});
//this.points.add(_p);
this.walk.get('points').add(_p);
if(!_.isUndefined(this.pointEditor)){
// this.pointEditor.remove();
this.pointEditor.reset();
this.stopListening(this.pointEditor);
}
this.pointEditor = new soundwalk.view.PointEditor({model: _p});
this.walkMap.collection.add(_p);
this.listenTo(this.pointEditor, 'radiusChange', this.radiusChange);
this.listenTo(this.pointEditor, 'typeChange', this.typeChange);
this.listenTo(this.pointEditor, 'layerChange', this.layerChange);
},
toGeoJSON: function(){
return this.get('points').toGeoJSON();
//return this.points.toGeoJSON();
},
addPointToMap: function(model, collection, options){
this.markersMap.addPoint(model);
}
});
}(jQuery));

371
libs/classes.php Normal file
View File

@ -0,0 +1,371 @@
<?php
if(!class_exists('WP_List_Table')){
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
if (!class_exists('Soundwalk_Paseos_List_Table')){
class Soundwalk_Paseos_List_Table extends WP_List_Table{
/** ************************************************************************
* REQUIRED. Set up a constructor that references the parent constructor. We
* use the parent reference to set some default configs.
***************************************************************************/
function __construct(){
global $status, $page;
//Set parent defaults
parent::__construct( array(
'singular' => 'walk', //singular name of the listed records
'plural' => 'walks', //plural name of the listed records
'ajax' => false //does this table support ajax?
) );
} //__construct
function prepare_items() {
/**
* First, lets decide how many records per page to show
*/
$per_page = 10;
$columns = $this->get_columns();
$hidden = array('id');
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
/**
* Instead of querying a database, we're going to fetch the example data
* property we created for use in this plugin. This makes this example
* package slightly different than one you might build on your own. In
* this example, we'll be using array manipulation to sort and paginate
* our data. In a real-world implementation, you will probably want to
* use sort and pagination data to build a custom query instead, as you'll
* be able to use your precisely-queried data immediately.
*/
// $data = $this->example_data;
$db_helper = new Soundwalk_DB_Helper();
$data = $db_helper->get_array_walks();
/**
* This checks for sorting input and sorts the data in our array accordingly.
*
* In a real-world situation involving a database, you would probably want
* to handle sorting by passing the 'orderby' and 'order' values directly
* to a custom query. The returned data will be pre-sorted, and this array
* sorting technique would be unnecessary.
*/
function usort_reorder($a,$b){
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'title'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
}
//usort($data, 'usort_reorder');
/***********************************************************************
* ---------------------------------------------------------------------
* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*
* In a real-world situation, this is where you would place your query.
*
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* ---------------------------------------------------------------------
**********************************************************************/
/**
* REQUIRED for pagination. Let's figure out what page the user is currently
* looking at. We'll need this later, so you should always include it in
* your own package classes.
*/
$current_page = $this->get_pagenum();
/**
* REQUIRED for pagination. Let's check how many items are in our data array.
* In real-world use, this would be the total number of items in your database,
* without filtering. We'll need this later, so you should always include it
* in your own package classes.
*/
$total_items = count($data);
/**
* The WP_List_Table class does not handle pagination for us, so we need
* to ensure that the data is trimmed to only the current page. We can use
* array_slice() to
*/
$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
/**
* REQUIRED. Now we can add our *sorted* data to the items property, where
* it can be used by the rest of the class.
*/
$this->items = $data;
/**
* REQUIRED. We also have to register our pagination options & calculations.
*/
$this->set_pagination_args( array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
) );
}//prepare_items
/** ************************************************************************
* REQUIRED! This method dictates the table's columns and titles. This should
* return an array where the key is the column slug (and class) and the value
* is the column's title text. If you need a checkbox for bulk actions, refer
* to the $columns array below.
*
* The 'cb' column is treated differently than the rest. If including a checkbox
* column in your table you must create a column_cb() method. If you don't need
* bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
*
* @see WP_List_Table::::single_row_columns()
* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
**************************************************************************/
function get_columns(){
$columns = array(
'id' => 'ID',
'name' => 'Title',
'excerpt' => 'Info',
'recordings' => 'Number of recordings'
);
return $columns;
}
/** ************************************************************************
* Recommended. This method is called when the parent class can't find a method
* specifically build for a given column. Generally, it's recommended to include
* one method for each column you want to render, keeping your package class
* neat and organized. For example, if the class needs to process a column
* named 'title', it would first see if a method named $this->column_title()
* exists - if it does, that method will be used. If it doesn't, this one will
* be used. Generally, you should try to use custom column methods as much as
* possible.
*
* Since we have defined a column_title() method later on, this method doesn't
* need to concern itself with any column with a name of 'title'. Instead, it
* needs to handle everything else.
*
* For more detailed insight into how columns are handled, take a look at
* WP_List_Table::single_row_columns()
*
* @param array $item A singular item (one full row's worth of data)
* @param array $column_name The name/slug of the column to be processed
* @return string Text or HTML to be placed inside the column <td>
**************************************************************************/
function column_default($item, $column_name){
switch($column_name){
case 'name':
case 'id':
case 'excerpt':
case 'recordings':
return $item[$column_name];
default:
return print_r($item,true); //Show the whole array for troubleshooting purposes
}
}
function column_name($item){
$actions = array(
'edit' => sprintf('<a href="?page=%s&action=%s&walk=%s">Edit</a>','soundwalk-manage-add','edit',$item['id']),
'delete' => sprintf('<a href="?page=%s&action=%s&walk=%s">Delete</a>',$_REQUEST['page'],'delete',$item['id']),
);
return sprintf('%1$s %2$s', $item['name'], $this->row_actions($actions,true) );
}
/** ************************************************************************
* Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
* you will need to register it here. This should return an array where the
* key is the column that needs to be sortable, and the value is db column to
* sort by. Often, the key and value will be the same, but this is not always
* the case (as the value is a column name from the database, not the list table).
*
* This method merely defines which columns should be sortable and makes them
* clickable - it does not handle the actual sorting. You still need to detect
* the ORDERBY and ORDER querystring variables within prepare_items() and sort
* your data accordingly (usually by modifying your query).
*
* @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
**************************************************************************/
function get_sortable_columns() {
$sortable_columns = array(
'name' => array('name',true), //true means its already sorted
'recordings' => array('recordings',false)
);
return $sortable_columns;
}
function no_items() {
echo "There are no walks.";
}
}//class Areago_List_Table
}
if (!class_exists('PclZip')){
require_once( ABSPATH . 'wp-admin/includes/class-pclzip.php');
}
if (!class_exists('Soundwalk_ZIP')){
class Soundwalk_ZIP{
function create_zip($id){
if ($id == NULL)
return FALSE;
$file_helper = new Soundwalk_File_Helper();
$path = $file_helper->get_Path($id);
$zip_file = new PclZip($path . "/data.zip");
//$zip_file->add(PCLZIP_CB_PRE_ADD,array($this,'myPreAddCallBack'));
$db_helper = new Soundwalk_DB_Helper();
$walk = $db_helper->get_walk($id, true);
if (!$walk)
return FALSE;
//$walk->points = json_decode($walk->points);
$d = json_encode($walk->geoJSONpoints);
$file_helper->save_data_file($path . "/info.json", $d);
$files = array();
$files[] = $path . "/info.json";
foreach ($walk->points as $point){
$files[] = get_attached_file($point->files);
};
$files[] = get_attached_file($walk->pic_id);
$tt = $zip_file->create($files,PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_CB_PRE_ADD,'soundwalk_zipCallBack');
if ($tt == 0) {
die('Error : '.$zip_file->errorInfo(true));
}
unlink($path . '/info.json');
return true;
} //create_zip
}
}
if (!class_exists('Soundwalk_File_Helper')){
class Soundwalk_File_Helper{
function get_Path($id){
if ($this->check()===FALSE){
return FALSE;
}
$uploads = wp_upload_dir();
$uploads_basedir=$uploads["basedir"];
return $uploads_basedir . "/soundwalk/" . $id;
}
function check(){
//This function checks if the upload files is created, its is writeable, if the areago is created, and if it is writeable.
$uploads = wp_upload_dir();
$uploads_basedir=$uploads["basedir"];
$uploads_baseURL=$uploads["baseurl"];
$sound_walk_dir=$uploads_basedir . "/soundwalk";
$dir_exists=is_dir($uploads_basedir);
if (!$dir_exists){
return FALSE;
}
$is_writable=is_writable($uploads_basedir);
if (!$is_writable){
return FALSE;
}
$dir_exists=is_dir($sound_walk_dir);
if (!$dir_exists){
mkdir($sound_walk_dir);
}
$is_writable=is_writable($sound_walk_dir);
if (!$is_writable){
return FALSE;
}
return true;
}
function createFolder($id){
if ($this->check()===FALSE){
return FALSE;
}
$uploads = wp_upload_dir();
$uploads_basedir=$uploads["basedir"];
$sound_walk_dir=$uploads_basedir . "/soundwalk/" . $id;
$dir_exists=is_dir($sound_walk_dir);
if (!$dir_exists){
return mkdir($sound_walk_dir);
}
$is_writable=is_writable($sound_walk_dir);
if (!$is_writable){
return FALSE;
}
return TRUE;
}
function save_data_file($file, $data){
$fp = fopen($file, 'w');
fwrite($fp, $data);
fclose($fp);
}
}//class
}
function soundwalk_zipCallBack($p_event, &$p_header){
$info = pathinfo($p_header['stored_filename']);
// ----- bak files are skipped
if ($info['extension'] == 'jpg') {
$p_header['stored_filename'] = 'icono.jpg';
return 1;
}
// ----- all other files are simply added
else {
return 1;
}
}

214
libs/db_helper.php Normal file
View File

@ -0,0 +1,214 @@
<?php
if (!class_exists('Soundwalk_DB_Helper')){
class Soundwalk_DB_Helper{
const TABLE_NAME ="soundwalks";
function install(){
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_NAME;
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
name tinytext NOT NULL,
picture tinytext,
pic_id tinytext,
excerpt tinytext NOT NULL,
description text NOT NULL,
recordings int DEFAULT 0 NOT NULL,
language tinytext NOT NULL,
size int DEFAULT 0 NOT NULL,
reference longtext DEFAULT '',
points longtext DEFAULT '',
hash tinytext DEFAULT '',
kml longtext DEFAULT '',
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
function get_array_walks(){
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_NAME;
$sql = "SELECT * FROM $table_name";
$res = $wpdb->get_results($sql,ARRAY_A);
return $res;
}
function delete_walk($id){
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_NAME;
$sql = "DELETE FROM $table_name WHERE id='$id'";
$res = $wpdb->get_results($sql,ARRAY_A);
return $res;
}
function get_list_walks(){
$walks = $this->get_array_walks();
if ($walks==NULL)
return NULL;
$r = array();
foreach ($walks as $walk){
$o = new stdClass();
$o->id = $walk['id'];
$o->nombre = $walk['name'];
$o->resumen = $walk['description'];
$o->grabaciones = $walk['recordings'];
$o->idioma = $walk['language'];
$image_attributes = wp_get_attachment_image_src( $walk['pic_id'] );
$o->imagen = $image_attributes[0];
$o->hash = $walk['hash'];
$o->referencia = json_decode($walk['reference']);
$r[] = $o;
}
return $r;
}// get_list_walks
function get_walk($id, $geoJSON = false){
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_NAME;
$sql = "SELECT * FROM $table_name WHERE id = '$id'";
$res = $wpdb->get_row($sql,OBJECT);
if($geoJSON){
$r = json_decode($res->points);
$res->geoJSONpoints = $this->toGeoJSON($r);
$res->points = $r;
}else{
$res->points = json_decode($res->points);
}
return $res;
}// get_walk
function toGeoJSON($data){
$r = new stdClass();
$r->type = "FeatureCollection";
$r->features = array();
foreach ($data as $point){
$p = new stdClass();
$p->type = "Feature";
$p->geometry = new stdClass();
$p->geometry->type = "Circle";
$p->geometry->properties = new stdClass();
$p->geometry->properties->radius_units = "m";
$p->geometry->radius = $point->radius;
$p->geometry->coordinates = array((float)$point->lng,(float)$point->lat);
$p->properties = new stdClass();
if(($point->files != '') && ($point->files != 'null' )){
$p->properties->file = $point->fileInfo->filename;
}
$p->properties->layer = (int)$point->layer;
$p->properties->type = (int)$point->type;
$p->properties->autofade = $point->autofade;
$p->properties->vibrate = (boolean)$point->vibrate;
$p->properties->essid = $point->wifi;
$p->properties->tolayer = (int)$point->toLayer;
$r->features[] = $p;
}
return $r;
}
function updatePointsAudios($points){
if (!is_array($points)) return;
$sm_helper = new Soundmap_Helper();
$r_points = array();
foreach($points as $point){
$_id = $point->mID;
$_m = $sm_helper->get_marker($_id);
if (!$_m){
$r_points[] = $point;
continue;
}
$_title = get_the_title($_id);
$_attID = $_m->marker['attachments'][0]['id'];
$info = wp_prepare_attachment_for_js($_attID);
$n_p = $point;
$n_p->title = $_title;
$n_p->fileInfo = $info;
$n_p->files = $_attID;
$r_points[] = $n_p;
}
return $r_points;
}
function save_walk($data, $update=false){
//guardar el paseo. Si ya existe, lo actualiza.
global $wpdb;
$table_name = $wpdb->prefix . self::TABLE_NAME;
$sql = "INSERT INTO $table_name";
//Primero chequeo que de verdad hay que guardar
$titulo = $data->info->title;
$description = $data->info->description;
$language = $data->info->language;
$pic_id = $data->info->fID;
$total_points = count($data->points);
$points = json_encode($this->updatePointsAudios($data->points));
$hash = md5(uniqid(rand(), TRUE));
if($update){
$res = $wpdb->update(
$table_name,
array(
'name' => $titulo, // string
'pic_id' => $pic_id,
'description' => $description,
'recordings' => $total_points,
'language' => $language,
'points' => $points,
'hash' => $hash,
),
array( 'id' => $_POST['id'] )
);
}else{
$sql .= "(name, pic_id, description, recordings, language, points, hash) ";
$sql .= "VALUES (%s, %s, %s, %d, %s, %s, %s)";
$res = $wpdb->query( $wpdb->prepare($sql,
$titulo,
$pic_id,
$description,
$total_points,
$language,
$points,
$hash
) );
}//else
if ($res){
$result_id = $wpdb->get_var( "SELECT id FROM $table_name WHERE hash='$hash'");
return $result_id;
}else{
return FALSE;
}//$res
}
}//class Soundwalk_DB_Helper
}

12
listado.php Normal file
View File

@ -0,0 +1,12 @@
<?php
header('Content-type: application/json');
require_once( dirname(dirname(dirname(dirname( __FILE__ )))) . '/wp-load.php' );
require_once (dirname( __FILE__ ) . '/libs/db_helper.php');
$db_helper = new Soundwalk_DB_Helper();
$walks = $db_helper->get_list_walks();
echo json_encode($walks);
?>

843
soundwalk.css Normal file
View File

@ -0,0 +1,843 @@
#walk-preview {
height: 600px;
width: 70%;
}
#walk-map {
height: 600px;
}
#markersMapWindow {
height: 495px;
width: 800px;
visibility: hidden;
}
#markersWrapper #markerInfo {
width: 280px;
height: 465px;
float: left;
padding-left: 20px;
}
h3.hndle {
margin-bottom: 0px;
}
textarea {
width: 100%;
}
.panel-left {
float: left;
width: 60%;
}
.panel-right {
float: left;
width: 40%;
}
.panel-right .panel-wrap {
padding: 0 0 0 10px;
}
#markersMap {
height: 495px;
width: 500px;
float: left;
}
#editor-toolbar ul {
list-style: none;
}
#editor-toolbar ul li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}
#editor-toolbar ul a {
display: block;
background-color: #f27935;
line-height: 20px;
text-align: center;
padding: 10px 15px;
color: white;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
-moz-border-radius-: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
#editor-toolbar ul a:hover {
background-color: #9ea7b3;
}
#editor-toolbar ul .selected a {
background-color: #9ea7b3;
}
.ui-tabs-nav li {
display: inline-block;
background-color: #dfdfdf;
border: 1px solid #dedede;
padding: 12px;
border-bottom: 0;
margin-bottom: -1px;
margin-right: 10px;
}
.ui-tabs-nav li.ui-tabs-active {
background-color: white;
}
.ui-tabs-nav li a {
line-height: 20px;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
color: black;
}
#marker-add-button {
padding-left: 20px;
display: none;
float: left;
}
#marker-add-button button {
background-color: #f27935;
line-height: 20px;
text-align: center;
padding: 5px 15px;
color: white;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
width: 280px;
-moz-border-radius-: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
border: 0;
}
.box {
border: 1px solid #dedede;
padding: 12px;
background-color: #fff;
box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0, 0, 0, 0.1);
margin-top: 0px;
}
#editor-panels > div {
float: left;
}
#editor-panels #walk-point-editor {
width: 30%;
}
#editor-panels #walk-point-editor .panel-separator {
margin: 0 10px 0 2px;
width: 1px;
background-color: #bbbbbb;
min-height: 600px;
float: left;
}
#editor-panels .editor-option {
margin: 10px 0px;
}
#editor-panels .panel-wrapper {
padding: 0 20px;
}
#editor-panels label {
display: block;
background-color: #323a45;
color: white;
font-weight: bold;
padding: 10px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
#editor-panels #toggle-tipos a {
background-image: url(img/tipos.png);
}
#editor-panels #toggle-tipos #tipo-once a {
background-position: 0 0;
}
#editor-panels #toggle-tipos #tipo-once a.selected-button {
background-position: 0 -30px;
}
#editor-panels #toggle-tipos #tipo-loop a {
background-position: -50px 0;
}
#editor-panels #toggle-tipos #tipo-loop a.selected-button {
background-position: -15px -30px;
}
#editor-panels #toggle-tipos #tipo-end a {
background-position: -100px 0;
}
#editor-panels #toggle-tipos #tipo-end a.selected-button {
background-position: -30px -30px;
}
#editor-panels #toggle-tipos #tipo-wifi a {
background-position: -150px 0;
}
#editor-panels #toggle-tipos #tipo-wifi a.selected-button {
background-position: -45px -30px;
}
#editor-panels #toggle-tipos #tipo-layer a {
background-position: -200px 0;
}
#editor-panels #toggle-tipos #tipo-layer a.selected-button {
background-position: -60px -30px;
}
#toogle-options a {
background-image: url(img/tipos.png);
}
#toogle-options #option-vibrate {
background-position: -250px 0;
}
#toogle-options #option-autofade {
background-position: -300px 0;
}
.toggle-control ul {
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
height: 50px;
}
.toggle-control li {
width: 50px;
height: 50px;
display: inline-block;
margin: 0;
}
.toggle-control li.first-leaf a {
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.toggle-control a {
overflow: hidden;
display: block;
width: 50px;
height: 50px;
text-indent: -9999px;
}
.toggle-control a:hover,
.toggle-control a.selected {
background-color: #14b9d6;
}
.layer-control ul {
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
height: 50px;
}
.layer-control li {
height: 50px;
display: inline-block;
margin: 0;
width: 13%;
}
.layer-control li.first-leaf a {
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.layer-control a {
overflow: hidden;
display: block;
line-height: 50px;
text-align: center;
color: white;
font-weight: bold;
text-decoration: none;
}
.layer-control a:hover,
.layer-control a.selected {
background-color: #14b9d6;
}
.text-control {
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
height: 50px;
}
.text-control .text-control-wrapper {
padding: 15px 21px;
}
.text-control input {
height: 20px;
width: 100%;
background-color: #9ea7b3;
color: white;
border: 0;
border-bottom: 1px solid #323a45;
box-shadow: none;
}
.text-control input:focus {
box-shadow: none;
border: 0;
border-bottom: 1px solid #323a45;
background-color: #14b9d6;
}
.slider-control {
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
height: 50px;
}
.slider-control .slider-wrapper {
padding: 21px;
}
.slider-control .ui-slider {
position: relative;
height: 8px;
background-color: #323a45;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.slider-control .ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 8px;
height: 8px;
cursor: default;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
background-color: white;
}
.mejs-container {
background-color: #323a45;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
position: relative;
text-align: left;
vertical-align: top;
text-indent: 0;
}
.mejs-container .mejs-mediaelement {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* Start: CONTROL BAR */
.mejs-container .mejs-controls {
position: absolute;
list-style-type: none;
margin: 0;
padding: 0;
bottom: 0;
left: 0;
height: 50px;
width: 100%;
}
.mejs-container .mejs-controls div {
list-style-type: none;
background-image: none;
background-color: #202226;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
display: block;
float: left;
margin: 0;
padding: 0;
width: 50px;
height: 50px;
font-size: 11px;
line-height: 11px;
border: 0;
}
.mejs-controls .mejs-button button {
cursor: pointer;
display: block;
font-size: 0;
line-height: 0;
text-decoration: none;
margin: 0px;
padding: 0;
position: absolute;
height: 50px;
width: 50px;
border: 0;
background: transparent url(img/controls.png) no-repeat;
}
.no-svg .mejs-controls .mejs-button button {
background-image: url(img/controls.png);
}
/* :focus for accessibility */
.mejs-controls .mejs-button button:focus {
outline: solid 1px yellow;
}
/* End: CONTROL BAR */
/* Start: Time (Current / Duration) */
.mejs-container .mejs-controls .mejs-time {
color: #fff;
background-color: transparent;
display: block;
height: px;
width: auto;
padding: 8px 3px 0 3px ;
overflow: hidden;
text-align: center;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.mejs-container .mejs-controls .mejs-time span {
color: #fff;
font-size: 11px;
line-height: 12px;
display: block;
float: left;
margin: 1px 2px 0 0;
width: auto;
}
/* End: Time (Current / Duration) */
/* Start: Play/Pause/Stop */
.mejs-controls .mejs-play button {
background-position: 0 0;
}
.mejs-controls .mejs-pause button {
background-position: -50px 0px;
}
.mejs-controls .mejs-stop button {
background-position: -112px 0;
}
/* Start: Play/Pause/Stop */
/* Start: Progress Bar */
.mejs-controls div.mejs-time-rail {
direction: ltr;
width: 180px;
padding-top: 14px;
background-color: transparent;
padding-right: 10px;
padding-left: 10px;
}
.mejs-controls .mejs-time-rail span {
display: block;
position: absolute;
width: 180px;
height: 8px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
}
.mejs-controls .mejs-time-rail .mejs-time-total {
margin: 8px;
background: black;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.mejs-controls .mejs-time-rail .mejs-time-buffering {
width: 100%;
background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-webkit-background-size: 15px 15px;
-moz-background-size: 15px 15px;
-o-background-size: 15px 15px;
background-size: 15px 15px;
-webkit-animation: buffering-stripes 2s linear infinite;
-moz-animation: buffering-stripes 2s linear infinite;
-ms-animation: buffering-stripes 2s linear infinite;
-o-animation: buffering-stripes 2s linear infinite;
animation: buffering-stripes 2s linear infinite;
}
@-webkit-keyframes buffering-stripes {
from {
background-position: 0 0;
}
to {
background-position: 30px 0;
}
}
@-moz-keyframes buffering-stripes {
from {
background-position: 0 0;
}
to {
background-position: 30px 0;
}
}
@-ms-keyframes buffering-stripes {
from {
background-position: 0 0;
}
to {
background-position: 30px 0;
}
}
@-o-keyframes buffering-stripes {
from {
background-position: 0 0;
}
to {
background-position: 30px 0;
}
}
@keyframes buffering-stripes {
from {
background-position: 0 0;
}
to {
background-position: 30px 0;
}
}
.mejs-controls .mejs-time-rail .mejs-time-loaded {
background: #5e6d81;
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-current {
background: #fff;
display: none;
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-handle {
position: absolute;
margin: 0;
width: 8px;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
text-align: center;
}
.mejs-controls .mejs-time-rail .mejs-time-float {
position: absolute;
display: none;
background: #eee;
width: 36px;
height: 17px;
border: solid 1px #333;
top: -26px;
margin-left: -18px;
text-align: center;
color: #111;
}
.mejs-controls .mejs-time-rail .mejs-time-float-current {
margin: 2px;
width: 30px;
display: block;
text-align: center;
left: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
position: absolute;
display: block;
width: 0;
height: 0;
line-height: 0;
border: solid 5px #eee;
border-color: #eee transparent transparent transparent;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: 15px;
left: 13px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float {
width: 48px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current {
width: 44px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner {
left: 18px;
}
/*
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
visibility:visible;
}
*/
/* End: Progress Bar */
/* Start: Mute/Volume */
.mejs-container .mejs-controls .mejs-volume-button {
background-color: transparent;
}
.mejs-container .mejs-controls .mejs-mute button {
background-position: -100px 0px;
}
.mejs-container .mejs-controls .mejs-unmute button {
background-position: -150px 0;
}
.mejs-container .mejs-controls .mejs-volume-button {
position: relative;
}
.mejs-container .mejs-controls .mejs-volume-button .mejs-volume-slider {
display: none;
height: 115px;
width: 25px;
background: url(background.png);
background: rgba(50, 50, 50, 0.7);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: -115px;
left: 0;
z-index: 1;
position: absolute;
margin: 0;
}
.mejs-container .mejs-controls .mejs-volume-button:hover {
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
/*
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
display: block;
}
*/
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.5);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
position: absolute;
left: 4px;
top: -3px;
width: 16px;
height: 6px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
cursor: N-resize;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
margin: 0;
}
/* VOLUME horizontal version */
.mejs-controls div.mejs-horizontal-volume-slider {
height: 26px;
width: 50px;
position: relative;
background-color: transparent;
margin-left: -1px;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
position: absolute;
left: 0;
top: 21px;
width: 40px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: black;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
position: absolute;
left: 0;
top: 21px;
width: 40px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: #5e6d81;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
display: none;
}
/* End: Mute/Volume */
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
* {
padding: 0;
margin: 0;
}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_window {
color: #333333;
}
#TB_secondLine {
color: #666666;
}
#TB_window a:link {
color: #666666;
}
#TB_window a:visited {
color: #666666;
}
#TB_window a:hover {
color: #000;
}
#TB_window a:active {
color: #666666;
}
#TB_window a:focus {
color: #666666;
}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_overlay {
position: fixed;
z-index: 100;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
}
.TB_overlayMacFFBGHack {
background: url(macFFBgHack.png) repeat;
}
.TB_overlayBG {
background-color: #000;
filter: alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
}
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color: #000000;
text-align: left;
top: 50%;
left: 50%;
visibility: hidden;
}
#TB_window img#TB_Image {
display: block;
margin: 15px 0 0 15px;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-top: 1px solid #666;
border-left: 1px solid #666;
}
#TB_caption {
height: 25px;
padding: 7px 30px 10px 25px;
float: left;
}
#TB_closeWindow {
height: 25px;
padding: 11px 25px 10px 0;
float: right;
}
#TB_closeAjaxWindow {
padding: 7px 10px 5px 0;
margin-bottom: 1px;
text-align: right;
float: right;
}
#TB_ajaxWindowTitle {
float: left;
padding: 7px 0 5px 10px;
margin-bottom: 1px;
}
#TB_title {
background-color: #e8e8e8;
height: 27px;
}
#TB_ajaxContent {
clear: both;
padding: 2px 15px 15px 15px;
overflow: auto;
text-align: left;
line-height: 1.4em;
}
#TB_ajaxContent.TB_modal {
padding: 15px;
}
#TB_ajaxContent p {
padding: 5px 0px 5px 0px;
}
#TB_load {
position: fixed;
display: none;
height: 13px;
width: 208px;
z-index: 103;
top: 50%;
left: 50%;
margin: -6px 0 0 -104px;
/* -height/2 0 0 -width/2 */
}
#TB_HideSelect {
z-index: 99;
position: fixed;
top: 0;
left: 0;
background-color: #fff;
border: none;
filter: alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
height: 100%;
width: 100%;
}
#TB_iframeContent {
clear: both;
border: none;
margin-bottom: -1px;
margin-top: 1px;
_margin-bottom: 1px;
}
.mejs-clear {
clear: both;
}
.clear {
clear: both !important;
float: none !important;
}

911
soundwalk.less Normal file
View File

@ -0,0 +1,911 @@
#walk-preview{
height: 600px;
width: 70%;
}
#walk-map{
height: 600px;
}
#markersMapWindow{
height: 495px;
width: 800px;
visibility: hidden;
}
#markersWrapper{
#markerInfo{
width: 280px;
height: 465px;
float: left;
padding-left: 20px;
}
}
h3.hndle{
margin-bottom: 0px;
}
textarea{
width: 100%;
}
.panel-left{
float: left;
width:60%;
}
.panel-right{
float:left;
width:40%;
.panel-wrap{
padding: 0 0 0 10px;
}
}
#markersMap{
height: 495px;
width: 500px;
float: left;
}
//TOOLBAR
#editor-toolbar{
ul{list-style: none;}
ul li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}
ul a{
display: block;
background-color: #f27935;
line-height: 20px;
text-align: center;
padding: 10px 15px;
color: white;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
-moz-border-radius-: 4px;
-webkit-border-radius:4px;
border-radius:4px;
&:hover{
background-color: #9ea7b3;
}
}
ul .selected a{background-color: #9ea7b3;}
}
.ui-tabs-nav{
li{
display: inline-block;
background-color: #dfdfdf;
border:1px solid #dedede;
padding: 12px;
border-bottom: 0;
margin-bottom: -1px;
margin-right: 10px;
&.ui-tabs-active {
background-color: white;
}
a{
line-height: 20px;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;
color: black;
}
}
}
#marker-add-button{
padding-left: 20px;
display: none;
float: left;
button{
background-color: #f27935;
line-height: 20px;
text-align: center;
padding: 5px 15px;
color: white;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
width:280px;
-moz-border-radius-: 4px;
-webkit-border-radius:4px;
border-radius:4px;
cursor: pointer;
border: 0;
}
}
.box{
border:1px solid #dedede;
padding: 12px;
background-color: #fff;
box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
-webkit-box-shadow: 0px 1px 1px -1px rgba(0,0,0,0.1);
margin-top: 0px;
}
#editor-panels{
& > div{
float:left;
}
#walk-point-editor{
width: 30%;
.panel-separator{
margin: 0 10px 0 2px;
width: 1px;
background-color: #bbbbbb;
min-height: 600px;
float: left;
}
}
.editor-option{
margin: 10px 0px;
}
.panel-wrapper{
padding: 0 20px;
}
label{
display: block;
background-color: #323a45;
color:white;
font-weight: bold;
padding: 10px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright:4px;
-webkit-border-top-left-radius:4px;
-webkit-border-top-right-radius:4px;
border-top-left-radius:4px;
border-top-right-radius:4px;
}
#toggle-tipos{
a{
background-image: url(img/tipos.png);
}
#tipo-once a{
background-position: 0 0;
&.selected-button{background-position: 0 -30px}
}
#tipo-loop a{
background-position: -50px 0;
&.selected-button{background-position: -15px -30px}
}
#tipo-end a{
background-position: -100px 0;
&.selected-button{background-position: -30px -30px}
}
#tipo-wifi a{
background-position: -150px 0;
&.selected-button{background-position: -45px -30px}
}
#tipo-layer a{
background-position: -200px 0;
&.selected-button{background-position: -60px -30px}
}
}
}
#soundwalk-messages{
}
#toogle-options{
a{
background-image: url(img/tipos.png);
}
#option-vibrate{
background-position: -250px 0;
}
#option-autofade{
background-position: -300px 0;
}
}
.toggle-control{
ul{
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-left-radius:4px;
border-bottom-right-radius:4px;
height: 50px;
}
li{
width: 50px;
height: 50px;
display: inline-block;
margin: 0;
&.first-leaf a{
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius:4px;
border-bottom-left-radius:4px;
}
}
a{
overflow: hidden;
display:block;
width: 50px;
height: 50px;
text-indent: -9999px;
&:hover,
&.selected{
background-color: #14b9d6;
}
}
}
.layer-control{
ul{
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-left-radius:4px;
border-bottom-right-radius:4px;
height: 50px;
}
li{
height: 50px;
display: inline-block;
margin: 0;
width: 13%;
&.first-leaf a{
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius:4px;
border-bottom-left-radius:4px;
}
}
a{
overflow: hidden;
display:block;
line-height: 50px;
text-align: center;
color:white;
font-weight: bold;
text-decoration: none;
&:hover,
&.selected{
background-color: #14b9d6;
}
}
}
.text-control{
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-left-radius:4px;
border-bottom-right-radius:4px;
height: 50px;
.text-control-wrapper{
padding:15px 21px;
}
input{
height: 20px;
width: 100%;
background-color: #9ea7b3;
color:white;
border: 0;
border-bottom: 1px solid #323a45;
box-shadow: none;
&:focus{
box-shadow: none;
border: 0;
border-bottom: 1px solid #323a45;
background-color: #14b9d6;
}
}
}
.slider-control{
width: 100%;
margin-top: 0px;
background-color: #9ea7b3;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-left-radius:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-left-radius:4px;
border-bottom-right-radius:4px;
height: 50px;
.slider-wrapper{
padding: 21px;
}
.ui-slider{
position:relative;
height: 8px;
background-color: #323a45;
-moz-border-radius: 4px;
-webkit-border-radius:4px;
border-radius:4px;
.ui-slider-handle{
position: absolute;
z-index: 2;
width: 8px;
height: 8px;
cursor: default;
-moz-border-radius: 4px;
-webkit-border-radius:4px;
border-radius:4px;
background-color: white;
}
}
}
//PLAYER
.mejs-container{
background-color: #323a45;
-moz-border-radius:4px;
-webkit-border-radius: 4px;
border-radius:4px;
position: relative;
text-align: left;
vertical-align: top;
text-indent: 0;
.mejs-mediaelement {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
/* Start: CONTROL BAR */
.mejs-container .mejs-controls {
position: absolute;
list-style-type: none;
margin: 0;
padding: 0;
bottom: 0;
left: 0;
height: 50px;
width: 100%;
}
.mejs-container .mejs-controls div {
list-style-type: none;
background-image: none;
background-color: #202226;
-moz-border-radius-topleft: 4px;
-moz-border-radius-bottomleft:4px;
-webkit-border-top-left-radius:4px;
-webkit-border-bottom-left-radius:4px;
border-top-left-radius:4px;
border-bottom-left-radius:4px;
display: block;
float: left;
margin: 0;
padding: 0;
width: 50px;
height: 50px;
font-size: 11px;
line-height: 11px;
border: 0;
}
.mejs-controls .mejs-button button {
cursor: pointer;
display: block;
font-size: 0;
line-height: 0;
text-decoration: none;
margin: 0px;
padding: 0;
position: absolute;
height: 50px;
width: 50px;
border: 0;
background: transparent url(img/controls.png) no-repeat;
}
.no-svg .mejs-controls .mejs-button button {
background-image: url(img/controls.png);
}
/* :focus for accessibility */
.mejs-controls .mejs-button button:focus {
outline: solid 1px yellow;
}
/* End: CONTROL BAR */
/* Start: Time (Current / Duration) */
.mejs-container .mejs-controls .mejs-time {
color: #fff;
background-color: transparent;
display: block;
height: px;
width: auto;
padding: 8px 3px 0 3px ;
overflow: hidden;
text-align: center;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.mejs-container .mejs-controls .mejs-time span {
color: #fff;
font-size: 11px;
line-height: 12px;
display: block;
float: left;
margin: 1px 2px 0 0;
width: auto;
}
/* End: Time (Current / Duration) */
/* Start: Play/Pause/Stop */
.mejs-controls .mejs-play button {
background-position: 0 0;
}
.mejs-controls .mejs-pause button {
background-position: -50px 0px;
}
.mejs-controls .mejs-stop button {
background-position: -112px 0;
}
/* Start: Play/Pause/Stop */
/* Start: Progress Bar */
.mejs-controls div.mejs-time-rail {
direction: ltr;
width: 180px;
padding-top: 14px;
background-color: transparent;
padding-right: 10px;
padding-left: 10px;
}
.mejs-controls .mejs-time-rail span {
display: block;
position: absolute;
width: 180px;
height: 8px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
}
.mejs-controls .mejs-time-rail .mejs-time-total {
margin: 8px;
background: black;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.mejs-controls .mejs-time-rail .mejs-time-buffering {
width: 100%;
background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-webkit-background-size: 15px 15px;
-moz-background-size: 15px 15px;
-o-background-size: 15px 15px;
background-size: 15px 15px;
-webkit-animation: buffering-stripes 2s linear infinite;
-moz-animation: buffering-stripes 2s linear infinite;
-ms-animation: buffering-stripes 2s linear infinite;
-o-animation: buffering-stripes 2s linear infinite;
animation: buffering-stripes 2s linear infinite;
}
@-webkit-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-moz-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-ms-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-o-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
.mejs-controls .mejs-time-rail .mejs-time-loaded {
background: #5e6d81;
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-current {
background: #fff;
display: none;
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-handle {
position: absolute;
margin: 0;
width: 8px;
background: #fff;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius:4px;
cursor: pointer;
text-align: center;
}
.mejs-controls .mejs-time-rail .mejs-time-float {
position: absolute;
display: none;
background: #eee;
width: 36px;
height: 17px;
border: solid 1px #333;
top: -26px;
margin-left: -18px;
text-align: center;
color: #111;
}
.mejs-controls .mejs-time-rail .mejs-time-float-current {
margin: 2px;
width: 30px;
display: block;
text-align: center;
left: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
position: absolute;
display: block;
width: 0;
height: 0;
line-height: 0;
border: solid 5px #eee;
border-color: #eee transparent transparent transparent;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: 15px;
left: 13px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float {
width: 48px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current {
width: 44px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner {
left: 18px;
}
/*
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
visibility:visible;
}
*/
/* End: Progress Bar */
/* Start: Mute/Volume */
.mejs-container .mejs-controls .mejs-volume-button {
background-color:transparent;
}
.mejs-container .mejs-controls .mejs-mute button {
background-position: -100px 0px;
}
.mejs-container .mejs-controls .mejs-unmute button {
background-position: -150px 0;
}
.mejs-container .mejs-controls .mejs-volume-button {
position: relative;
}
.mejs-container .mejs-controls .mejs-volume-button .mejs-volume-slider {
display: none;
height: 115px;
width: 25px;
background: url(background.png);
background: rgba(50, 50, 50, 0.7);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: -115px;
left: 0;
z-index: 1;
position: absolute;
margin: 0;
}
.mejs-container .mejs-controls .mejs-volume-button:hover {
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
/*
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
display: block;
}
*/
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.5);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
position: absolute;
left: 4px;
top: -3px;
width: 16px;
height: 6px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
cursor: N-resize;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
margin: 0;
}
/* VOLUME horizontal version */
.mejs-controls div.mejs-horizontal-volume-slider {
height: 26px;
width: 50px;
position: relative;
background-color: transparent;
margin-left: -1px;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
position: absolute;
left: 0;
top: 21px;
width: 40px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: black;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
position: absolute;
left: 0;
top: 21px;
width: 40px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: #5e6d81;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
display: none;
}
/* End: Mute/Volume */
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
*{padding: 0; margin: 0;}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_window {
color: #333333;
}
#TB_secondLine {
color:#666666;
}
#TB_window a:link {color: #666666;}
#TB_window a:visited {color: #666666;}
#TB_window a:hover {color: #000;}
#TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;}
/* ----------------------------------------------------------------------------------------------------------------*/
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
/* ----------------------------------------------------------------------------------------------------------------*/
#TB_overlay {
position: fixed;
z-index:100;
top: 0px;
left: 0px;
height:100%;
width:100%;
}
.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
.TB_overlayBG {
background-color:#000;
filter:alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
}
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
text-align:left;
top:50%;
left:50%;
visibility: hidden;
}
#TB_window img#TB_Image {
display:block;
margin: 15px 0 0 15px;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-top: 1px solid #666;
border-left: 1px solid #666;
}
#TB_caption{
height:25px;
padding:7px 30px 10px 25px;
float:left;
}
#TB_closeWindow{
height:25px;
padding:11px 25px 10px 0;
float:right;
}
#TB_closeAjaxWindow{
padding:7px 10px 5px 0;
margin-bottom:1px;
text-align:right;
float:right;
}
#TB_ajaxWindowTitle{
float:left;
padding:7px 0 5px 10px;
margin-bottom:1px;
}
#TB_title{
background-color:#e8e8e8;
height:27px;
}
#TB_ajaxContent{
clear:both;
padding:2px 15px 15px 15px;
overflow:auto;
text-align:left;
line-height:1.4em;
}
#TB_ajaxContent.TB_modal{
padding:15px;
}
#TB_ajaxContent p{
padding:5px 0px 5px 0px;
}
#TB_load{
position: fixed;
display:none;
height:13px;
width:208px;
z-index:103;
top: 50%;
left: 50%;
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
}
#TB_HideSelect{
z-index:99;
position:fixed;
top: 0;
left: 0;
background-color:#fff;
border:none;
filter:alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
height:100%;
width:100%;
}
#TB_iframeContent{
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
}
.mejs-clear {
clear: both;
}
.clear{
clear:both !important;
float: none !important;
}

253
soundwalk.php Normal file
View File

@ -0,0 +1,253 @@
<?php
/*
Plugin Name: Soundwalk Web Interface
Plugin URI: http://www.audio-lab.org
Description: Plugin para la gesti?n de audioguias basado en el software Areago.
Version: 1.0
Author: Xavier Balderas
Author URI: http://www.audio-lab.org
License: GPL2
*/
require_once (dirname( __FILE__ ) . '/libs/db_helper.php');
require_once (dirname( __FILE__ ) . '/libs/classes.php');
if (!class_exists('SoundWalk')){
class SoundWalk{
function init (){
add_image_size('soundwalk_picture', 512, 512, true);
}// init
function generate_rewrite_rules(){
global $wp_rewrite;
$newrules = array();
$newrules['soundwalk/listado'] = 'wp-content/plugins/soundwalk/listado.php';
$newrules['soundwalk/descarga/(\d*)$'] = 'wp-content/plugins/soundwalk/descarga.php?paseo=$1';
$wp_rewrite->non_wp_rules = $newrules + $wp_rewrite->non_wp_rules;
}//generate_rewrite_rules
function register_actions(){
add_action('admin_menu',array($this, 'admin_menu'));
add_action('wp_ajax_save-walk',array($this,'save_walk'));
add_action('wp_ajax_get-walk',array($this,'get_walk'));
/*
add_action('wp_ajax_areago_file_uploaded',array($this,'areago_ajax_file_uploaded'));
add_filter('media_send_to_editor', array($this, 'areago_media_send_to_editor'), 50, 3);
add_filter('upload_mimes', array($this,'areago_custom_upload_mimes')); */
} //register_actions
function get_walk(){
if (!isset($_POST['id'])){
wp_send_json_error("ID not available");
}
$db_helper = new Soundwalk_DB_Helper();
$w = $db_helper->get_walk($_POST['id']);
$r = array(
'points' => $w->points,
'info' => array(
'title' => $w->name,
'description' => $w->description,
'language' => $w->language,
'fID' => $w->pic_id,
'fileName' => wp_get_attachment_thumb_url( $w->pic_id ),
),
'id' => $_POST['id']
);
wp_send_json_success($r);
}
function save_walk(){
if (!isset($_POST['data'])){
wp_send_json_error("Data not available");
}
$data = json_decode(stripslashes($_POST['data']));
$up = (isset($_POST['id']))? true : false;
$db_helper = new Soundwalk_DB_Helper();
$id = $db_helper->save_walk($data, $up);
if ($id === FALSE)
wp_send_json_error("Error al guardar el paseo");
$file_helper = new Soundwalk_File_Helper();
$created = $file_helper->createFolder($id);
if (!$created)
wp_send_json_error("Error en la carpeta");
$zip_helper = new Soundwalk_ZIP();
$result = $zip_helper->create_zip($id);
if ($result)
wp_send_json_success(array('id'=>$id));
wp_send_json_error("Error ZIP");
}
function admin_menu(){
add_menu_page( 'List Walks', 'SoundWalks', 'manage_options', 'soundwalk-manage', array($this,'menu_page_callback'));
add_submenu_page( "soundwalk-manage", "Add walk", "Add walk", 'manage_options', 'soundwalk-manage-add', array($this, 'manage_add') );
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
}// admin_menu
function admin_enqueue_scripts($hook){
if ($hook=='soundwalks_page_soundwalk-manage-add') {
//Styles and scripts for the add/edit page.
wp_enqueue_script('wp-util');
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('thickbox');
wp_enqueue_script('underscore');
wp_enqueue_script('backbone');
wp_enqueue_media();
wp_deregister_script('mediaelement');
wp_register_script('mediaelement', plugins_url('js/mediaelement-and-player.min.js', __FILE__), array('jquery'), '2.13.1');
wp_enqueue_script('wp-mediaelement');
wp_enqueue_script('leafletjs','http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js',array(),'0.6.4',TRUE); // add Leaflet.js
wp_enqueue_script('soundwalk_models', plugins_url('js/models.js', __FILE__), array(), '0.1', TRUE);
wp_enqueue_script('soundwalk_views', plugins_url('js/views.js', __FILE__), array('soundwalk_models'), '0.1', TRUE);
wp_enqueue_script('soundwalk_app', plugins_url('js/app.js', __FILE__), array('soundwalk_views', 'leafletjs', 'backbone', 'underscore', 'jquery'), '0.1', TRUE);
wp_enqueue_style('leafletcss','http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css',array(),'0.6.4','all'); // add CSS Leaflet
wp_enqueue_style('soundwalk_app_css',plugins_url('soundwalk.css', __FILE__),array(),'0.1','all'); // add CSS Soundwalk app
global $soundmap;
$params = array();
if (isset($soundmap)) :
$params += $soundmap->config['origin'];
$params['mapType'] = $soundmap->config['mapType'];
if (isset($_GET['walk']) && isset($_GET['action'])){
if($_GET['action'] = "edit"){
$params['edit_Walk'] = $_GET['walk'];
}
}
endif;
wp_localize_script('soundwalk_views','SoundwalkOptions',$params);
}
} //admin_enqueue_scripts
function manage_add(){
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
if (!class_exists('Soundmap_Helper')){
wp_die('Soundmap Plugin is needed');
}
if (isset($_GET['walk'])){
}
include_once (dirname( __FILE__ ) . '/admin.php');
}// manage_add
function menu_page_callback(){
remove_filter('admin_footer','qtrans_modifyExcerpt'); // resuelve problema con qtranslate.
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
if( isset($_GET[ 'action' ]) && $_GET[ 'action' ] == 'delete' ) {
//Tenemos datos, por lo que hay que guardarlos...
$id = $_GET['walk'];
$db_helper = new Soundwalk_DB_Helper();
$db_helper->delete_walk($id);
}
$table = new Soundwalk_Paseos_List_Table();
$table->prepare_items();
?>
<div class="wrap">
<div id="icon-users" class="icon32"><br/></div>
<h2>Walks <a href="<?php echo sprintf('?page=%s&action=%s"',$_REQUEST['page'],'add')?>" class="add-new-h2">Add walk</a></h2>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
<form id="areago-lists" method="get">
<style>
#areago-lists #excerpt{
width:auto;
}
</style>
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<!-- Now we can render the completed list table -->
<?php $table->display() ?>
</form>
</div>
<?php
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
/*if (isset($_POST['soundmap_op_noncename'])){
if ( !wp_verify_nonce( $_POST['soundmap_op_noncename'], plugin_basename( __FILE__ ) ) )
return;
_soundmap_save_options();
}*/
}// menu_page_callback
}// End class
}// endif
$soundwalk = new SoundWalk();
$soundwalk->register_actions();
register_activation_hook( __FILE__, 'soundwalk_install' );
function soundwalk_install(){
global $wp_rewrite;
$newrules = array();
$newrules['soundwalk/listado'] = 'wp-content/plugins/soundwalk/listado.php';
$newrules['soundwalk/descarga/(\d*)$'] = 'wp-content/plugins/soundwalk/descarga.php?paseo=$1';
$wp_rewrite->non_wp_rules = $newrules + $wp_rewrite->non_wp_rules;
flush_rewrite_rules(true);
//Install the db.
$db_helper = new Soundwalk_DB_Helper();
$db_helper->install();
$file_helper = new Soundwalk_File_Helper();
$fileOK = $file_helper->check();
}// areago_install
add_action("init", array($soundwalk , "init"));
add_filter( 'generate_rewrite_rules',array($soundwalk, 'generate_rewrite_rules' ));