Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shprink committed Oct 6, 2015
1 parent 58042ed commit ef5d3b3
Show file tree
Hide file tree
Showing 15 changed files with 839 additions and 0 deletions.
54 changes: 54 additions & 0 deletions README.md
@@ -0,0 +1,54 @@
wp-api-angularjs
================

AngularJS services to consume [WP-API v2](http://v2.wp-api.org/)

## Documentation

<http://shprink.github.io/wp-api-angularjs/>

## Authentication

This library only supports basic auth. OAuth1 not being suitable for JS clients (it would mean exposing key and password out of the open)

### Basic auth

Basic auth is only secured to use if used during the app run time and used with a secured connection to your Blog (via SSL).

#### During run time

Make sure your WP-API runs with an SSL certificate (https) otherwise this will expose your credentials at every request.

Display a form for users to connect and use the following code to register credentials:

```
.controller(function(WpApi){
WpApi.setBasicCredentials(<login>, <password>);
});
```

#### During configuration

You can also set basic credentials during the configuration but use this should only be used for testing as it embed credentials in the application code.

```
.config(function(WpApiProvider){
WpApiProvider.setBasicCredentials(<login>, <password>);
});
```

## Contribute

```
npm install
cp config.dist.json config.json
# Open two terminals
# and run watch to build on the lib files changes
npm run watch
# in the other terminal run following to build the test page and the doc
npm run devserver
```

Open ```http://localhost:8080```
218 changes: 218 additions & 0 deletions dist/ionic-native-transitions.js

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

1 change: 1 addition & 0 deletions dist/ionic-native-transitions.js.map

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

1 change: 1 addition & 0 deletions dist/ionic-native-transitions.min.js

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

12 changes: 12 additions & 0 deletions lib/index.js
@@ -0,0 +1,12 @@
import Provider from './provider.js';
import Run from './run.js';

let mod = angular.module('ionic-native-transitions', [
'ionic',
// 'ui-router'
]);

mod.provider('$ionicNativeTransitions', Provider);
mod.run(Run);

export default mod = mod.name;
85 changes: 85 additions & 0 deletions lib/provider.js
@@ -0,0 +1,85 @@
/**
* @ngdoc service
* @name ionic-native-transitions.$ionicNativeTransitions
* @description
* ionic-native-transitions service
*/
/**
* @ngdoc service
* @name ionic-native-transitions.$ionicNativeTransitionsProvider
* @description
* ionic-native-transitions provider
*/
export default function($httpProvider) {
'ngInject';

let options = {
"direction": "up", // 'left|right|up|down', default 'left' (which is like 'next')
"duration": 500, // in milliseconds (ms), default 400
"slowdownfactor": 3, // overlap views (higher number is more) or no overlap (1), default 4
"iosdelay": 100, // ms to wait for the iOS webview to update before animation kicks in, default 60
"androiddelay": 150, // same as above but for Android, default 70
"winphonedelay": 250, // same as above but for Windows Phone, default 200,
"fixedPixelsTop": 0, // the number of pixels of your fixed header, default 0 (iOS and Android)
"fixedPixelsBottom": 60 // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
};

return {
$get,
setOptions
};

/**
* @ngdoc function
* @name ionic-native-transitions.$ionicNativeTransitionsProvider#setBasicCredentials
* @access public
* @methodOf ionic-native-transitions.$ionicNativeTransitionsProvider
*
* @description
* Overwrite default nativepagetransitions plugin options
* @param {object} injectedOptions options that will overwrite defaults
*/

/**
* @ngdoc function
* @name ionic-native-transitions.$ionicNativeTransitions#setBasicCredentials
* @access public
* @methodOf ionic-native-transitions.$ionicNativeTransitions
*
* @description
* Overwrite default nativepagetransitions plugin options
* @param {object} injectedOptions options that will overwrite defaults
*/
function setOptions(injectedOptions = {}) {
angular.merge(options, injectedOptions);
console.log(options);
return this;
}

function $get($log) {
'ngInject';

return {
init,
setOptions
};

/**
* @ngdoc function
* @name ionic-native-transitions.$ionicNativeTransitions#init
* @access public
* @methodOf ionic-native-transitions.$ionicNativeTransitions
*
* @description
* Init nativepagetransitions plugin
*/
function init() {

if (window.cordova && window.plugins && window.plugins.nativepagetransitions) {
angular.merge(window.plugins.nativepagetransitions.globalOptions, options);
} else {
$log.info('nativepagetransitions plugin does not exist, cannot initialize.');
}
}
}
};

0 comments on commit ef5d3b3

Please sign in to comment.