diff --git a/.gitignore b/.gitignore index 41a6858..5d76348 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ *.swp -*.swo +.*.swp +.*.swo *~ diff --git a/assets/clientApp.js b/assets/clientApp.js index 7a147e9..5cf55ec 100644 --- a/assets/clientApp.js +++ b/assets/clientApp.js @@ -28,13 +28,22 @@ $(document).ready(function(){ //localStorage.removeItem("url_ressources") var row = function(data){ - var htmlobj = "
"+data.title+" |"+ data.url+ + var htmlobj = "
[ "+data.title+" ]"+ //"
"+ "" "
" //return "
"+data.title+"
| "+ data.url+"
"+ "
" 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() @@ -61,12 +70,30 @@ var row = function(data){ addObject("url_ressources", data) $("#ressources_list").append(row(data)) $(".presLink").click(function(){ - $.post('/set', {url:this.value}, function(data) {console.log("hop")}) - }) + $.post('/set', {url:this.value}, function(data) {console.log("hop")}) + }) } }) + }) + + $("#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' + }); + + }) }) - }) diff --git a/views/.index.jade.swp b/views/.index.jade.swp deleted file mode 100644 index a94f7fa..0000000 Binary files a/views/.index.jade.swp and /dev/null differ diff --git a/views/index.jade b/views/index.jade index a2fb15c..f7b0ead 100644 --- a/views/index.jade +++ b/views/index.jade @@ -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