我想用javascript动态地更改jquery-mobile按钮颜色样本,但是我找不到一种方法(除了删除和添加所有类和事件处理程序,但这很麻烦).
什么是最好的方法呢?
我已经设置了一个Canvas页面,点击表单提交按钮即可获得FB.login.在以下请求期间,它尝试通过$ facebook-> api('/ me')(来自Github的最后一个API版本)访问用户数据.它适用于Firefox和Chrome,但不适用于Safari和IE,其中API因"需要身份验证令牌"而失败.有没有人已经有这个问题或者想知道是什么原因造成的?
BR Philipp
编辑:
我在表单提交按钮的click事件中调用FB.login:
$('.form-submit', this).click(function() {
FB.getLoginStatus(function(response) {
if (response.session) {
form.submit();
} else {
FB.login(function(response) {
if(response.session && (permissions == '' || response.perms)) {
form.submit();
}
else {
}
},{perms:permissions});
}
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
在服务器端,只需构造php-api对象并尝试获取用户数据:
$facebook = new Facebook(array(
'appId' => $appid,
'secret' => $appsecret,
'cookie' => TRUE,
));
if ($facebook) {
try {
$me = $api->api('/me');
}
catch (Exception $exc) {
// Failure in Safari and IE due to invalid auth token …Run Code Online (Sandbox Code Playgroud) 我正在尝试了解 python 反应式扩展的调度。我想用来subscribe_on并行处理多个可观察量。如果可观察量是使用 创建的,则效果很好,但如果使用just例如range或 ,则效果不佳。from_
just默认为Scheduler.immediate,而其他生成器默认为Scheduler.current_thread。这导致了差异,但对我来说感觉不一致。可能是因为我没有掌握完整的问题。
考虑以下示例:
import rx
from rx.concurrency.scheduler import Scheduler
import time
import threading
def work(x):
print "processing %s on thread %s" % (x, threading.currentThread().name)
time.sleep(1)
def finish(x):
print "finished %s on thread %s" % (x, threading.currentThread().name)
# Creates new thread (I like)
rx.Observable.just(3)\
.do_action(work)\
.subscribe_on(Scheduler.new_thread)\
.subscribe(finish)
# Runs on MainThread (I don't like)
rx.Observable.range(1, 3) \
.do_action(work) \
.subscribe_on(Scheduler.new_thread) \
.subscribe(finish)
Run Code Online (Sandbox Code Playgroud)
它可以与调度程序一起使用observe_on,或者如果调度程序直接传递给生成器,但我想将可观察的创建与处理分离并实现如下所示: …