i have a question about this topic. navigator.geolocation.getCurrentPosition does not seems to work for me on Android 4.2.2 on many browsers and 4 devices. It ask about my location, I can accept or decline but whatever I pick it does not fire success or errorr function.
My sample code:
function GoogleMap(){
this.initialize = function(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(geolocationSuccess,geolocationError);
} else {
geolocationError();
}
}
}
function geolocationSuccess(position){
alert(position);
}
function geolocationError(){
alert('Geolocation disabled');
}
Can You help me with that?
Related
I'm using the Soundcloud Javascript SDK (http://developers.soundcloud.com/docs/api/sdks#javascript) on a project and have happily got my player loading a sound and playing it like so:
SC.get("/resolve/",{
url: href
},function(response){
SC.stream("/tracks/"+response.id,{},function(sound){
sound.play();
});
})
I can trigger the soundmanager object to play in the callback using sound.play() but I can't work out how to access the events of the object mantioned in the docs (http://www.schillmania.com/projects/soundmanager2/doc/) like whileplaying()
How do I add these in? I've tried this kind of thing:
sound.whileplaying(function(){
alert("hooray!")
})
But that doesn't work.
Many thanks
Julian
This should work:
SC.stream("/tracks/" + response.id, {
whileplaying: function () {
console.log("track is playing");
}
}, function (sound) {
sound.play();
});
The correct way is:
SC.stream('/tracks/' + response.id).then(function (player) {
player.on('finish', function () {
console.log('finish');
});
player.play();
});
You found this answer and consult all events here:
https://developers.soundcloud.com/docs/api/sdks#player
i cant get the issue in my code , every thing working proper but issue is that when user click or focus first time on textbox correct img show .. this is incorrect but i cant solved this problem when user typing then after completing wher user correct type then show otherwise not shown . can any one help me regarding this issue . my complete jquery and html or css code are available in this link pls check and solved my issue
my code link
i think error on this function but icant get the issue
$('#step1 #fName').focus(function(){
if($('#step1 #fName').hasClass('error_Aplha')==true)
{
$('#step1 #fntick').removeClass('block');
}
else {
$('#step1 #fntick').addClass('block');
}
}).blur(function(){
if($('#step1 #fName').hasClass('error_Aplha')==true)
{
$('#step1 .fname_error').fadeIn(100).delay(2000).fadeOut(1000);
$('#step1 #fntick').removeClass('block');
}
else {
$('#step1 .fname_error').removeClass('block');
$('#step1 #fntick').addClass('block');
}
});
thanks in advance
Wow, that's a lot of code for a simple task. Change it so the checks are only done in the .keyup() and .blur() events of the INPUT elements.
Not 100% sure what the intended behaviour is, but this will probably get you going:
$(document).ready(function(e) {
var errorAlpha = function() {
var reg = /^([A-Za-z]+)$/;
var check = $(this).val();
if (reg.test(check) == true && check.match(reg) != null) {
// VALID
$(this).removeClass('error_Aplha');
$(this).next('img').addClass('block');
$(this).prevAll('span.tooltip2').stop(true).delay(500).fadeOut(400);
} else {
// INVALID
$(this).addClass('error_Aplha');
$(this).next('img').removeClass('block');
$(this).prevAll('span.tooltip2').fadeIn(500).delay(2000).fadeOut(1000);
}
};
$('#step1 #fName, #step1 #lName').on('keyup blur', errorAlpha);
});
Demo: http://jsfiddle.net/gU3PU/6/
im developing a little firefox addon with the addon-sdk provided by mozilla. The addon should work on only one specific website and it needs to block a js-file from this website. I'm searching for hours on how to block such a request.
Hopefully someone knows the answer
Yeah, you'd have to do this mostly by hand. The SDK isn't going to help you much at all here but it is somewhat possible.
This is along the lines of what you'd need to do. Note that this isn't tested and won't work out of the box but just to give you an idea of what components are involved and where to find more resources.
const { Cc, Ci, Cm, components } = require("chrome");
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
const CategoryManager = Cc["#mozilla.org/categorymanager;1"]
.getService(Ci.nsICategoryManager);
function PolicyComponent() { }
PolicyComponent.prototype = {
desc: "My nsIContentPolicy XPCOM Component",
classID: components.ID("{3ffd2f60-3784-11e1-b86c-0800200c9a66}"),
contractID: "#abc.def.com/policycomp;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy]),
shouldLoad: function(contentType, contentLocation, requestOrigin, aContext, mimeTypeGuess, extra) {
if (contentLocation.spec != BLOCKED_JS) { return return Ci.nsIContentPolicy.ACCEPT; }
else { return Ci.nsIContentPolicy.REJECT_REQUEST; }
},
shouldProcess: function() {
return CI.nsIContentPolicy.ACCEPT;
}
}
var pc = new PolicyComponent()
// Register the Interface
Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(pc.uuid, pc.desc, pc.contractID, pc);
// Add the content policy
CategoryManager.addCategoryEntry("content-policy",pc.className,pc.contractID, true, true); // not sure you should replace (last true statement)
See this post for more:
What is missing in my nsIContentPolicy Firefox/IceWeasel extension XPCOMponent implementation for the shouldLoad to be called?
Also take a look at these docs: https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads#Content_Policy
I want to import and export CSV's. I have figured out how to get the iPad to recognize my app as one that opens CSV files.
From there though I am lost. I have found explanations on how the iPad sends in my file via application:didFinishLaunchingWithOptions or handleOpenURL ...
I've figured out that adding a function called handleOpenURL(url) in my js file passes me the url for the file... so now I have this.
That is great because I now know that someone has opened my app this way. Cool... BUT how do I grab the contents of that URL?
GOT IT! Woot, this is what i did...
function handleOpenURL(url)
{
window.resolveLocalFileSystemURI(url, onResolveSuccess, fail)
}
function onResolveSuccess(fileEntry)
{
fileEntry.file(win, fail);
}
function win(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
alert("succes");
alert(evt.target.result);
}
reader.readAsText(file);
}
function fail() {
alert('fail');
}
on (press)
{
here I want to call a javascript function
}
on (rollOver)
{
gotoAndPlay("guizhou");
}
on (rollOver)
{
startDrag ("1guizhou", true);
}
on (rollOut)
{
gotoAndPlay("kongk");
}
How to call a javascript function in the press event ? in as3.0 there is mouseevent but in as1.0 ,I don't konw how do that? Can you help me?
You can use getURL:
getURL("javascript:functionName()");
additional about this function can be found at:
http://help.adobe.com/en_US/as2/reference/flashlite/WS5b3ccc516d4fbf351e63e3d118ccf9c47f-7fc9.html