-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can create and remove proyects, change their name and everything !
AppleLAN
committed
Jan 8, 2015
1 parent
6037ff9
commit cbcdd1a
Showing
4 changed files
with
235 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<!DOCTYPE html> | ||
<html lang="eng" ng-app="ToDo"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>todo</title> | ||
<style> | ||
body { | ||
padding: 20px; | ||
background-color: #BDF1F1; | ||
} | ||
|
||
button { | ||
padding: 10px; | ||
background-color: #28baba; | ||
color: #ffffff !important; | ||
font-family: helvetica,arial !important; | ||
font-size: 20px; | ||
line-height: 24px; | ||
border-style: groove; | ||
border-radius: 15px; | ||
border-color: #4C6060; } | ||
|
||
li { | ||
padding: 10px; | ||
background-color: #ffffff; | ||
color: #333333; | ||
font-family: helvetica,arial; | ||
font-size: 20px; | ||
line-height: 24px; | ||
border-style: groove; | ||
border-radius: 15px; | ||
border-color: #4C6060; } | ||
|
||
form { | ||
padding: 5px; } | ||
|
||
.done { | ||
text-decoration: line-through; | ||
color: #ccc; } | ||
</style> | ||
</head> | ||
<body id="change"> | ||
<div ng-controller="todoController" ng-init="init()"> | ||
|
||
<input class="color" value="" onblur="pick()" id="colorpick"> | ||
<form name="frm" ng-submit="addTodo()"> | ||
<input type="text" name="newTodo" ng-model="newTodo" required/> | ||
<button ng-disabled="frm.$invalid">Go</button> | ||
</form> | ||
<button class="btn btn-default btn-sm" ng-click="saveInput()">Save</button> | ||
<button class="btn btn-default btn-sm" ng-click="loadInput()">Load</button> | ||
<button class="btn btn-default btn-sm" ng-click="clearCompleted()">Clear Completed</button> | ||
<button class="btn btn-default btn-sm" ng-click="showCompleted()">Show Completed</button> | ||
<button class="btn btn-default btn-sm" ng-click="exportPartialData()">Export Partial Data</button> | ||
<button class="btn btn-default btn-sm" ng-click="exportFullData()">Export Full Data</button> | ||
<ul> | ||
<li ng-repeat="todo in todos"> | ||
<input type="checkbox" ng-model="todo.done"/> | ||
<span ng-class="{'done':todo.done}">{{todo.title}}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
<link href="css/bootstrap.css" rel="stylesheet"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
<script type="text/javascript" src="jscolor/jscolor.js"></script> | ||
<script src="http://alasql.org/console/alasql.min.js"></script> | ||
<script src="http://alasql.org/console/xlsx.core.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> | ||
<script src="ngStorage.min.js"></script> | ||
<script src="http://gregpike.net/demos/angular-local-storage/src/angular-local-storage.js"></script> | ||
<script> | ||
function LightenDarkenColor(col, amt) { | ||
var usePound = false; | ||
if (col[0] == "#") { | ||
col = col.slice(1); | ||
usePound = true; | ||
} | ||
var num = parseInt(col,16); | ||
var r = (num >> 16) + amt; | ||
if (r > 255) r = 255; | ||
else if (r < 0) r = 0; | ||
var b = ((num >> 8) & 0x00FF) + amt; | ||
if (b > 255) b = 255; | ||
else if (b < 0) b = 0; | ||
var g = (num & 0x0000FF) + amt; | ||
if (g > 255) g = 255; | ||
else if (g < 0) g = 0; | ||
return (usePound?"#":"") + (g | (b << 8) | (r << 16)).toString(16); | ||
} | ||
var cook = null; | ||
function pick(){ | ||
var elem = document.getElementById("colorpick").value; | ||
cook = document.cookie="#" + elem; | ||
var colour = document.getElementById("change"); | ||
colour.style.background = cook; | ||
var buttonBackgroundColor = LightenDarkenColor(cook, -50); | ||
var buttonelement = document.getElementsByTagName('button'); | ||
for(var i=0;i<buttonelement.length;i++){ | ||
buttonelement[i].style.background= buttonBackgroundColor; | ||
} | ||
|
||
} | ||
var ToDo =angular.module('ToDo',['ngStorage']); | ||
ToDo.controller('todoController', function($scope, $localStorage){ | ||
$scope.todos = []; | ||
$scope.Saved = []; | ||
$scope.exportPartialData = function () { | ||
alasql('SELECT * INTO XLSX("PartialReport.xlsx",{headers:true}) FROM ?',[$scope.todos]); | ||
}; | ||
$scope.exportFullData = function () { | ||
$scope.full=$scope.todos | ||
$scope.full.concat($scope.Saved); | ||
alasql('SELECT * INTO XLSX("FullReport.xlsx",{headers:true}) FROM ?',[$scope.full]); | ||
}; | ||
$scope.addTodo = function(){ | ||
$scope.todos.push({'title' : $scope.newTodo, 'done' :false}) | ||
$scope.newtodo = '' | ||
} | ||
$scope.clearCompleted = function(){ | ||
$scope.todos = $scope.todos.filter(function(item){ | ||
if(item.done){ | ||
$scope.Saved.push(item); | ||
} | ||
return !item.done | ||
}) | ||
} | ||
$scope.showCompleted = function(){ | ||
alert($scope.Saved.length) | ||
} | ||
$scope.saveInput = function() { | ||
$localStorage.Saved = $scope.todos; | ||
} | ||
$scope.loadInput = function() { | ||
$scope.todos = $localStorage.Saved; | ||
} | ||
$scope.init = function(){ | ||
if($localStorage.Saved != undefined) | ||
$scope.todos = $localStorage.Saved; | ||
else | ||
$scope.todos = [ | ||
{'title':'Build a ToDo app', 'done' :false} | ||
]; | ||
}; | ||
window.onbeforeunload = function (event) { | ||
var message = 'Sure you want to leave?'; | ||
if (typeof event == 'undefined') { | ||
event = window.event; | ||
} | ||
if (event) { | ||
event.returnValue = message; | ||
$localStorage.Saved = $scope.todos; | ||
|
||
} | ||
return message; | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,3 @@ | ||
@-webkit-keyframes snow { | ||
0% { background-position: 0px 0px, 0px 0px, 0px 0px } | ||
50% { background-color: #b4cfe0 } | ||
100% { | ||
background-position: 500px 1000px, 400px 400px, 300px 300px; | ||
background-color: #6b92b9; | ||
} | ||
body{ | ||
font-family: helvetica, arial, sans-serif !important; | ||
} | ||
@-moz-keyframes snow { | ||
0% { background-position: 0px 0px, 0px 0px, 0px 0px } | ||
50% { background-color: #b4cfe0 } | ||
100% { | ||
background-position: 500px 1000px, 400px 400px, 300px 300px; | ||
background-color: #6b92b9; | ||
} | ||
} | ||
@-ms-keyframes snow { | ||
0% { background-position: 0px 0px, 0px 0px, 0px 0px } | ||
50% { background-color: #b4cfe0 } | ||
100% { | ||
background-position: 500px 1000px, 400px 400px, 300px 300px; | ||
background-color: #6b92b9; | ||
} | ||
} | ||
@keyframes snow { | ||
0% { background-position: 0px 0px, 0px 0px, 0px 0px } | ||
50% { background-color: #b4cfe0 } | ||
100% { | ||
background-position: 500px 1000px, 400px 400px, 300px 300px; | ||
background-color: #6b92b9; | ||
} | ||
} | ||
@-webkit-viewport { width: device-width; } | ||
@-moz-viewport { width: device-width; } | ||
@-ms-viewport { width: device-width; } | ||
@-o-viewport { width: device-width; } | ||
@viewport { width: device-width; } | ||
/*# sourceMappingURL=style.css.map */ |