Kaynağa Gözat

Added is Firefox check if using indexedDB

Toby Chui 2 yıl önce
ebeveyn
işleme
59d71f9ed5
1 değiştirilmiş dosya ile 24 ekleme ve 9 silme
  1. 24 9
      web/Music/index.html

+ 24 - 9
web/Music/index.html

@@ -117,7 +117,7 @@
 		</div>
 	</div>
 	-->
-	<div class="leftsbObject sbSelectable sbPaddingIn" style="font-size:80%;border-top: 2px solid #4a4a4a;">
+	<div class="leftsbObject sbSelectable sbPaddingIn" style="font-size:80%;border-top: 2px solid #4a4a4a;" onClick="loadSettingViews();">
 		<div class="ui header">
 			<i class="setting tiny icon whiteFont"></i>
 			<div class="content whiteFont">
@@ -387,6 +387,7 @@
 	var ua =  navigator.userAgent.toLowerCase();
 	var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
 	var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
+	var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
 	var cacheAvailable = 'caches' in self;
 	let cacheDb, cacheStore, cacheDbTx;
 	var dbExists = !(!window.indexedDB);
@@ -488,7 +489,6 @@
 					
 				}else if(vt == "network"){
 					loadNetworkView();
-					
 				}
 			}else{
 				//Default action
@@ -502,6 +502,21 @@
 		togglePagingMode(false);
 	}
 
+	function loadSettingViews(){
+		currentMode = "playlist";
+		//Clear the main list
+		$("#mainList").html("");
+		togglePagingMode(false);
+		//Render the elements
+		$("#mainList").append(`<div class="mainList item">HELLO WORLD</div>`);
+		hideLeftMenu();
+
+		//Update the headers
+		$("#interfaceTitle").text("Settings");
+		$("#AMmenuIcon").attr("class","setting large icon whiteFont");
+		$("#interfaceDetails").text("Work in progress");
+	}
+
 	function togglePagingMode(enabled=false){
 		if (pagingEnabled != enabled){
 			currentPage = 0;
@@ -1341,7 +1356,7 @@
 		getThumbnailFromCache(realVpath, function(thumbdata){
 			if (thumbdata == undefined){
 				//No thumbnail found. Load it from server
-				console.log("Thumbnail cache not found", realVpath);
+				//console.log("Thumbnail cache not found", realVpath);
 				ao_module_agirun("Music/functions/getThumbnail.js", {
 					file: realVpath,
 				}, function(data){
@@ -1368,7 +1383,7 @@
 				});
 			}else{
 				//Thumbnail found.
-				console.log("Loaded song thumbnail from cache: " , realVpath);
+				//console.log("Loaded song thumbnail from cache: " , realVpath);
 				$("#albumnArtImage").attr("src","data:image/jpg;base64," + thumbdata.content);
 				$("#smallPlayerThumb").attr("src","data:image/jpg;base64," + thumbdata.content);
 				if (isAndroid && navigator.mediaSession.metadata){
@@ -1574,7 +1589,7 @@
 		var filename = fd.join("=");
 		var playbackURL = "../" + rootPath + "=" + encodeURIComponent(filename); //Convert absolute dir to relative
 		var ext = filename.split(".").pop();
-		if (dbExists){
+		if (dbExists && (!isFirefox)){
 			cacheDbTx = cacheDb.transaction("files","readwrite");
 			cacheStore = cacheDbTx.objectStore("files");
 
@@ -1602,7 +1617,7 @@
 					
 				}else{
 					//Cache exists. Load this instead
-					console.log("Loaded from cache ", filename)
+					console.log("[AirMusic] Loaded from cache ", filename)
 					let reader = new FileReader();
 					reader.onload = function(e) {
 						let srcUrl = e.target.result;
@@ -1801,7 +1816,7 @@
 			opr: "root",
 		},function(data){
 			//Get the list of playlist
-			console.log(data);
+			//console.log(data);
 
 			//Render the elements
 			data.forEach(playlist => {
@@ -2363,7 +2378,7 @@
 		xhr.open('GET', url);
 		xhr.responseType = 'blob';
 		xhr.onload = function(e){
-			console.log("Buffer completed: ", url);
+			//console.log("Buffer completed: ", url);
 			callback(xhr.response);
 		}
 		xhr.send();
@@ -2401,7 +2416,7 @@
 				if (track.cachetime + expireTime < Date.now()/1000){
 					//Expired. Clear this cache
 					expiredFilenames.push(track.filename);
-					console.log("Expired track cleared: ", track);
+					console.log("[AirMusic] Expired track cleared: ", track);
 				}
 				
 			});