Fixed Email, Save on Mn Sdcard (B2G), Increased font size, Color Picker closed by clicking outside

This commit is contained in:
Mahdi Dibaiee 2014-02-20 13:36:52 +03:30
parent 63ac7fe5a3
commit a8c78d482d
17 changed files with 86 additions and 65 deletions

View File

@ -52,13 +52,13 @@ module.exports = function(grunt) {
{
expand: true,
cwd: 'Shared',
src: 'img',
src: 'img/**',
dest: 'build/mobile'
},
{
expand: true,
cwd: 'Shared',
src: 'img',
src: 'img/**',
dest: 'build/web'
},
{
@ -109,7 +109,7 @@ module.exports = function(grunt) {
}
},
copy: {
files: 'Shared/**',
files: ['Shared/img/**', 'Mobile/index.html', 'Mobile/manifest.webapp', 'Web/index.html', 'Web/manifest.webapp', 'Web/cache.appcache'],
tasks: 'copy',
options: {
spawn: false

View File

@ -42,7 +42,7 @@
<hr>
<div class='sketch'>
<p class='icon-settings'>Sketch</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="1" max="100"></progress>
@ -53,7 +53,7 @@
<div class='fur hidden'>
<p class='icon-settings'>Fur</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="10" max="100"></progress>

View File

@ -2,7 +2,6 @@ $(document).ready(function() {
$('*').off('click mousemove mousedown mouseup mouseleave').on('click mousemove mousedown mouseup mouseleave', function(e) {
e.preventDefault;
return false;
})
$('a[href^="http"]').tap(function(e) {
@ -19,17 +18,17 @@ $(document).ready(function() {
$('a[href^="mailto"]').tap(function(e) {
e.preventDefault();
var mail = /mailto:(.*)/.exec($(this).attr('href'))[1];
var mail = new MozActivity({
name: 'new',
data: {
type: 'mail',
url: mail
url: $(this).attr('href')
}
})
})
window.save = function() {
var f = c.getImageData(0, 0, width(), height());
switch(save.background) {
case 'white': {
c.fillStyle = 'white';
@ -63,7 +62,7 @@ $(document).ready(function() {
localStorage.setItem('projects', JSON.stringify(list));
}
}
else
else {
list ? list.push({
name: save['file name'],
data: data,
@ -74,13 +73,22 @@ $(document).ready(function() {
points: window.points
}];
localStorage.setItem('projects', JSON.stringify(list));
}
} else {
window.open(data, '_blank').focus();
var sd = navigator.getDeviceStorage('pictures');
var file = dataToBlob(data);
var req = sd.addNamed(file, save['file name'] + '.png');
req.onsuccess = function() {
alert('Your Sketch was saved successfuly: ' + this.result);
}
c.putImageData(window.points.history[window.points.history.last].data, 0, 0);
req.onerror = function(e) {
alert('Something bad happened trying to save your sketch ' + save['file name'] + '\n Possible reasons:\n Duplicate Name \n Not enough permission')
console.log(e);
console.log(this);
}
}
c.putImageData(f, 0, 0);
}
window.load = function() {
var file = JSON.parse(localStorage.getItem('projects')).filter(function(a) { return a.name == load.file })[0];
var img = document.createElement('img');

View File

@ -35,7 +35,7 @@
],
"permissions": {
"device-storage:pictures": {
"description": "Required to save sketched pics",
"description": "Required to save sketches",
"access": "readwrite"
}
}

View File

@ -9,6 +9,7 @@ html, body {
overflow: hidden;
width: 100%;
height: 100%;
position: absolute;
}
*::-moz-focus-inner {
@ -180,25 +181,22 @@ header {
}
}
#menu {
width: 15rem;
width: 15.4rem;
height: 100%;
display: block;
background: #262626;
position: absolute;
left: -15rem;
left: -15.4rem;
top: 5rem;
color: white;
font-family: 'MozTT-Light';
font-size: 8pt;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
border-collapse: collapse;
overflow-y: auto;
overflow: hidden;
&.pulled {
left: 0;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
}
button[id^='set'], p, .bottom button {
@ -208,8 +206,8 @@ header {
color: white;
text-align: left;
margin: 1rem 2.5rem;
font-family: 'MozTT-Light';
font-size: 8pt;
font-family: 'MozTT-Light' !important;
font-size: 9pt;
padding: 0 0.6rem;
cursor: pointer;
}
@ -219,6 +217,7 @@ header {
span {
float: right;
font-size: 7pt;
padding-top: 0.3rem;
}
div[role='slider'] {
width: 60%;
@ -243,6 +242,7 @@ header {
*[class^='icon'] {
display: block;
margin: 1rem 0.5rem;
font-family: 'MozTT-Regular' !important;
&:nth-of-type(2) {
padding-top: 0.5rem;
@ -275,6 +275,7 @@ header {
display: table-row;
vertical-align: top;
margin-top: 1rem;
width: 100%;
}
.bottom {
width: 100%;

View File

@ -1,6 +1,5 @@
"use strict";
$(window).resize(sizeAndPos);
$(document).ready(function() {
$('.menu').on('click tap', function() {
$('#menu').toggleClass('pulled');
@ -10,7 +9,7 @@ $(document).ready(function() {
})
$('.load').on('click tap', function() {
$('#load').removeClass('hidden');
$('#load li').remove();
$('#load li, #load p').remove();
var list = JSON.parse(localStorage.getItem('projects'));
if( !list || list.length < 1 ) {
$('#load ol').append(
@ -29,16 +28,10 @@ $(document).ready(function() {
$(this).attr('aria-selected', 'true');
})
$('#pro').on('click tap', function() {
$('#save ol:nth-of-type(2) li').each(function() {
if( $(this).find('span').html() !== 'Transparent' ) {
$(this).addClass('hidden');
$(this).removeAttr('aria-selected');
}
else $(this).attr('aria-selected', 'true');
})
$('#save ol:nth-of-type(2)').addClass('hidden');
})
$('#exp').on('click tap', function() {
$('#save ol:nth-of-type(2) li').removeClass('hidden');
$('#save ol:nth-of-type(2)').removeClass('hidden');
})
})
$('#pro').on('click tap', function() {
@ -112,6 +105,14 @@ $(document).ready(function() {
points: window.points.slice(0)
})
window.points.history.last = window.points.history.length-1;
}).on('longTap', function(e) {
if( settings.type == 'line' ) {
e.preventDefault();
window.active = false;
points[points.length-1].type = '';
points[points.length-1].start = undefined;
finishLine();
}
})
// Value Selector
@ -181,6 +182,12 @@ $(document).ready(function() {
return $(this).on('click tap', function() {
$('.picker').removeClass('hidden');
$('.picker').attr('data-caller', target);
setTimeout(function() {
$('body').on('click tap', 'canvas, #menu, header', function() {
$('.picker').addClass('hidden');
$('body').off('click tap');
})
}, 500);
})
}
$(this).on('click tap', function(e) {
@ -229,6 +236,7 @@ $(document).ready(function() {
$('.close, .tour button').on('click tap', function() {
$(this).parent().addClass('hidden');
$('body').off('click tap');
})
// Bottom

View File

@ -44,7 +44,7 @@
<hr>
<div class='sketch'>
<p class='icon-settings'>Sketch</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="1" max="100"></progress>
@ -55,7 +55,7 @@
<div class='fur hidden'>
<p class='icon-settings'>Fur</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="10" max="100"></progress>

View File

@ -8,6 +8,7 @@ $(document).ready(function() {
nope: ['js/libs/color-picker.js']
})
$(window).resize(sizeAndPos);
function save() {
switch(save.background) {

View File

@ -364,6 +364,7 @@ body {
overflow: hidden;
width: 100%;
height: 100%;
position: absolute;
}
*::-moz-focus-inner {
border: none;
@ -527,23 +528,21 @@ header #title {
left: -2rem;
}
#menu {
width: 15rem;
width: 15.4rem;
height: 100%;
display: block;
background: #262626;
position: absolute;
left: -15rem;
left: -15.4rem;
top: 5rem;
color: white;
font-family: 'MozTT-Light';
font-size: 8pt;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
border-collapse: collapse;
overflow-y: auto;
overflow: hidden;
}
#menu.pulled {
left: 0;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
}
#menu button[id^='set'],
#menu p,
@ -554,8 +553,8 @@ header #title {
color: white;
text-align: left;
margin: 1rem 2.5rem;
font-family: 'MozTT-Light';
font-size: 8pt;
font-family: 'MozTT-Light' !important;
font-size: 9pt;
padding: 0 0.6rem;
cursor: pointer;
}
@ -565,6 +564,7 @@ header #title {
#menu span {
float: right;
font-size: 7pt;
padding-top: 0.3rem;
}
#menu div[role='slider'] {
width: 60%;
@ -588,6 +588,7 @@ header #title {
#menu *[class^='icon'] {
display: block;
margin: 1rem 0.5rem;
font-family: 'MozTT-Regular' !important;
}
#menu *[class^='icon']:nth-of-type(2) {
padding-top: 0.5rem;
@ -617,6 +618,7 @@ header #title {
display: table-row;
vertical-align: top;
margin-top: 1rem;
width: 100%;
}
#menu .bottom {
width: 100%;

View File

@ -42,7 +42,7 @@
<hr>
<div class='sketch'>
<p class='icon-settings'>Sketch</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="1" max="100"></progress>
@ -53,7 +53,7 @@
<div class='fur hidden'>
<p class='icon-settings'>Fur</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="10" max="100"></progress>
@ -254,7 +254,6 @@
<script src='js/libs/color-picker-touch.js'></script>
<script src='js/functions.js'></script>
<script src='js/shared.js'></script>
<script src='js/main.js'></script>
<script src='js/events.js'></script>
<script src='js/diff.js'></script>

View File

@ -1 +1 @@
$(document).ready(function(){$("*").off("click mousemove mousedown mouseup mouseleave").on("click mousemove mousedown mouseup mouseleave",function(a){return a.preventDefault,!1}),$('a[href^="http"]').tap(function(a){a.preventDefault();{var b=$(this).attr("href");new MozActivity({name:"view",data:{type:"url",url:b}})}}),$('a[href^="mailto"]').tap(function(a){a.preventDefault();var b=/mailto:(.*)/.exec($(this).attr("href"))[1],b=new MozActivity({name:"new",data:{type:"mail",url:b}})}),window.save=function(){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 a=$c[0].toDataURL();if("sketchy project"==save.type){var b,d=JSON.parse(localStorage.getItem("projects"));d&&d.some(function(a,c){return a.name==save["file name"]?(b=c,!0):!1})?(console.log(b),d[b]={name:save["file name"],data:a,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(d))):d?d.push({name:save["file name"],data:a,points:window.points}):d=[{name:save["file name"],data:a,points:window.points}],localStorage.setItem("projects",JSON.stringify(d))}else window.open(a,"_blank").focus();c.putImageData(window.points.history[window.points.history.last].data,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("sawTips")!=settings.version&&($(".tour").removeClass("hidden"),localStorage.setItem("sawTips",settings.version))});
$(document).ready(function(){$("*").off("click mousemove mousedown mouseup mouseleave").on("click mousemove mousedown mouseup mouseleave",function(a){a.preventDefault}),$('a[href^="http"]').tap(function(a){a.preventDefault();{var b=$(this).attr("href");new MozActivity({name:"view",data:{type:"url",url:b}})}}),$('a[href^="mailto"]').tap(function(a){a.preventDefault();new MozActivity({name:"new",data:{type:"mail",url:$(this).attr("href")}})}),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})?(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}):e=[{name:save["file name"],data:b,points:window.points}],localStorage.setItem("projects",JSON.stringify(e)))}else{var f=navigator.getDeviceStorage("pictures"),g=dataToBlob(b),h=f.addNamed(g,save["file name"]+".png");h.onsuccess=function(){alert("Your Sketch was saved successfuly: "+this.result)},h.onerror=function(a){alert("Something bad happened trying to save your sketch "+save["file name"]+"\n Possible reasons:\n Duplicate Name \n Not enough permission"),console.log(a),console.log(this)}}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("sawTips")!=settings.version&&($(".tour").removeClass("hidden"),localStorage.setItem("sawTips",settings.version))});

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
],
"permissions": {
"device-storage:pictures": {
"description": "Required to save sketched pics",
"description": "Required to save sketches",
"access": "readwrite"
}
}

View File

@ -364,6 +364,7 @@ body {
overflow: hidden;
width: 100%;
height: 100%;
position: absolute;
}
*::-moz-focus-inner {
border: none;
@ -527,23 +528,21 @@ header #title {
left: -2rem;
}
#menu {
width: 15rem;
width: 15.4rem;
height: 100%;
display: block;
background: #262626;
position: absolute;
left: -15rem;
left: -15.4rem;
top: 5rem;
color: white;
font-family: 'MozTT-Light';
font-size: 8pt;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
border-collapse: collapse;
overflow-y: auto;
overflow: hidden;
}
#menu.pulled {
left: 0;
transition: left 0.2s ease-out;
transition: left 0.3s ease-out;
}
#menu button[id^='set'],
#menu p,
@ -554,8 +553,8 @@ header #title {
color: white;
text-align: left;
margin: 1rem 2.5rem;
font-family: 'MozTT-Light';
font-size: 8pt;
font-family: 'MozTT-Light' !important;
font-size: 9pt;
padding: 0 0.6rem;
cursor: pointer;
}
@ -565,6 +564,7 @@ header #title {
#menu span {
float: right;
font-size: 7pt;
padding-top: 0.3rem;
}
#menu div[role='slider'] {
width: 60%;
@ -588,6 +588,7 @@ header #title {
#menu *[class^='icon'] {
display: block;
margin: 1rem 0.5rem;
font-family: 'MozTT-Regular' !important;
}
#menu *[class^='icon']:nth-of-type(2) {
padding-top: 0.5rem;
@ -617,6 +618,7 @@ header #title {
display: table-row;
vertical-align: top;
margin-top: 1rem;
width: 100%;
}
#menu .bottom {
width: 100%;

View File

@ -44,7 +44,7 @@
<hr>
<div class='sketch'>
<p class='icon-settings'>Sketch</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="1" max="100"></progress>
@ -55,7 +55,7 @@
<div class='fur hidden'>
<p class='icon-settings'>Fur</p>
<p id='connectTelorance'>Connet Telorance<span>40</span></p>
<p id='connectTelorance'>Telorance<span>40</span></p>
<div role="slider" class='connectTelorance'>
<div>
<progress value="40" min="10" max="100"></progress>

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";$(document).ready(function(){function a(){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 b=$c[0].toDataURL();if("sketchy project"==a.type){var d,e=JSON.parse(localStorage.getItem("projects"));e&&e.some(function(b,c){return b.name==a["file name"]?(d=c,!0):!1})?(console.log(d),e[d]={name:a["file name"],data:b,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(e))):e?e.push({name:a["file name"],data:b,points:window.points}):e=[{name:a["file name"],data:b,points:window.points}],localStorage.setItem("projects",JSON.stringify(e))}else window.open(b,"_blank").focus();c.putImageData(window.points.history[window.points.history.last].data,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.load=b,window.save=a});
"use strict";$(document).ready(function(){function a(){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 b=$c[0].toDataURL();if("sketchy project"==a.type){var d,e=JSON.parse(localStorage.getItem("projects"));e&&e.some(function(b,c){return b.name==a["file name"]?(d=c,!0):!1})?(console.log(d),e[d]={name:a["file name"],data:b,points:window.points,settings:settings},localStorage.setItem("projects",JSON.stringify(e))):e?e.push({name:a["file name"],data:b,points:window.points}):e=[{name:a["file name"],data:b,points:window.points}],localStorage.setItem("projects",JSON.stringify(e))}else window.open(b,"_blank").focus();c.putImageData(window.points.history[window.points.history.last].data,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});