小编eng*_*nws的帖子

如何使用PhoneGap/Cordova在本地缓存图像文件?

这是我的问题:

我使用AngularJS和Cordova制作了一个Web/Mobile应用程序.出于离线目的,我使用localStorage存储应用程序的所有数据(JSON,参数等).

问题是:我需要在本地存储/缓存图像(再次,离线目的).由于localStorage大小限制大约是5mo,我不能使用它,我需要更多.

我以为我可以使用缓存清单,但它不起作用,因为我需要定期更新它,而无需重新编译应用程序(我以为我可以将缓存清单放在外部服务器上,但它就像我不能使用来自另一个域的缓存清单).

所以我正在考虑使用Cordova/Phonegap File API,但我不知道如何实现 ......

任何帮助或想法?

javascript caching cordova

17
推荐指数
1
解决办法
2万
查看次数

在Sass/Compass中自动变暗颜色

我正在为一个网站设置一个CSS,其中所有:hover状态的链接都比正常状态更暗.

我正在使用Sass/Compass所以我darken在这里查看了Sass方法:http://sass-lang.com/documentation/Sass/Script/Functions.html#darken-instance_method

这是用途: darken($color, $amount)

我的问题是:如何让这个"自动"将我的所有<a>元素设置为80%更暗?

我正在尝试做的是(Sass语法):

a
   background: $blue
   &:hover
      background: darken(this element background-color, 80%)
Run Code Online (Sandbox Code Playgroud)

这样做的最佳解决方案是什么?

css sass compass-sass

15
推荐指数
2
解决办法
2万
查看次数

括号:如何制作自动完成/自动作品?

括号似乎很好,但我遇到两个使用它的问题:

首先,我通常以这种方式自动完成标签:div.class - PRESS TAB -成为<div class="class"></div>

我无法实现这一点......我尝试下载一堆插件,没有任何作用......

第二个问题:

#container
    h3
        color: $ltGreen
        text-transform: uppercase
        font-size: em(24)
        margin-bottom: 0.5em
        font-weight: bold
Run Code Online (Sandbox Code Playgroud)

在这个例子中,如果我在那部分代码中的任何地方按下Enter/Return键,光标会回到行的开头 ...所以每次按下回车键都要按Tab键很多时间...

是否有可能在括号中做到这一点?怎么样 ?

adobe-brackets

12
推荐指数
1
解决办法
6万
查看次数

Angular Route重定向到404

这是我的问题:出于某种原因,在有效链接上,Angular无法找到我正在寻找的内容并返回404.这是路由配置:

  $routeProvider.when('/', {templateUrl: 'partials/home.html'});
  $routeProvider.when('/home', {templateUrl: 'partials/home.html'});
  $routeProvider.when('/menus', {templateUrl: 'partials/menus.html'});
  $routeProvider.when('/menu/:menuId', {templateUrl: 'partials/menu.html', controller: 'ShowMenuCtrl'});
  $routeProvider.when('/products', {templateUrl: 'partials/products.html'});
  $routeProvider.when('/product/:productId', {templateUrl: 'partials/product.html', controller: 'ShowProductCtrl'});
  $routeProvider.when('/drink/:productId', {templateUrl: 'partials/product.html', controller: 'ShowProductCtrl'});
  $routeProvider.when('/drinks', {templateUrl: 'partials/drinks.html'});
  $routeProvider.when('/order', {templateUrl: 'partials/order.html'});
  $routeProvider.when('/404', {templateUrl: 'partials/404.html'});
  $routeProvider.otherwise({redirectTo: '/404'});
Run Code Online (Sandbox Code Playgroud)

例如:<a href="#/menu/{[{menu.id}]}" translate >SEE</a>指向/ menu/45122245 的链接(例如)将在我打开/ menus/view时工作,但不在/ home /上工作(并返回404).

使用相同的URL,相同的ID具有相同的对象,所以我不知道发生了什么.我不知道是否有其他代码可以帮助你,让我知道你需要什么:)

javascript angularjs

7
推荐指数
1
解决办法
7377
查看次数

FBSDK:无法读取未定义的属性loginwithreadpermissions

我正在使用FBSDK设置React Native项目以进行登录.

这是我到目前为止所做的:

  1. 我跑了 npm install react-native-fbsdk --save
  2. 我跑了 react-native link
  3. 我按照那里提到的每一步:https://developers.facebook.com/docs/facebook-login/ios/
  4. 我使用此视频仔细检查了一下:https://www.youtube.com/watch?v = rAXVKapP5cM

但是,我仍然收到此红屏错误:

