From 7fceb4441f776482ec3bac27f40db9a034fab1fa Mon Sep 17 00:00:00 2001 From: aylincsknpnr Date: Sun, 1 Mar 2015 03:09:45 +0200 Subject: [PATCH] =?UTF-8?q?dosyaya=20=C3=A7oklu=20yazabilme=20ger=C3=A7ekl?= =?UTF-8?q?e=C5=9Ftirildi=20ve=20tasar=C4=B1mda=20de=C4=9Fi=C5=9Fiklikler?= =?UTF-8?q?=20yap=C4=B1ld=C4=B1=20related=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tripwire/app.css | 44 +++++++++++++++ tripwire/app.js | 130 ++++++++++++++++++++++++-------------------- tripwire/index.html | 34 ++++++++++-- 3 files changed, 145 insertions(+), 63 deletions(-) create mode 100644 tripwire/app.css diff --git a/tripwire/app.css b/tripwire/app.css new file mode 100644 index 0000000..56be794 --- /dev/null +++ b/tripwire/app.css @@ -0,0 +1,44 @@ + +#h3{ + background: #ffff +} +#head{ + background: #ffff +} +body { + + background-color:#7F0E0E; +} + +label { + display:block; + position:static; + padding:0 10px; + font-size:18px; + line-height:30px; + text-decoration:none; + background-color:#FB6423; + color:white; + border-radius:15px 50px 50px 15px; + -webkit-border-radius:0px 5px 5px 0px; + -moz-border-radius:0px 5px 5px 0px; + +} + +} +label span { + + width: 10px; + height: 10px; + background: #ddd; + margin-right: 3px; +} +label.checked { + color: green; +} +label.checked span { + background: green; +} +div{ + background-color:#ffff; +} diff --git a/tripwire/app.js b/tripwire/app.js index 3a29622..2796731 100644 --- a/tripwire/app.js +++ b/tripwire/app.js @@ -1,70 +1,84 @@ -function listContents(storagename) { - -//Clear up the list first - $('#results').html(""); - var files = navigator.getDeviceStorage(storagename); - - var cursor = files.enumerate(); - - cursor.onsuccess = function () { -//alert("Got something"); - var file = this.result; - if (file != null) { - $("

" + file.name + "

").appendTo('#results'); - this.done = false; - } - else { - $('

').appendTo('#results'); - this.done = true; - } - if (!this.done) { - this.continue(); - } - } +//storage file list +function listContents(storagename) { + console.log("app lunch"); + //Clear up the list first + $('#results').html(""); + var files = navigator.getDeviceStorage(storagename); + var cursor = files.enumerate(); + cursor.onsuccess = function () { + var file = this.result; + if (file != null) { + //file name add checkbox + $("").appendTo('#results'); + this.done = false; + } + else { + //save button + $('

').appendTo('#results'); + this.done = true; + } + if (!this.done) { + this.continue(); + } + } } - - $('input.btn').live('click', function() { - $('input.sec:checked').each(function() { - // alert($(this).val()) - $('#results').html("start") - var sdcard = navigator.getDeviceStorage("sdcard"); - var file = new Blob([$(this).val()], {type: "text/plain"}); - - - var request = sdcard.addNamed(file, d.yyyymmdd()+".txt"); - request.onsuccess = function () { - var name = this.result; - $('#results').html("yazıldı") - console.log('File "' + name + '" successfully wrote on the sdcard storage area'); - } +//button click event +$('input.btn').live('click', function() { + console.log("buton click"); + var fileNames = []; + $('input.sec:checked').each(function() { + alert($(this).val()) + //creating files in sdcard + $('#results').html("start") + fileNames.push($(this).val()); + }); + + var fileString = fileNames.join("\n"); + var file = new Blob([fileString], {type: "text/plain"}); + //files named with the time information + var sdcard = navigator.getDeviceStorage("sdcard"); + var request = sdcard.addNamed(file, d.yyyymmdd()+".txt"); + //var request = sdcard.addNamed(file, "2015.02.25-23.41.03.txt"); + //is printed on the selected files in the file + request.onsuccess = function () { + // for(i=0;i<$('input.sec:checked').length;i++){ + // var temp = new Array(); + //temp = $(this).split(' '); + var name = $(this).result; + // var name2=name.toString(); + //var name=$('input.sec:checked').val() + //.toString(); + $('#results').html("yazıldı"); + console.log('File "' + name + '" successfully wrote on the sdcard storage area'); + //alert(name); + } + + // An error typically occur if a file with the same name already exist + request.onerror = function () { + $('#results').html("hata") + console.warn('Unable to write the file: ' + this.error); + } - // An error typically occur if a file with the same name already exist - request.onerror = function () { - $('#results').html("hata") - console.warn('Unable to write the file: ' + this.error); - } - -}); - -$('#results').html("text") + $('#results').html("text") }); +//listed files stored on sdcard $(document).ready(function(){ - listContents("sdcard"); - + listContents("sdcard"); }); + +//Retrieving current date time information Date.prototype.yyyymmdd = function() { - var yyyy = this.getFullYear().toString(); - var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based - var dd = this.getDate().toString(); - var h = this.getHours().toString(); - var m = this.getMinutes().toString(); - var s = this.getSeconds().toString(); + var yyyy = this.getFullYear().toString(); + var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based + var dd = this.getDate().toString(); + var h = this.getHours().toString(); + var m = this.getMinutes().toString(); + var s = this.getSeconds().toString(); - return yyyy + "." + (mm[1]?mm:"0"+mm[0]) + "." + (dd[1]?dd:"0"+dd[0]) + "-" + (h[1]?h:"0"+h[0]) +"." + (m[1]?m:"0"+m[0]) +"." + (s[1]?s:"0"+s[0]); // padding + return yyyy + "." + (mm[1]?mm:"0"+mm[0]) + "." + (dd[1]?dd:"0"+dd[0]) + "-" + (h[1]?h:"0"+h[0]) +"." + (m[1]?m:"0"+m[0]) +"." + (s[1]?s:"0"+s[0]); // padding }; - d = new Date(); -alert( d.yyyymmdd() ); \ No newline at end of file +alert( d.yyyymmdd() ); \ No newline at end of file diff --git a/tripwire/index.html b/tripwire/index.html index 8273b73..2e2a036 100644 --- a/tripwire/index.html +++ b/tripwire/index.html @@ -1,14 +1,16 @@ - + Notes + + @@ -16,8 +18,8 @@
-