api8.top ww.html,index.html

生活目标

.logo {

width: 60%;

/*height: 500px;*/

margin: auto;

padding-top:50px;

}

.name {

text-align: center;

font-size: 66px;

text-shadow: 3px 5px grey, 1px 1px #333;

}

.img {

width: 48%;

height: 53%;

margin: auto;

margin-top: 38px;

}

.img img {

width: 100%;

height: 100%;

}

.search {

width: 80%;

height: 100px;

margin: auto;

}

.noExtension {

width: 60%;

height: 100px;

margin: auto;

font-size: 23px;

}

#search_value {

width: 80%;

height: 50px;

box-shadow: 3px 5px grey, 1px 1px #333;

}

.search button {

width: 18%;

height: 50px;

margin-left: 6px;

box-shadow: 3px 5px grey, 1px 1px #333;

}

@keyframes rotate {

0% { transform:rotateY(0deg);}

25% { transform:rotateY(180deg);}

50% { transform:rotateY(0deg);}

75% { transform:rotateY(180deg);}

100% { transform:rotateY(0deg);}

}

.logo_rotate {

/*

animation: rotate 10s infinite;

animation-fill-mode: forwards;

animation-timing-function: linear;

*/

/* 当动画结束时,让

元素保留上一个关键帧的样式值 */

}

.result_success {

width: 60%;

margin: auto;

font-size: 22px

}

.result_faile{

width: 60%;

margin: auto;

font-size: 22px

}

.add_banner{

width: 80%;

margin: auto;

}

.add_banner input{

width: 80%;

height: 50px;

box-shadow: 3px 5px grey, 1px 1px #333;

}

.add_banner button{

width: 18%;

height: 50px;

margin-left: 6px;

box-shadow: 3px 5px grey, 1px 1px #333;

}

#search_banner{

font-size: 50px;

border-bottom: 1px solid black;

}

p{

text-indent:2em;

font-size: 30px;

}

.hide{

display: none;

}

.contenner{

background: url("img/bg.jpg");

height: 900px;

}

.author{

text-align: right;

}

.author p{

display: inline-block;

font-size: 18px;

}

.footer{

position: fixed;

bottom: 0;

text-align: center;

width:100%;

}

注意: 请安装 星云钱包拓展

NOTE: Please install WebExtensionWallet to use SUPER DICTIONARY

wait for content

作者:

dasdajkajksdhjasdkjahdkjad

没有找到   asd   生活目标. 添加

提交

"use strict";

// $("#search_value").attr("disabled",true)

// $("#search").attr("disabled",true)

// //to check if the extension is installed

// //if the extension is installed, var "webExtensionWallet" will be injected in to web page

// if(typeof(webExtensionWallet) === "undefined"){

// //alert ("Extension wallet is not installed, please install it first.")

// $("#noExtension").removeClass("hide")

// }else{

// $("#search_value").attr("disabled",false)

// $("#search").attr("disabled",false)

// }

var NebPay = require("nebpay"); //https://github.com/nebulasio/nebPay

var nebPay = new NebPay();

// $("#search_value").attr("disabled",true)

// $("#search").attr("disabled",true)

//to check if the extension is installed

//if the extension is installed, var "webExtensionWallet" will be injected in to web page

if(typeof(webExtensionWallet) === "undefined"){

//alert ("Extension wallet is not installed, please install it first.")

$("#noExtension").removeClass("hide")

}else{

$("#search_value").attr("disabled",true)

$("#search").attr("disabled",true)

}

var dappAddress = "n1qtNQkL1Z5ggxuMQe2zJNVw5z9YzuUN4dS";

var nebulas = require("nebulas"),

Account = nebulas.Account,

neb = new nebulas.Neb();

neb.setRequest(new nebulas.HttpRequest("https://testnet.nebulas.io"));

// 搜索功能: 查找Super-Dictionary 中有没有该词条

$("#search").click(function(){

// $("#search_value").val() 搜索框内的值

var from = Account.NewAccount().getAddressString();

var value = "0";

var nonce = "0"

var gas_price = "1000000"

var gas_limit = "2000000"

var callFunction = "get";

var callArgs = "[\"" + $("#search_value").val() + "\"]"; //in the form of ["args"]

var contract = {

"function": callFunction,

"args": callArgs

}

neb.api.call(from,dappAddress,value,nonce,gas_price,gas_limit,contract).then(function (resp) {

cbSearch(resp)

}).catch(function (err) {

//cbSearch(err)

console.log("error:" + err.message)

})

})

//return of search,

function cbSearch(resp) {

var result = resp.result resp is an object, resp.result is a JSON string

console.log("return of rpc call: " + JSON.stringify(result))

if (result === 'null'){

$(".add_banner").addClass("hide");

$(".result_success").addClass("hide");

$("#result_faile_add").text($("#search_value").val())

$(".result_faile").removeClass("hide");

} else{

//if result is not null, then it should be "return value" or "error message"

try{

result = JSON.parse(result)

}catch (err){

//result is the error message

}

if (!!result.key){ //"return value"

$(".add_banner").addClass("hide");

$(".result_faile").addClass("hide");

$("#search_banner").text($("#search_value").val())

$("#search_result").text(result.value)

$("#search_result_author").text(result.author)

$(".result_success").removeClass("hide");

} else { //"error message"

$(".add_banner").addClass("hide");

$(".result_faile").addClass("hide");

$("#search_banner").text($("#search_value").val())

$("#search_result").text(result)

$("#search_result_author").text("")

$(".result_success").removeClass("hide");

}

}

}

// 添加信息功能: 像super-dictionary 中添加词条

$("#add").click(function() {

$(".result_faile").addClass("hide");

$(".add_banner").removeClass("hide");

$("#add_value").val("")

})

var NebPay = require("nebpay"); //https://github.com/nebulasio/nebPay

var nebPay = new NebPay();

var serialNumber

$("#push").click(function() {

var to = dappAddress;

var value = "0";

var callFunction = "save"

var callArgs = "[\"" + $("#search_value").val() + "\",\"" + $("#add_value").val() + "\"]"

serialNumber = nebPay.call(to, value, callFunction, callArgs, { //使用nebpay的call接口去调用合约,

listener: cbPush //设置listener, 处理交易返回信息

});

intervalQuery = setInterval(function () {

funcIntervalQuery();

}, 5000);

});

var intervalQuery

function funcIntervalQuery() {

nebPay.queryPayInfo(serialNumber) //search transaction result from server (result upload to server by app)

.then(function (resp) {

console.log("tx result: " + resp) //resp is a JSON string

var respObject = JSON.parse(resp)

if(respObject.code === 0){

alert(`set ${$("#search_value").val()} succeed!`)

clearInterval(intervalQuery)

}

})

.catch(function (err) {

console.log(err);

});

}

function cbPush(resp) {

console.log("response of push: " + JSON.stringify(resp))

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值