Download
@ -1,22 +0,0 @@
|
|||||||
<widget id='com.mdibaiee.sketchy' version='1.2.1'>
|
|
||||||
|
|
||||||
<name>Sketchy</name>
|
|
||||||
<description>
|
|
||||||
Free full-featured Sketch app
|
|
||||||
</description>
|
|
||||||
<author email='mdibaiee@aol.com' href='http://dibaiee.ir'>
|
|
||||||
Mahdi Dibaiee
|
|
||||||
</author>
|
|
||||||
<content src='index.html'/>
|
|
||||||
<access origin='*'/>
|
|
||||||
|
|
||||||
<preference name='KeepRunning' value='false'/>
|
|
||||||
<preference name='SplashScreen' value='sketchy'/>
|
|
||||||
<preference name='SetFullScreen' value='true'/>
|
|
||||||
<preference name='FullScreen' value='true'/>
|
|
||||||
<preference name='DisallowOverscroll' value='true'/>
|
|
||||||
|
|
||||||
<icon src='icon.png'/>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
|||||||
<title>Sketchy</title>
|
<title>Sketchy</title>
|
||||||
<meta charset='UTF-8'>
|
<meta charset='UTF-8'>
|
||||||
<link rel='stylesheet' href='css/main.css'>
|
<link rel='stylesheet' href='css/main.css'>
|
||||||
|
<script src='cordova.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$(document).on('resume', function() {
|
||||||
|
sizeAndPos();
|
||||||
|
})
|
||||||
|
document.addEventListener('deviceready', function() {
|
||||||
|
sizeAndPos();
|
||||||
|
|
||||||
$('*').off('click mousemove mousedown mouseup mouseleave').on('click mousemove mousedown mouseup mouseleave', function(e) {
|
$('*').off('click mousemove mousedown mouseup mouseleave').on('click mousemove mousedown mouseup mouseleave', function(e) {
|
||||||
e.preventDefault;
|
e.preventDefault;
|
||||||
})
|
})
|
||||||
@ -14,6 +20,7 @@ $(document).ready(function() {
|
|||||||
url: href
|
url: href
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}).click(function(e) {
|
}).click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -35,6 +42,8 @@ $(document).ready(function() {
|
|||||||
return false;
|
return false;
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.save = function() {
|
window.save = function() {
|
||||||
var f = c.getImageData(0, 0, width(), height());
|
var f = c.getImageData(0, 0, width(), height());
|
||||||
switch(save.background) {
|
switch(save.background) {
|
||||||
@ -85,18 +94,21 @@ $(document).ready(function() {
|
|||||||
localStorage.setItem('projects', JSON.stringify(list));
|
localStorage.setItem('projects', JSON.stringify(list));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
var img = dataToBlob(data);
|
||||||
var sd = window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
|
var sd = window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
|
||||||
var fdata = dataToBlob(data);
|
window.alert('SD');
|
||||||
var req = fs.root.getFile(save['file name'] + '.png', {create: true}, function(file) {
|
/*var req = fs.root.getFile(save['file name'] + '.png', {create: true}, function(entry) {
|
||||||
file.createWriter(function(writer) {
|
alert('Entry');
|
||||||
writer.write(fdata);
|
entry.createWriter(function(writer) {
|
||||||
alert('Your Sketch was saved successfuly: ' + this.result);
|
writer.write(img);
|
||||||
|
alert('Your Sketch was saved successfuly');
|
||||||
}, function() {
|
}, function() {
|
||||||
alert('Something bad happened trying to save your sketch ' + save['file name'] + '\n Possible reasons:\n Duplicate Name \n Not enough permission')
|
alert('Something bad happened trying to save your sketch ' + save['file name'] + '\n Possible reasons:\n Duplicate Name \n Not enough permission')
|
||||||
})
|
})
|
||||||
})
|
})*/
|
||||||
}, function(error) {
|
}, function(e) {
|
||||||
alert('Couldn\'t access filesystem\n' + error.message);
|
alert('SD Error')
|
||||||
|
//alert('Couldn\'t access filesystem\nERR: ' + e.code);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
c.putImageData(f, 0, 0);
|
c.putImageData(f, 0, 0);
|
||||||
@ -119,5 +131,6 @@ $(document).ready(function() {
|
|||||||
$('.vote').removeClass('hidden');
|
$('.vote').removeClass('hidden');
|
||||||
localStorage.setItem('sawVote', true);
|
localStorage.setItem('sawVote', true);
|
||||||
}
|
}
|
||||||
|
}, false)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
BIN
Android/res/icons/android/icon-48-mdpi.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@ -21,6 +21,13 @@ module.exports = function(grunt) {
|
|||||||
dest: 'build/web/js',
|
dest: 'build/web/js',
|
||||||
filter: 'isFile'
|
filter: 'isFile'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
expand: true,
|
||||||
|
cwd: 'Shared/js',
|
||||||
|
src: '**',
|
||||||
|
dest: 'build/android/js',
|
||||||
|
filter: 'isFile'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: 'Mobile/js/',
|
cwd: 'Mobile/js/',
|
||||||
@ -79,7 +86,7 @@ module.exports = function(grunt) {
|
|||||||
{
|
{
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: 'Android',
|
cwd: 'Android',
|
||||||
src: ['index.html', 'config.xml', 'res/**', 'icon.png'],
|
src: ['index.html', 'config.xml', 'AndroidManifest.xml', 'res/**', 'icon.png'],
|
||||||
dest: 'build/android'
|
dest: 'build/android'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,8 @@ $(document).ready(function() {
|
|||||||
}];
|
}];
|
||||||
localStorage.setItem('projects', JSON.stringify(list));
|
localStorage.setItem('projects', JSON.stringify(list));
|
||||||
} else {
|
} else {
|
||||||
window.open(data, '_blank').focus();
|
$('<a href="' + data + '" download="' + save['file name'] + '.png"></a>').click();
|
||||||
|
//window.open(data, '_blank').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
c.putImageData(f, 0, 0);
|
c.putImageData(f, 0, 0);
|
||||||
|
2
build/android/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
<uses-permission android:name='android.permission.WRITE_EXTERNAL_STORAGE' />
|
@ -13,7 +13,7 @@
|
|||||||
</author>
|
</author>
|
||||||
<content src='index.html'/>
|
<content src='index.html'/>
|
||||||
<access origin='*'/>
|
<access origin='*'/>
|
||||||
<feature name="http://api.phonegap.com/1.0/device" />
|
<!--<feature name="http://api.phonegap.com/1.0/device" />-->
|
||||||
|
|
||||||
<preference name='KeepRunning' value='false'/>
|
<preference name='KeepRunning' value='false'/>
|
||||||
<preference name='SplashScreen' value='sketchy'/>
|
<preference name='SplashScreen' value='sketchy'/>
|
||||||
@ -21,7 +21,12 @@
|
|||||||
<preference name='FullScreen' value='true'/>
|
<preference name='FullScreen' value='true'/>
|
||||||
<preference name='DisallowOverscroll' value='true'/>
|
<preference name='DisallowOverscroll' value='true'/>
|
||||||
|
|
||||||
<icon src='icon.png'/>
|
<feature name='File'>
|
||||||
|
<param name='android-package' value='org.apache.cordova.file' />
|
||||||
|
</feature>
|
||||||
|
<plugins>
|
||||||
|
<plugin name='File' value='org.apache.cordova.file' />
|
||||||
|
</plugins>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<title>Sketchy</title>
|
<title>Sketchy</title>
|
||||||
<meta charset='UTF-8'>
|
<meta charset='UTF-8'>
|
||||||
<link rel='stylesheet' href='css/main.css'>
|
<link rel='stylesheet' href='css/main.css'>
|
||||||
|
<script src='cordova.js'></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -1 +1 @@
|
|||||||
$(document).ready(function(){$("*").off("click mousemove mousedown mouseup mouseleave").on("click mousemove mousedown mouseup mouseleave",function(a){a.preventDefault}),window.save=function(){var a=c.getImageData(0,0,width(),height());switch(save.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var b=$c[0].toDataURL();if("sketchy project"==save.type){var d,e=JSON.parse(localStorage.getItem("projects"));e&&e.some(function(a,b){return a.name==save["file name"]?(d=b,!0):!1})?confirm("A sketch with this name already exists. Do you want to overwrite "+save["file name"]+"?")&&(console.log(d),e[d]={name:save["file name"],data:b,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(e))):(e?e.push({name:save["file name"],data:b,points:window.points,settings:settings}):e=[{name:save["file name"],data:b,points:window.points,settings:settings}],localStorage.setItem("projects",JSON.stringify(e)))}else{window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(a){{var c=dataToBlob(b);a.root.getFile(save["file name"]+".png",{create:!0},function(a){a.createWriter(function(a){a.write(c),alert("Your Sketch was saved successfuly: "+this.result)},function(){alert("Something bad happened trying to save your sketch "+save["file name"]+"\n Possible reasons:\n Duplicate Name \n Not enough permission")})})}},function(a){alert("Couldn't access filesystem\n"+a.message)})}c.putImageData(a,0,0)},window.load=function(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==load.file})[0],b=document.createElement("img");b.src=a.data,b.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(b,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}},localStorage.getItem("sawVote")||($(".vote").removeClass("hidden"),localStorage.setItem("sawVote",!0))});
|
$(document).ready(function(){$(document).on("resume",function(){sizeAndPos()}),document.addEventListener("deviceready",function(){sizeAndPos(),$("*").off("click mousemove mousedown mouseup mouseleave").on("click mousemove mousedown mouseup mouseleave",function(a){a.preventDefault}),window.save=function(){var a=c.getImageData(0,0,width(),height());switch(save.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var b=$c[0].toDataURL();if("sketchy project"==save.type){var d,e=JSON.parse(localStorage.getItem("projects"));e&&e.some(function(a,b){return a.name==save["file name"]?(d=b,!0):!1})?confirm("A sketch with this name already exists. Do you want to overwrite "+save["file name"]+"?")&&(console.log(d),e[d]={name:save["file name"],data:b,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(e))):(e?e.push({name:save["file name"],data:b,points:window.points,settings:settings}):e=[{name:save["file name"],data:b,points:window.points,settings:settings}],localStorage.setItem("projects",JSON.stringify(e)))}else{dataToBlob(b),window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(){window.alert("SD")},function(){alert("SD Error")})}c.putImageData(a,0,0)},window.load=function(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==load.file})[0],b=document.createElement("img");b.src=a.data,b.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(b,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}},localStorage.getItem("sawVote")||($(".vote").removeClass("hidden"),localStorage.setItem("sawVote",!0))},!1)});
|
BIN
build/android/res/icons/android/icon-48-mdpi.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
build/android/res/icons/android/icon-60-hdpi.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
build/android/res/icons/android/icon.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
build/android/res/icons/icon.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
@ -1 +1 @@
|
|||||||
"use strict";$(document).ready(function(){function a(){var b=c.getImageData(0,0,width(),height());switch(a.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var d=$c[0].toDataURL();if("sketchy project"==a.type){var e,f=JSON.parse(localStorage.getItem("projects"));f&&f.some(function(b,c){return b.name==a["file name"]?(e=c,!0):!1})?confirm("A sketch with this name already exists. Do you want to overwrite "+a["file name"]+"?")&&(console.log(e),f[e]={name:a["file name"],data:d,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(f))):f?f.push({name:a["file name"],data:d,points:window.points,settings:settings}):f=[{name:a["file name"],data:d,points:window.points,settings:settings}],localStorage.setItem("projects",JSON.stringify(f))}else window.open(d,"_blank").focus();c.putImageData(b,0,0)}function b(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==b.file})[0],d=document.createElement("img");d.src=a.data,d.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(d,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}}yepnope({test:window.mobile,yep:["js/mobile.js","js/libs/color-picker-touch.js"],nope:["js/libs/color-picker.js"]}),$(window).resize(sizeAndPos),window.load=b,window.save=a});
|
"use strict";$(document).ready(function(){function a(){var b=c.getImageData(0,0,width(),height());switch(a.background){case"white":c.fillStyle="white",c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.fillStyle=settings.color,c.globalCompositeOperation=settings.composite;break;case"current color":c.fillStyle=settings.bg,c.globalCompositeOperation="destination-over",c.fillRect(0,0,width(),height()),c.globalCompositeOperation=settings.composite}var d=$c[0].toDataURL();if("sketchy project"==a.type){var e,f=JSON.parse(localStorage.getItem("projects"));f&&f.some(function(b,c){return b.name==a["file name"]?(e=c,!0):!1})?confirm("A sketch with this name already exists. Do you want to overwrite "+a["file name"]+"?")&&(console.log(e),f[e]={name:a["file name"],data:d,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(f))):f?f.push({name:a["file name"],data:d,points:window.points,settings:settings}):f=[{name:a["file name"],data:d,points:window.points,settings:settings}],localStorage.setItem("projects",JSON.stringify(f))}else $('<a href="'+d+'" download="'+a["file name"]+'.png"></a>').click();c.putImageData(b,0,0)}function b(){var a=JSON.parse(localStorage.getItem("projects")).filter(function(a){return a.name==b.file})[0],d=document.createElement("img");d.src=a.data,d.onload=function(){c.clearRect(0,0,width(),height()),c.drawImage(d,0,0),window.points=a.points,window.points.history=[{data:c.createImageData($c.width(),$c.height()),points:[]},{data:c.getImageData(0,0,width(),height()),points:a.points}],$c.first().css("background",a.settings.bg),window.settings.bg=a.settings.bg}}yepnope({test:window.mobile,yep:["js/mobile.js","js/libs/color-picker-touch.js"],nope:["js/libs/color-picker.js"]}),$(window).resize(sizeAndPos),window.load=b,window.save=a});
|
6
deploy-android
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
grunt;
|
||||||
|
cp -R build/android/* ~/Documents/Workshop/Sketchy-Android/sketchy/www/
|
||||||
|
cd ~/Documents/Workshop/Sketchy-Android/sketchy
|
||||||
|
phonegap run android
|