//edge.history 历史记录 import fsys; import sqlite; import chrome.time; import chrome.path; namespace chrome.edge.history; path = function(profile){ var historyPath = ..chrome.path.profile(profile,"History",..io.appData("\Microsoft\Edge\User Data\")) if(!historyPath) historyPath = ..chrome.path.profile(profile,"Archived History",..io.appData("\Microsoft\Edge\User Data\")) return historyPath; } open = function(profile){ var historyPath = path(profile); if(..io.exist(historyPath)){ ..fsys.copy( historyPath,historyPath + ".aardio.db" ); return ..sqlite(historyPath + ".aardio.db") } } get = function(profile){ var db = open(profile); if(!db) return; var history = db.getTable("SELECT visits.id, visits.visit_time AS time, visits.visit_duration AS duration, urls.url, urls.title, urls.last_visit_time AS lastTime from [visits] JOIN [urls] ON urls.id == visits.url; ") for(i=1;#history;1){ history[i].time = ..chrome.time(history[i].time ); history[i].lastTime = ..chrome.time(history[i].lastTime ); } return history; } clear = function(profile){ var historyPath = path(profile); if(..io.exist(historyPath)){ var db = ..sqlite(historyPath); if(db){ db.exec("DELETE FROM [visits]") db.exec("DELETE FROM [urls]") db.exec("DELETE FROM [keyword_search_terms]") db.close(); return true; } } } readOnly = function(readOnly,profile){ var historyPath = path(profile); if(..io.exist(historyPath)){ if(readOnly){ ..fsys.attrib(historyPath,1); clear(profile); } ..fsys.attrib(historyPath,!readOnly?1:null,readOnly?1/*_FILE_ATTRIBUTE_READONLY*/:null) } } /**intellisense() chrome.edge.history.open() = 打开 Edge 历史记录数据库,可选在参数中指定配置名\n!sqliteConn. chrome.edge.history.get() = 返回 Edge 历史记录数据表,可选在参数中指定配置名 chrome.edge.history.clear() = 清空 Edge 历史记录数据表,可选在参数中指定配置名,\n需要事先关闭chrome chrome.edge.history.readOnly(true) = 参数 @1 设置是否历史记录数据表只读,\n参数为 true 会同时清空数据,\n可选在参数@2中指定配置名 end intellisense**/