javascript: void
function() {
var lJ_Phone = ["#J_Phone"],
lJ_GetSmsCode = ["#J_GetSmsCode"],
lJ_mobileIsReadPrivacy = ["q[class='checkbox']"];
for (i = 0; i < lJ_Phone.length; i++) {
var J_Phone = document.querySelector(lJ_Phone[i]);
if (J_Phone != null) {
J_Phone.value = '13912345678';
break
}
}
for (j = 0; j < lJ_mobileIsReadPrivacy.length; j++) {
var J_mobileIsReadPrivacy = document.querySelector(lJ_mobileIsReadPrivacy[j]);
if (J_mobileIsReadPrivacy.checked != true) {
J_mobileIsReadPrivacy.checked = true;
break
}
}
for (j = 0; j < lJ_GetSmsCode.length; j++) {
var J_GetSmsCode = document.querySelector(lJ_GetSmsCode[j]);
J_GetSmsCode.click()
}
return !1
}()
Tag: Javascript
一键生成二维码 – 弹窗
javascript: void
function() {
var old_url = window.location.href;
var new_url = old_url.split("?")[0];
var qr_api = 'https://ause.azurewebsites.net/?url=';
var f = qr_api + encodeURIComponent(new_url);
window.open(f,'QRcode','location=0,links=0,scrollbars=0,toolbar=0,width=640,height=640')
}()
一键生成二维码 – 过滤参数
javascript: void
function() {
var old_url = window.location.href;
var new_url = old_url.split("?")[0];
var qr_api = 'https://ause.azurewebsites.net/?url=';
window.location.href = qr_api + new_url;
}()
一键生成二维码
javascript: void
function() {
window.location.href = 'https://ause.azurewebsites.net/?url=' + window.location.href;
}()
JavaScript使用Fetch
进行 fetch 请求 Get
fetch('http://example.com/movies.json')
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(myJson);
});
进行 fetch 请求 Post
// Example POST method implementation:
postData('http://example.com/answer', {answer: 42})
.then(data => console.log(data)) // JSON from `response.json()` call
.catch(error => console.error(error))
function postData(url, data) {
// Default options are marked with *
return fetch(url, {
body: JSON.stringify(data), // must match 'Content-Type' header
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, same-origin, *omit
headers: {
'user-agent': 'Mozilla/4.0 MDN Example',
'content-type': 'application/json'
},
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, cors, *same-origin
redirect: 'follow', // manual, *follow, error
referrer: 'no-referrer', // *client, no-referrer
})
.then(response => response.json()) // parses response to JSON
}