Skip to content

Commit

Permalink
Added multicopier chrome extension project
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedrias committed Feb 20, 2015
0 parents commit 26f3e33
Show file tree
Hide file tree
Showing 27 changed files with 26,802 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
11 changes: 11 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* User: Rias
* Date: 2/20/15
* Time: 8:06 PM
* Description : Description will be here
* File name : app.js
*/

"use strict";

angular.module("multicopier", [])
11 changes: 11 additions & 0 deletions app/background/background.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* User: Rias
* Date: 2/20/15
* Time: 10:28 PM
* Description : Description will be here
* File name : background.controller.js
*/
angular.module("multicopier.background")
.controller("BackgroundController", ["MultiCopierBackgroundService", function(MultiCopierBackgroundService) {

}]);
18 changes: 18 additions & 0 deletions app/background/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html data-ng-app="multicopier.background" data-ng-csp>
<head>
<script type="text/javascript" src="../common/lib/angular.js"></script>
<script type="text/javascript" src="../common/lib/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="../common/lib/moment.min.js"></script>
<link href="../common/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../common/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="../common/css/style.css" rel="stylesheet" type="text/css">
</head>
<body data-ng-controller="BackgroundController">
<section id="secret-sauce">
<input type="text" id="copier" value="" name="copier">
</section>
<script type="text/javascript" src="../app.js"></script>
<script type="text/javascript" src="background.service.js"></script>
<script type="text/javascript" src="background.controller.js"></script>
</body>
</html>
63 changes: 63 additions & 0 deletions app/background/background.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* User: Rias
* Date: 2/20/15
* Time: 8:01 PM
* Description : Description will be here
* File name : multicopier.service.js
*/

angular.module("multicopier.background",[])
.factory("MultiCopierBackgroundService", function () {

var multicopierService = {};

multicopierService.$selector = $("#secret-sauce #copier");

multicopierService.readLocalStorage = function () {
return ((localStorage.multicopier) ? JSON.parse(localStorage.multicopier) : []);
}


multicopierService.updateLocalStorage = function() {
localStorage.setItem("multicopier", JSON.stringify(multicopierService.dataStore));
}


multicopierService.dataStore = multicopierService.readLocalStorage();

multicopierService.onCopy = function () {
multicopierService.$selector.val('').focus();
document.execCommand('paste');
var data = multicopierService.$selector.val();
if(!data) return;
var isUnique = multicopierService.checkDuplicate(data);
if(!isUnique) return;
console.log(multicopierService.dataStore);
insertData(multicopierService.$selector.val());
}

var insertData = function(data) {
var tempData = {};
tempData.date = Date.now();
tempData.val = data;
multicopierService.dataStore.push(tempData);
multicopierService.updateLocalStorage();
}

multicopierService.checkDuplicate = function(value) {
var isUnique = true;
for(var i = 0, len = multicopierService.dataStore.length; i < len ; i++) {
if(multicopierService.dataStore[i].val == value) {
isUnique = false;
break;
}
};
return isUnique;
}

setInterval(function() {
multicopierService.onCopy();
},300);

return multicopierService;
});
1 change: 1 addition & 0 deletions app/common/css/bootstrap-theme.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions app/common/css/bootstrap.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/common/css/font-awesome.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/common/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
transition: height 0.4s ease-out;
}
Binary file added app/common/fonts/FontAwesome.otf
Binary file not shown.
Binary file added app/common/fonts/fontawesome-webfont.eot
Binary file not shown.
Loading

0 comments on commit 26f3e33

Please sign in to comment.