Browse Source

template divide dir audio video

cri 8 years ago
parent
commit
9127a80065
5 changed files with 62 additions and 11 deletions
  1. 2 2
      app/index.html
  2. 2 2
      app/index.html~
  3. 42 5
      app/scripts/main_list_item_id.js
  4. 4 0
      app/styles/main.css
  5. 12 2
      app/templates/list_item_id.txt

+ 2 - 2
app/index.html

@@ -62,9 +62,9 @@
     
 </body><div class="container">
 <p>Iframe list items con id:
-<pre>iframe class="embed" data-arkiwi-id="title:hack" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"</pre>
+<pre>iframe class="embed" data-arkiwi-id="title:hack" data-arkiwi-type="audio" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"</pre>
 </p>
-<iframe class="embed" name="arkiwi" data-arkiwi-id="title:hack" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"></iframe>
+<iframe class="embed" name="arkiwi" data-arkiwi-id="title:hack" data-arkiwi-type="video" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"></iframe>
 <div class="container-fluid" id="list" ><div class="row"></div></div>
 
 

+ 2 - 2
app/index.html~

@@ -62,9 +62,9 @@
     
 </body><div class="container">
 <p>Iframe list items con id:
-<pre>iframe class="embed" data-arkiwi-id="hack" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"</pre>
+<pre>iframe class="embed" data-arkiwi-id="title:hack" data-arkiwi-type="audio" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"</pre>
 </p>
-<iframe class="embed" name="arkiwi" data-arkiwi-id="title:hack" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"></iframe>
+<iframe class="embed" name="arkiwi" data-arkiwi-id="title:hack" data-arkiwi-type="audio" height="400px" width="99%" frameBorder='1' seamless='seamless' src="./wdg_list_item_id.html"></iframe>
 <div class="container-fluid" id="list" ><div class="row"></div></div>
 
 

+ 42 - 5
app/scripts/main_list_item_id.js

@@ -18,7 +18,7 @@ $(document).ready(function () {
 		//console.log(iframe_id);
 	var iframe_type = "audio"
 	var iframe_type = $(window.frameElement).attr("data-arkiwi-type");
- console.log(iframe_type);
+// console.log(iframe_type);
 	
     var arkiwi = new ARKIWI.Arkiwi('http://www.arkiwi.org', 'http://upload.arkiwi.org');
    /* $.get("templates/list_item_id.txt", function (template) {
@@ -31,17 +31,54 @@ $(document).ready(function () {
 
     });*/
 
-    arkiwi.search('Ampioraggio', function (result) {
+   // arkiwi.search('Ampioraggio', function (result) {
       //  console.log('Ricerca...');
       //  console.log(result);
 
-    });
+  //  });
+
+	 
 
-	   $.get("templates/list_item_id.txt", function (template) {
 		   
     arkiwi.search(iframe_id, function (result) {
         console.log('Lettura cartella...');
-        console.log(result);
+       
+		
+			for(var i = 0; i < result.items.length; i++)
+		{
+				var result_item = result.items[i].item;
+				
+				console.log(result_item.type);
+				
+				switch(result_item.type){
+			
+			    case "dir":
+
+				result_item.dir=true;
+				
+				break;
+				case "audio":
+				result_item.audio=true;
+				
+				break;
+				case "video":
+				result_item.video=true;
+				
+				break;
+
+				default:
+						
+				result_item.audio=true;
+				
+				break;
+						
+		        
+			}
+
+				}
+		
+  $.get("templates/list_item_id.txt", function (template) {
+			
 		var pappone =   Mustache.render(template, result);
 		//console.log(pappone);
             $(".row").append(pappone);

+ 4 - 0
app/styles/main.css

@@ -30,6 +30,10 @@ audio {
     width:100%;
  
 }
+video {
+    min-width: 100%;
+}
+
 .tools a img {
     width: 30px;
 }

+ 12 - 2
app/templates/list_item_id.txt

@@ -2,13 +2,23 @@
   <div class="col-xs-6 col-sm-3">
     <div class="thumbnail">
 <h4>{{#item.title}}<small><b>{{item.title}}</b></small></h4>{{/item.title}}
-{{#item.player}}
+{{#item.audio}}
  <audio controls>
   <source src="http://storage.arkiwi.org/{{item.identifier}}" type="audio/ogg">
   <source src="#" type="audio/mpeg">
 Your browser does not support the audio element.
 </audio> 
-{{/item.player}}
+{{/item.audio}}
+{{#item.video}}
+ <video controls>
+  <source src="http://storage.arkiwi.org/{{item.identifier}}" type="video/ogg">
+  <source src="#" type="video/mpeg">
+Your browser does not support the audio element.
+</video> 
+{{/item.video}}
+{{#item.dir}} {{/item.dir}}
+
+
 
 <h4>{{#item.creator}}</h4><small>Creato da: <i>{{item.creator}}</i></small>{{/item.creator}}