日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ajax获取简单天气信息,jQuery 简单的天气查询服务

發布時間:2023/12/20 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ajax获取简单天气信息,jQuery 简单的天气查询服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

JavaScript

語言:

JaveScriptBabelCoffeeScript

確定

/

// NOTIFICATION SETTINGS, DONT TOUCH BELLOW //

///

function notificate(titlenotification,body,icon) {

// Let's check if the browser supports notifications

if (!("Notification" in window)) {

alert("This browser does not support desktop notification");

}

// Let's check if the user is okay to get some notification

else if (Notification.permission === "granted") {

var title;

var content;

title=titlenotification;

content={

body:body,

icon:icon,

};

// If it's okay let's create a notification

var notification = new Notification(title,content);

}

// Otherwise, we need to ask the user for permission

// Note, Chrome does not implement the permission static property

// So we have to check for NOT 'denied' instead of 'default'

else if (Notification.permission !== 'denied') {

Notification.requestPermission(function (permission) {

// Whatever the user answers, we make sure we store the information

if(!('permission' in Notification)) {

Notification.permission = permission;

}

// If the user is okay, let's create a notification

if (permission === "granted") {

var notification = new Notification(title,content);

}

});

}

/

// NOTIFICATION SETTINGS, DONT TOUCH BELLOW //

///

// At last, if the user already denied any notification, and you

// want to be respectful there is no need to bother him any more.

}

notificate("Bem vindo","Estas s?o as primeiras configura??es do voice","");

// Docs at http://simpleweatherjs.com

/* Does your browser support geolocation? */

if ("geolocation" in navigator) {

$('.js-geolocation').show();

} else {

$('.js-geolocation').hide();

}

/* Where in the world are you? */

$(document).on('ready', function() {

navigator.geolocation.getCurrentPosition(function(position) {

loadWeather(position.coords.latitude+','+position.coords.longitude); //load weather using your lat/lng coordinates

});

});

/*

* Test Locations

* Austin lat/long: 30.2676,-97.74298

* Austin WOEID: 2357536

*/

