basic save and reset

This commit is contained in:
pg 2016-01-23 01:57:11 +01:00
parent b4e4e2fbae
commit 0fa68f85bb
4 changed files with 36 additions and 6 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
node_modules/
*.swp
*.swo
.*.swp
.*.swo
*~

View File

@ -28,13 +28,22 @@ $(document).ready(function(){
//localStorage.removeItem("url_ressources")
var row = function(data){
var htmlobj = "<div>"+data.title+" |"+ data.url+
var htmlobj = "<div> <a href='"+data.url+"'>[ "+data.title+" ]</a>"+
//" </div>"+ "<div class='presLink'><button value='"+ data.url+"'> launch </button></div>"
"<button class='presLink' value='"+data.url+"' > launch </button></div>"
//return "<div><div>"+data.title+"</div> <div>| "+ data.url+" </div>"+ "<button class='.presLink'value='bla'> launch </button></div>"
return htmlobj
}
var export_json = function(){
var csvData = 'data:application/json;charset=utf-8,' + localStorage.getItem(name);
$(this).attr({
'href': csvData,
'target': '_blank'
});
}
var browser_ressource = loadObject("url_ressources")
console.log()
@ -65,8 +74,26 @@ var row = function(data){
})
}
})
})
$("#deleteButton").click(function(){
console.log("delete")
localStorage.removeItem("url_ressources")
$("#ressources_list").html("")
})
$("#saveButton").click(function(event){
console.log("save")
var csvData = 'data:application/json;charset=utf-8,' + localStorage.getItem("url_ressources");
$(this).attr({
'href': csvData,
'target': '_blank'
});
})
})
})

Binary file not shown.

View File

@ -16,6 +16,8 @@ html
span.label url
input(type="text", name="url",id="urlText")
input(type="submit", value="add", id="addUrl")
input(type="submit", value="delete", id="deleteButton")
a(id="saveButton", href="#") [SAVE]
p
#ressources_list