Cannot read property logInWithReadPermissions of undefined在FBLoginManager.js,第77行(https://github.com/facebook/react-native-fbsdk/blob/master/js/FBLoginManager.js)

这是我的AppDelegate.m内容:

#import "AppDelegate.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"PegaseBuzzApp"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  [[FBSDKApplicationDelegate sharedInstance] application:application
                           didFinishLaunchingWithOptions:launchOptions];


  self.window = [[UIWindow …
Run Code Online (Sandbox Code Playgroud)

javascript ios react-native fbsdk

7
推荐指数
1
解决办法
4967
查看次数

iOs:通过访问具有原点的帧来阻止原始"https://www.youtube.com"的框架

我知道这个问题已被提出并被回答了一百万次.但.现在,我正在测试一个网站上有一些Youtube iframe嵌入iOs.看起来像 :

<iframe width="100%" height="200" src="//www.youtube.com/embed/my-video-id" class="yt-player-listed " frameborder="0" allowfullscreen></iframe>
Run Code Online (Sandbox Code Playgroud)

所以,只是Youtube提供的基本代码.它适用于大多数设备.但在iOs Safari上:

Blocked a frame with origin "https://www.youtube.com" from accessing a frame with origin ... from html5player.js:816
Run Code Online (Sandbox Code Playgroud)

我没有看到任何协议不匹配,只要我正在使用//(我也试过http:和https :):iframe只是没有出现.

我试过了 :

  1. 改变了协议(http,https,//)
  2. 删除了iframe中的所有属性(allowfullscreen,frameborder)

我不知道那里发生了什么......

youtube iframe html5 ios

6
推荐指数
1
解决办法
1843
查看次数

JSartoolkit:用于Android后置摄像头的camera_para.dat

我(再次)使用JSartoolkit 5(https://github.com/artoolkit/jsartoolkit5)时遇到了麻烦.

我正在尝试使用我的设备的后置摄像头(Android - Nexus 5x,如果这很重要).我已经看到这个框架使用.dat文件来导入凸轮设置.

所以,我使用.dat了repo中提供的文件(那里:https://github.com/artoolkit/jsartoolkit5/tree/master/examples/Data).

但这两个文件都使用我的Android设备上的用户(面向)凸轮.

有人有一个我可以用来在Android上传输后置摄像头的文件吗?或者知道如何设置它?

编辑:

我使用了这个应用程序https://play.google.com/store/apps/details?id=com.artoolworks.ar.utils.calib_camera,如artoolkit文档中所述.但是,当我完成校准过程时,它会说它上传数据:我不知道在哪里,以及我如何使用它.有人能告诉我如何从这个应用程序导出.dat文件?

javascript android artoolkit jsartoolkit

6
推荐指数
1
解决办法
644
查看次数

带 WordPress 的 Webpack 开发服务器

我正在使用 Webpack 进行 WP 主题开发,并且我真的很想使用 HMR。因此,根据我常用的 webpack conf(使用 BrowserSync 插件执行实时重新加载),我想修改它以便正确使用webpack-dev-serverhot选项。

这是我到目前为止所做的:

const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PostCSSCSSNext = require('postcss-cssnext')();
const WPThemeConfig = require('./wp.config');
// const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const extractSass = new ExtractTextPlugin(`css/${WPThemeConfig.cssFileName}.min.css`);


module.exports = merge(common, {
  mode: 'development',
  plugins: [
    extractSass,    
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
    }),
    // new BrowserSyncPlugin({
    //   host: 'localhost',
    //   port: 3000,
    //   proxy: 'http://localhost:8888/'
    // })
  ], …
Run Code Online (Sandbox Code Playgroud)

wordpress webpack webpack-dev-server

6
推荐指数
0
解决办法
1217
查看次数

Angular HTTP Get循环

我有一个Angular应用程序的问题.

我有一个包含langs短代码的数组('en','fr',...).基本上,我希望Angular在该数组上循环,并对每个值进行HTTP get请求.

for (var i in $scope.langs) {
      console.log($scope.langs[i].shortName);
      $http.get($scope.appURL + $scope.langs[i].shortName + '/api/products/?format=json&resto='+ $scope.restoID)
         .then(function(res){
            $scope.products = angular.fromJson(res.data);   
            window.localStorage.setItem("products-"+$scope.langs[i].shortName, JSON.stringify(res.data));
            $scope.products =  JSON.parse(window.localStorage.getItem("products-"+$scope.langs[i].shortName));
            console.log('LANG = '+ $scope.langs[i].shortName, $scope.products);
          });
}
Run Code Online (Sandbox Code Playgroud)

第一个日志显示:

fr
en
Run Code Online (Sandbox Code Playgroud)

好极了!最后一个日志被抛出两次(我的数组中有2个langs),也很棒.

问题是在循环中,日志在两种情况下显示相同的语言,当我应该有一个fr/api/...和一个en/api/...它总是记录2 en/api/...

我不知道它是否清楚......有什么想法吗?

javascript angularjs

5
推荐指数
1
解决办法
7531
查看次数

React Native:多个Navigator navigationBar

我坚持使用React Native.

我有一个"Header"导航栏,但我想在导航器组件中添加另一个navigationBar.

render() {
    let currentRoute = this.props.route
    return (
        <Navigator
            style={styles.container}
            initialRoute={this.props.route}
            renderScene={this.router.bind(this)}
            navigationBar={<Header />} // << There, how can I simply add another navigationBar ?
         />
    );
}
Run Code Online (Sandbox Code Playgroud)

这是<Header/>组件:

render() {
    return <Navigator.NavigationBar
        style={styles.navBarContainer}
        navState={this.props.navState}
        routeMapper={routeMapper}
    />
  }
Run Code Online (Sandbox Code Playgroud)

现在,我正在尝试添加一个<Footer/>组件,它会渲染一个类似的组件<Header/>,以便在我的应用程序上有2个持久性导航栏.

怎么做到这一点?

react-native

5
推荐指数
1
解决办法
1657
查看次数