Skip to content

Commit

Permalink
copy paste demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cfjedimaster committed Nov 11, 2015
1 parent 3b5ca25 commit 40f4f58
Show file tree
Hide file tree
Showing 67 changed files with 148,860 additions and 0 deletions.
14 changes: 14 additions & 0 deletions copypaste/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions copypaste/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

node_modules/
platforms/
plugins/
1 change: 1 addition & 0 deletions copypaste/www/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Empty. Add your own CSS if you like */
Binary file added copypaste/www/img/ionic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions copypaste/www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>CopyPasteDemo</title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>

<script src="lib/ngCordova/dist/ng-cordova.js"></script>
</head>
<body ng-app="starter">

<ion-pane ng-controller="MainCtrl">
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content>

<div class="list list-inset">
<label class="item item-input">
<textarea placeholder="Comments"ng-model="comments"></textarea>
</label>
<div ng-show="hasURL">
<button class="button button-full button-assertive" ng-click="pasteURL()">
You have copied a URL. Add it?
</button>
</div>
</div>



</ion-content>
</ion-pane>
</body>
</html>
73 changes: 73 additions & 0 deletions copypaste/www/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic','ngCordova'])

.controller('MainCtrl', function($scope,$ionicPlatform,$cordovaClipboard,$interval) {

$scope.haURL = false;
$scope.comments = "";

var theURL = "";

$ionicPlatform.ready(function() {

//Begin looking for stuff in the clipboard
$interval(checkForURL, 4*1000);

});

var isURL = function(s) {
//Credit: http://stackoverflow.com/a/3809435
var expr = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i;
var regex = new RegExp(expr);
var result = s.match(regex);
if(result) return true;
return false;
};

var checkForURL = function() {
console.log('Checking the clipboard...');
$cordovaClipboard
.paste()
.then(function (result) {
console.log(result);
if(result && isURL(result)) {
$scope.hasURL = true;
theURL = result;
} else {
$scope.hasURL = false;
}
}, function (e) {
// error - do nothing cuz we don't care
});

};

$scope.pasteURL = function() {
console.log("Paste "+theURL);
$scope.comments += theURL;
//remove from clippboard
$cordovaClipboard.copy('').then(function () {
$scope.theURL = '';
}, function () {
// error
});
$scope.hasURL = false;
};

})
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
19 changes: 19 additions & 0 deletions copypaste/www/lib/angular-animate/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "angular-animate",
"version": "1.4.3",
"main": "./angular-animate.js",
"ignore": [],
"dependencies": {
"angular": "1.4.3"
},
"homepage": "https://github.com/angular/bower-angular-animate",
"_release": "1.4.3",
"_resolution": {
"type": "version",
"tag": "v1.4.3",
"commit": "4ce2a76359401102d2e0146ccf69e6c060799ff8"
},
"_source": "git://github.com/angular/bower-angular-animate.git",
"_target": "1.4.3",
"_originalSource": "angular-animate"
}
68 changes: 68 additions & 0 deletions copypaste/www/lib/angular-animate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# packaged angular-animate

This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).
Please file issues and pull requests against that repo.

## Install

You can install this package either with `npm` or with `bower`.

### npm

```shell
npm install angular-animate
```

Then add `ngAnimate` as a dependency for your app:

```javascript
angular.module('myApp', [require('angular-animate')]);
```

### bower

```shell
bower install angular-animate
```

Then add a `<script>` to your `index.html`:

```html
<script src="/bower_components/angular-animate/angular-animate.js"></script>
```

Then add `ngAnimate` as a dependency for your app:

```javascript
angular.module('myApp', ['ngAnimate']);
```

## Documentation

Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).

## License

The MIT License

Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 40f4f58

Please sign in to comment.