-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Img cache module and dependencies #3
- Loading branch information
Showing
10 changed files
with
175 additions
and
106 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
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,11 @@ | ||
module.exports = angular.module 'wordpress-hybrid-client.cacheImg' | ||
.directive 'wphcImgCache', -> | ||
restrict: 'A' | ||
link: (scope, el, attrs) -> | ||
attrs.$observe 'ngSrc', (src) -> | ||
ImgCache.isCached src, (path, success) -> | ||
if success | ||
ImgCache.useCachedFile el | ||
else | ||
ImgCache.cacheFile src, -> | ||
ImgCache.useCachedFile el |
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,7 @@ | ||
require 'imgcache.js' | ||
|
||
module.exports = angular.module 'wordpress-hybrid-client.cacheImg', [] | ||
|
||
require "./cacheImg.directive.coffee" | ||
require "./cacheImg.service.coffee" | ||
require "./cacheImg.run.coffee" |
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,16 @@ | ||
module.exports = angular.module 'wordpress-hybrid-client.cacheImg' | ||
.run ($ionicPlatform, $log, $WPHCConfig) -> | ||
ImgCache.options.debug = $WPHCConfig.debugEnabled | ||
ImgCache.options.chromeQuota = $WPHCConfig.cache.img.chromeQuota; | ||
ImgCache.options.localCacheFolder = $WPHCConfig.cache.img.localCacheFolder; | ||
ImgCache.options.useDataURI = $WPHCConfig.cache.img.useDataURI; | ||
ImgCache.options.usePersistentCache = $WPHCConfig.cache.img.usePersistentCache; | ||
ImgCache.options.cacheClearSize = $WPHCConfig.cache.img.cacheClearSize; | ||
ImgCache.options.headers = $WPHCConfig.cache.img.headers; | ||
ImgCache.options.skipURIencoding = $WPHCConfig.cache.img.skipURIencoding; | ||
|
||
$ionicPlatform.ready -> | ||
ImgCache.init -> | ||
$log.debug 'ImgCache init: success!' | ||
, -> | ||
$log.error 'ImgCache init: error! Check the log for errors' |
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,18 @@ | ||
module.exports = angular.module 'wordpress-hybrid-client.cacheImg' | ||
.service 'CacheImages', ($q) -> | ||
checkCacheStatus: (src) -> | ||
deferred = $q.defer() | ||
ImgCache.isCached src, (path, success) -> | ||
if success | ||
deferred.resolve path | ||
else | ||
ImgCache.cacheFile src, -> | ||
ImgCache.isCached src, (path, success) -> | ||
deferred.resolve path | ||
return | ||
, deferred.reject | ||
return | ||
, deferred.reject | ||
return | ||
, deferred.reject | ||
deferred.promise |
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
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,106 +1,110 @@ | ||
{ | ||
"name": "wordpress-hybrid-client", | ||
"version": "1.0.0", | ||
"title": "wordpress-hybrid-client", | ||
"description": "AngularJS client using Ionic Framework and based on the json-rest-api plugin: https://wordpress.org/plugins/json-rest-api/ with CORS enabled.", | ||
"main": "index.js", | ||
"scripts": { | ||
"install": "bower install", | ||
"update": "bower update", | ||
"build": "sh ./release.sh", | ||
"devserver": "webpack-dev-server --port 9100 --progress", | ||
"dumpdev": "gulp build", | ||
"dumpprod": "gulp build:prod" | ||
}, | ||
"keywords": [ | ||
"wp-api", | ||
"angular", | ||
"angularjs", | ||
"rest", | ||
"restfull", | ||
"hybrid", | ||
"material design", | ||
"client" | ||
], | ||
"author": "Julien Renaux <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/shprink/wordpress-hybrid-client" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/shprink/wordpress-hybrid-client/issues" | ||
}, | ||
"homepage": "https://github.com/shprink/wordpress-hybrid-client", | ||
"devDependencies": { | ||
"autoprefixer-loader": "^1.1.0", | ||
"clone": "^0.2.0", | ||
"coffee-loader": "^0.7.2", | ||
"coffee-script": "^1.8.0", | ||
"css-loader": "^0.9.1", | ||
"exports-loader": "^0.6.2", | ||
"expose-loader": "^0.6.0", | ||
"file-loader": "^0.8.1", | ||
"gulp": "^3.8.10", | ||
"gulp-bump": "^0.3.0", | ||
"gulp-cordova-bump": "^1.2.2", | ||
"gulp-filter": "^2.0.2", | ||
"gulp-git": "^1.2.3", | ||
"gulp-header": "^1.2.2", | ||
"gulp-minify-css": "^0.4.4", | ||
"gulp-rimraf": "^0.1.1", | ||
"gulp-tag-version": "^1.2.1", | ||
"gulp-util": "^3.0.1", | ||
"gulp-webpack": "^1.1.2", | ||
"gulp-xml-editor": "^2.2.1", | ||
"html-loader": "^0.2.3", | ||
"html-webpack-plugin": "^1.1.0", | ||
"json-loader": "^0.5.1", | ||
"markdown-loader": "^0.1.2", | ||
"ng-annotate": "^0.15.2", | ||
"ng-annotate-webpack-plugin": "^0.1.2", | ||
"path": "^0.4.9", | ||
"sass-loader": "^0.3.1", | ||
"semver": "^4.3.4", | ||
"style-loader": "^0.8.3", | ||
"util": "^0.10.3", | ||
"webpack": "^1.4.13", | ||
"xml2js": "^0.4.8" | ||
}, | ||
"dependencies": { | ||
"MD5": "^1.2.1", | ||
"angular": "^1.3.0", | ||
"angular-animate": "^1.3.0", | ||
"angular-aria": "^1.3.0", | ||
"angular-cache": "^4.0.0", | ||
"angular-filter": "^0.5.4", | ||
"angular-memory-stats": "^1.0.0-rc4", | ||
"angular-moment": "^0.9.0", | ||
"angular-sanitize": "^1.3.0", | ||
"angular-translate": "^2.5.2", | ||
"angular-ui-router": "^0.2.13", | ||
"imagesloaded": "^3.1.8", | ||
"moment": "^2.9.0", | ||
"ng-cordova": "^0.1.12-alpha", | ||
"wp-api-angularjs": "^1.0.0-beta1" | ||
}, | ||
"cordovaPlugins": [ | ||
"https://github.com/danwilson/google-analytics-plugin.git", | ||
"com.google.playservices", | ||
"./engine/cordova-crosswalk-engine-c0.6.1", | ||
"org.apache.cordova.network-information", | ||
"org.apache.cordova.splashscreen", | ||
"com.ionic.keyboard", | ||
"https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git", | ||
"https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git", | ||
"https://github.com/apache/cordova-plugin-statusbar.git", | ||
"org.apache.cordova.globalization", | ||
"org.apache.cordova.inappbrowser" | ||
], | ||
"cordovaPlatforms": [ | ||
{ | ||
"platform": "android", | ||
"locator": "./engine/cordova-android-c0.6.1/" | ||
} | ||
] | ||
"name": "wordpress-hybrid-client", | ||
"version": "1.0.0", | ||
"title": "wordpress-hybrid-client", | ||
"description": "AngularJS client using Ionic Framework and based on the json-rest-api plugin: https://wordpress.org/plugins/json-rest-api/ with CORS enabled.", | ||
"main": "index.js", | ||
"scripts": { | ||
"install": "bower install", | ||
"update": "bower update", | ||
"build": "sh ./release.sh", | ||
"devserver": "webpack-dev-server --port 9100 --progress", | ||
"dumpdev": "gulp build", | ||
"dumpprod": "gulp build:prod" | ||
}, | ||
"keywords": [ | ||
"wp-api", | ||
"angular", | ||
"angularjs", | ||
"rest", | ||
"restfull", | ||
"hybrid", | ||
"material design", | ||
"client" | ||
], | ||
"author": "Julien Renaux <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/shprink/wordpress-hybrid-client" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/shprink/wordpress-hybrid-client/issues" | ||
}, | ||
"homepage": "https://github.com/shprink/wordpress-hybrid-client", | ||
"devDependencies": { | ||
"autoprefixer-loader": "^1.1.0", | ||
"clone": "^0.2.0", | ||
"coffee-loader": "^0.7.2", | ||
"coffee-script": "^1.8.0", | ||
"css-loader": "^0.9.1", | ||
"exports-loader": "^0.6.2", | ||
"expose-loader": "^0.6.0", | ||
"file-loader": "^0.8.1", | ||
"gulp": "^3.8.10", | ||
"gulp-bump": "^0.3.0", | ||
"gulp-cordova-bump": "^1.2.2", | ||
"gulp-filter": "^2.0.2", | ||
"gulp-git": "^1.2.3", | ||
"gulp-header": "^1.2.2", | ||
"gulp-minify-css": "^0.4.4", | ||
"gulp-rimraf": "^0.1.1", | ||
"gulp-tag-version": "^1.2.1", | ||
"gulp-util": "^3.0.1", | ||
"gulp-webpack": "^1.1.2", | ||
"gulp-xml-editor": "^2.2.1", | ||
"html-loader": "^0.2.3", | ||
"html-webpack-plugin": "^1.1.0", | ||
"json-loader": "^0.5.1", | ||
"markdown-loader": "^0.1.2", | ||
"ng-annotate": "^0.15.2", | ||
"ng-annotate-webpack-plugin": "^0.1.2", | ||
"path": "^0.4.9", | ||
"sass-loader": "^0.3.1", | ||
"semver": "^4.3.4", | ||
"style-loader": "^0.8.3", | ||
"util": "^0.10.3", | ||
"webpack": "^1.4.13", | ||
"xml2js": "^0.4.8" | ||
}, | ||
"dependencies": { | ||
"MD5": "^1.2.1", | ||
"angular": "^1.3.0", | ||
"angular-animate": "^1.3.0", | ||
"angular-aria": "^1.3.0", | ||
"angular-cache": "^4.0.0", | ||
"angular-filter": "^0.5.4", | ||
"angular-memory-stats": "^1.0.0-rc4", | ||
"angular-moment": "^0.9.0", | ||
"angular-sanitize": "^1.3.0", | ||
"angular-translate": "^2.5.2", | ||
"angular-ui-router": "^0.2.13", | ||
"imagesloaded": "^3.1.8", | ||
"imgcache.js": "^1.0.0", | ||
"moment": "^2.9.0", | ||
"ng-cordova": "^0.1.12-alpha", | ||
"wp-api-angularjs": "^1.0.0-beta1" | ||
}, | ||
"cordovaPlugins": [ | ||
"https://github.com/danwilson/google-analytics-plugin.git", | ||
"com.google.playservices", | ||
"./engine/cordova-crosswalk-engine-c0.6.1", | ||
"org.apache.cordova.network-information", | ||
"org.apache.cordova.splashscreen", | ||
"com.ionic.keyboard", | ||
"https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git", | ||
"https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git", | ||
"https://github.com/apache/cordova-plugin-statusbar.git", | ||
"org.apache.cordova.globalization", | ||
"org.apache.cordova.inappbrowser", | ||
"org.apache.cordova.file-transfer", | ||
"org.apache.cordova.file", | ||
"org.apache.cordova.device" | ||
], | ||
"cordovaPlatforms": [ | ||
{ | ||
"platform": "android", | ||
"locator": "./engine/cordova-android-c0.6.1/" | ||
} | ||
] | ||
} |
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