function loadWeather(location, woeid) {

$.simpleWeather({

location: location,

woeid: woeid,

unit: 'c',

success: function(weather) {

html = '

'+weather.temp+'°'+weather.units.temp+'

';

html += '

  • '+weather.city+', '+weather.region+'';

html += '

'+weather.currently+'';

html += '

'+weather.temp+'°C';

$("#weather").html(html);

},

error: function(error) {

$("#weather").html('

'+error+'

');

}

});

}

function speak(mensagem){

var msg = new SpeechSynthesisUtterance(mensagem);

window.speechSynthesis.speak(msg);

}

//Javascript

if (annyang) {

// Let's define a command.

var commands = {

'hello': function() { speak("Hello, what's your name?"); notificate("Bem vindo ao voice","test","")},

//fala do nome

'meu nome é :nome': function(e) { speak("Your name is"+e+""+"Ok"+e+"I go configurate yours preferences ok?"); notificate("Olá "+ e + " bem vindo","Vamos ver oque você gosta para exibir nos cards" ) },

'sistema idiota': function() { speak("Idiot is you .You speak with a computer. "); notificate("Idiota é você.","Quem é que fica falando com um computador hein?","") },

você n?o presta

'você n?o presta': function() { speak("You dont presta.You speak with a computer. "); notificate("Quem n?o presta é você","Folgado e vagabundo que tem pregui?a de fazer tudo seu vagabundo.","") },

///fun??o do asno ashuaashuaashuaashuaashua

'você é mais burro do que eu': function() { speak("Asno are you.Pelow menows i can speak english "); notificate("Cláro, né o que fala com o computador","Pra CER mais burro do que você é difícil, más agente faz o possível.","") },

'abrir google': function() { speak("Open you.You are very very folgueidw "); notificate("Para de falar comigo e faz alguma coisa","Agora o burro n?o sabe nem ao menos usar o mouse?","") },

//sim confirma o nome

'olá': function() { speak("Hello, what you want?") },

'quem foi :pessoa': function(pessoa) { },

'que horas s?o ': function() { speak("Agora s?o " + data.getHours() +"horas e " + data.getMinutes()+ "minutos" ) },

'qual é a temperatura em :nomedacidade': function(nomedacidade) {

$.simpleWeather({

location: nomedacidade,

woeid: '',

unit: 'c',

success: function(weather) {

speak("In "+ nomedacidade + "the weather in "+ weather.city + weather.region + "is"+ weather.temp + "degree celsius and currently is " + weather.currently);notificate("Temperatura","Agora em " + nomedacidade + weather.region + " está " + weather.temp + "°C","");

},

error: function(error) {

speak("Have a error.Try again later.");

}

});

},

};

// Add our commands to annyang

annyang.addCommands(commands);

// Start listening.

annyang.setLanguage("pt-BR");

annyang.start({ autoRestart: true });

}

//

// Docs at http://simpleweatherjs.com

/* Does your browser support geolocation? */

// //

// PAGE SETTINGS BELLOW //

// //

$(document).ready( function() {

$('.note').click( function() {

var el = $(this);

if( el.parent().hasClass('double') ) {

el = $(this).parent();

}

el.addClass('tr');

setTimeout( function() {

el.slideUp('100');

}, 400);

setTimeout( function() {

el.remove();

}, 500);

var test = $('#notes').children().size();

if(test == 2) {

setTimeout( function() {

$('#no-cards').css("display","block").slideDown();

}, 650);

}

});

});

總結

以上是生活随笔為你收集整理的ajax获取简单天气信息,jQuery 简单的天气查询服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日韩和一区二区 | 国产又爽又黄的视频 | 日本在线成人 | 欧美三级午夜理伦 | 动漫精品一区一码二码三码四码 | 性生活视频在线播放 | 亚洲天堂男人天堂 | 99热伊人 | 久久久www成人免费无遮挡大片 | 日韩欧美亚洲视频 | 老师张开让我了一夜av | 欧美人妖老妇 | 色乱码一区二区三区熟女 | 国际av在线 | 午夜精品久久久久久久99老熟妇 | 黑人导航| 无码人妻精品一区二区50 | 欧亚一区二区 | 国产又爽又色 | 亚洲大胆 | 91影院在线观看 | 国产片久久 | 亚洲国产大片 | 色久婷婷| 九色.com | av尤物在线 | 日本xxxxxxxxx69 | 小视频在线播放 | av资源免费 | 日本黄色电影网址 | 18男女无套免费视频 | 欧美 日韩 国产 在线观看 | 国产精品免费网站 | 日日操天天 | 亚洲国产精品成人综合色在线婷婷 | 影音先锋婷婷 | 伊人导航| 日本伊人色 | 黄色美女一级片 | 懂色av一区二区三区四区五区 | 久久久久美女 | 久av在线| 国产福利午夜 | 午夜精品久久久 | 国产精品搬运 | 久久精品成人av | 国产九色 | 超碰五月天 | 91成人在线观看高潮 | 艳妇乳肉亭妇荡乳av | 女生被草| 无码少妇精品一区二区免费动态 | 韩国伦理在线视频 | 香蕉视频污在线观看 | 国产区精品视频 | 成人动漫久久 | 俺也去网站 | av卡一卡二 | 午夜三级av| 日韩一区二区三区视频在线 | 成人国产精品 | 欧色丰满女同hd | 亚洲美女视频在线 | 日日嗨av一区二区三区四区 | 最新中文av | av2014天堂| 亚洲一区二区影视 | 超碰8| 色婷婷av一区二区三区软件 | 亚洲色图 欧美 | 日韩免费网站 | 色婷婷在线影院 | 欧美日韩国产精品成人 | 妺妺窝人体色777777 | 毛片黄色片 | 成人精品免费视频 | 成人在线观看你懂的 | 亚洲黄片一区二区三区 | 一级色视频 | 国产精品zjzjzj在线观看 | 泷泽萝拉在线播放 | 亚洲第6页 | 国产一区二区三区在线 | 一区二区三区手机在线观看 | 黄页网站在线播放 | 影音先锋丝袜制服 | 久久网av| 青青在线 | 黄色片a级| 大肉大捧一进一出视频 | 欧美亚洲色综久久精品国产 | 中文字字幕一区二区三区四区五区 | 久久久久久黄色 | 毛片aaa| 日日干夜夜拍 | 臭脚猛1s民工调教奴粗口视频 | 一区二区三区视频 | 亚洲一区二区视频在线播放 | 麻豆精品视频 |