“Test”的版本間的差異

來自Youbianku
?
第1行: 第1行:
?
<html>
+
<html lang="en">
?
<style>
+
<head>
?
div.pc_right td {
+
? <meta charset="UTF-8">
?
?? padding:10px 10px;
+
? <meta name="viewport" content="width=device-width, initial-scale=1.0">
?
}
+
? <title>分享功能測試</title>
?+
</head>
?+
<body>
?+
?? <h1>分享功能測試</h1>
?+
? <button id="shareButton">分享</button>
??
?
.pc_right ul {
+
? <script>
?
? margin-bottom: 10px
+
? ? document.getElementById("shareButton").addEventListener("click", async () => {
?
}
+
? ? ? if (navigator.share) {
?
.pc_right li {
+
? ? ? ? try {
?
? color: #555;
+
? ? ? ? ? await navigator.share({
?
? font-size: 15px;
+
? ? ? ? ? ? title: "防騙測試分類", // 自定義分享的標(biāo)題
?
? line-height: 18px;
+
? ? ? ? ? ? text: "想知道自己能識別多少詐騙手段?試試查號吧的【防騙測試】,快速測出您的防騙指數(shù)!點擊開始", // 自定義分享的文本
?
? margin-top: 8px;
+
? ? ? ? ? ? url: "https://www.chahaoba.com/static/html2/", // 分享的鏈接地址
?
? word-wrap: break-word;
+
? ? ? ? ? });
?
}
+
? ? ? ? ? console.log("分享成功");
?
.paging {
+
? ? ? ? ? alert("分享成功");
?
? float:right;
+
? ? ? ? } catch (error) {
?
}
+
? ? ? ? ? console.error("分享失敗:", error);
?
.paging li {
+
? ? ? ? ? alert("分享失敗: " + error.message);
?
? display: inline-block;
?
?
? padding-left:20px;
?
?
}
?
?
.paging li a {
?
?
? cursor: pointer;
?
?
}
?
?
?
?
?
a.disabled {
?
?
? ? ? ? ? ? pointer-events: none;
?
?
? ? ? ? ? ? filter: alpha(opacity=50); /*IE濾鏡,透明度50%*/
?
?
? ? ? ? ? ? -moz-opacity: 0.5; /*Firefox私有,透明度50%*/
?
?
? ? ? ? ? ? opacity: 0.5; /*其他,透明度50%*/
?
?
cursor: not-allowed;
?
?
?? ? ? ? }
?
?? ? ? ? }
?
?
?
? .custom-content-marker {
?
?
? ? position: relative;
?
?
? ? width: 25px;
?
?
? ? height: 34px;
?
?
? }
?
?
?
?
? .custom-content-marker img {
?
?
? ? width: 100%;
?
?
? ? height: 100%;
?
?
? }
?
?
?
?
? .custom-content-marker .close-btn {
?
?
? ? position: absolute;
?
?
? ? top: -6px;
?
?
? ? right: -8px;
?
?
? ? width: 15px;
?
?
? ? height: 15px;
?
?
? ? font-size: 12px;
?
?
? ? background: #ccc;
?
?
? ? border-radius: 50%;
?
?
? ? color: #fff;
?
?
? ? text-align: center;
?
?
? ? line-height: 15px;
?
?
? ? box-shadow: -1px 1px 1px rgba(10, 10, 10, .2);
?
?
? }
?
?
?
?
? .custom-content-marker .close-btn:hover {
?
?
? ? background: #666;
?
?
? }
?
?
</style>
?
?
<div class="pc_right unified-content"></div>
?
?
<script>
?
?
? window._AMapSecurityConfig = {
?
?
? ? securityJsCode: "e74a8c5cbb59ca59a80644821b09564a",
?
?
? }
?
?
</script>
?
?
<!-- 加載地圖JSAPI腳本 -->
?
?
<script src="https://webapi.amap.com/maps?v=2.0&key=4c312ad74a0e9fedf41d4983592bed33&plugin=AMap.Geocoder"
?
?
? defer></script>
?
?
<script type='text/javascript'>
?
?
function getQueryVariable(variable)
?
?
{
?
?
? ? ? var query = window.location.search.substring(1);
?
?
? ? ? var pos = query.indexOf('loc');
?
?
? ? ? var str = query[pos-1];
?
?
? ? ? var vars = query.split(str);
?
?
? ? ? for (var i=0;i<vars.length;i++) {
?
?
? ? ? ? var pair = vars[i].split("=");
?
?
? ? ? ? if(pair[0] == variable){return pair[1];}
?
?
? ? ? }
?
?
? ? ? return '';
?
?
}
?
?
? function codeAddress(obj){
?
?
? ? var address = obj.results[0].address;
?
?
? ? // 高德地圖API功能
?
?
? ? window.onload = function () {
?
?
? ? // 創(chuàng)建地圖
?
?
? ? const map = new AMap.Map('container', {
?
?
? ? ? viewMode: '2D', // 默認使用 2D 模式
?
?
? ? ? zoom: 17 // 初始化地圖層級
?
?
? ? });
?
?
?
?
? ? const geocoder = new AMap.Geocoder({
?
?
? ? ? city: '全國' // 由于不確定城市,使用全國進行編碼查詢
?
?
? ? });
?
?
?
?
? ? //? // 調(diào)用 getLocation 方法獲取中心點坐標(biāo)
?
?
? ? geocoder.getLocation(address, function (status, result) {
?
?
? ? ? if (status === 'complete') {
?
?
? ? ? ? console.log(status);
?
?
? ? ? ? // 獲取中心點坐標(biāo)
?
?
? ? ? ? const coordinate = result.geocodes[0].location;
?
?
? ? ? ? // 使用中心點坐標(biāo)創(chuàng)建地圖
?
?
? ? ? ? map.setCenter(coordinate);
?
?
?
?
? ? ? ? // 創(chuàng)建信息窗體
?
?
? ? ? ? const infoWindow = new AMap.InfoWindow({
?
?
? ? ? ? ? //isCustom: true,? // 使用自定義窗體
?
?
? ? ? ? ? autoMove: false, // 中心坐標(biāo)和這個組件有沖突,把這個組件屬性改為false可以解決
?
?
? ? ? ? ? content: '<div style="background:#fff;padding: 5px;"><p>地址:'+address+'</p><p>郵編:'+obj.results[0].postcode+'</p></div>', // 信息窗體的內(nèi)容可以是任意 html 片段
?
?
? ? ? ? ? offset: new AMap.Pixel(0, -40)
?
?
? ? ? ? });
?
?
? ? ? ? let flag = true;
?
?
? ? ? ? const onMarkerClick = function (e) {
?
?
? ? ? ? ? // e.target 就是被點擊的 Marker
?
?
? ? ? ? ? console.log(e.target);
?
?
? ? ? ? ? if (!flag) {
?
?
? ? ? ? ? ? flag = true;
?
?
? ? ? ? ? ? infoWindow.open(map, e.target.getPosition()); // 打開信息窗體
?
?
? ? ? ? ? } else {
?
?
? ? ? ? ? ? flag = false;
?
?
? ? ? ? ? ? infoWindow.close()
?
?
? ? ? ? ? }
?
?
? ? ? ? }
?
?
?
?
? ? ? ? const markergaode = new AMap.Marker({
?
?
? ? ? ? ? position: coordinate
?
?
? ? ? ? })
?
?
? ? ? ? map.add(markergaode);
?
?
? ? ? ? markergaode.on('click', onMarkerClick); // 綁定 click 事件
?
?
? ? ? ? infoWindow.open(map, coordinate)
?
?
?
?
?? ? ? } else {
?
?? ? ? } else {
?
?? ? ? ? console.error('獲取中心點坐標(biāo)失敗');
+
? ? ? ? alert("您的瀏覽器不支持分享功能");
?+
?? ? ? ? console.warn("navigator.share is not supported on this browser.");
?
?? ? ? }
?
?? ? ? }
?
?? ? });
?
?? ? });
?
?? }
+
?? </script>
?
? }
+
</body>
?
? ? ? var pageSize = 10;
?
?
? ? ? var currentPage = 0;
?
?
? ? ? var pages = 1;
?
?
? ? ? var allData = [];
?
?
? ? ? function paging(currentPage, arr) {
?
?
? ? ? ? var html = '';
?
?
? ? ? ? var skipNum = currentPage * pageSize;
?
?
? ? ? ? var results = (skipNum + pageSize >= arr.length)? arr.slice(skipNum, arr.length):arr.slice(skipNum, skipNum + pageSize);
?
?
? ? ? ? var len = results.length;
?
?
? ? ? ? if( results[0].street!=''){
?
?
? ? ? ? ? html += '<tr><th>地址</th><th>郵編</th><th>街道</th></tr>';
?
?
? ? ? ? ? for(var i=0;i<len;i++){
?
?
? ? ? ? ? ? html += '<tr><td>'+results[i].address+'</td><td><a href="/'+results[i].postcode+'">'+results[i].postcode+'</a></td><td>'+results[i].street+'</td></tr>';
?
?
? ? ? ? ? }
?
?
? ? ? ? }else{
?
?
? ? ? ? ? html += '<tr><th>地址</th><th>郵編</th></tr>';
?
?
? ? ? ? ? for(var i=0;i<len;i++){
?
?
? ? ? ? ? ? html += '<tr><td>'+results[i].address+'</td><td><a href="/'+results[i].postcode+'">'+results[i].postcode+'</a></td></tr>';
?
?
? ? ? ? ? }
?
?
? ? ? ? }
?
?
? ? ? ? $(".zipcode-datas").html(html);
?
?
? ? ? }
?
?
? function previous() {
?
?
? ? currentPage -= 1;
?
?
? ? paging(currentPage,allData);
?
?
? ? if(currentPage == 0){
?
?
? ? ? $(".paging li a:first").addClass("disabled");
?
?
? ? }
?
?
? ? $(".paging li a:last").removeClass("disabled");
?
?
? }
?
?
? function next() {
?
?
? ? currentPage += 1;
?
?
? ? paging(currentPage,allData);
?
?
? ? if(currentPage == pages-1){
?
?
? ? ? $(".paging li a:last").addClass("disabled");
?
?
? ? }
?
?
? ? $(".paging li a:first").removeClass("disabled");
?
?
? }
?
?
</script>
?
?
<script>
?
?
? $(function () {
?
?
? ? loc = getQueryVariable('loc');
?
?
? ? address = getQueryVariable('address');
?
?
? ? city = getQueryVariable('city');
?
?
? ? if(loc!= '' || address!= '' || city!= ''){
?
?
? ? ? ? ? ? ? ? ? ? var d = new Date();
?
?
? ? ? ? ? ? ? ? ? ? var str = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+ d.getDate();
?
?
? ? ? ? ? ? ? ? ? ? var key = window.btoa( str+'youbiankuyoubianku');
?
?
? ? ? $.ajax({
?
?
? ? ? ? url: "https://www.youbianku.cn/api/test.php",
?
?
? ? ? ? type: "GET",
?
?
? ? ? ? data: { address:decodeURI(address),loc:decodeURI(loc),city:decodeURI(city), key: key},
?
?
? ? ? ? success: (obj) => {
?
?
? ? ? ? ? var obj = JSON.parse(obj);
?
?
? ? ? ? ? if(obj.results.length==0){
?
?
? ? ? ? ? ? $(".pc_right").html('<img src="/skins/Green/resources/images/noresult.svg" alt="無結(jié)果" width="180px" height="auto"><p>抱歉,未查詢到結(jié)果!請嘗試使用更標(biāo)準(zhǔn)的地址進行查詢。比如:在查詢詞的前面加上城市或者區(qū)縣。</P>');
?
?
? ? ? ? ? ? return false;
?
?
? ? ? ? ? }
?
?
? ? ? ? ? if(obj.num==1){
?
?
? ? ? ? ? ? var itemFront = '<ul class="serach-head"><div class="view-content-scroll"><table class="zipcode-datas"><tbody>';
?
?
? ? ? ? ? ? if(address!=''){
?
?
? ? ? ? ? ? ? if(loc==''){
?
?
? ? ? ? ? ? ? ? itemFront += '<tr><th>搜索詞</th><td>'+decodeURI(address)+'</td></tr>';
?
?
? ? ? ? ? ? ? }
?
?
? ? ? ? ? ? }
?
?
? ? ? ? ? ? itemFront += '<tr><th>地址</th><td>'+obj.results[0].address+'</td></tr><tr><th>郵編</th><td><a href="'+'/'+obj.results[0].postcode+'" >'+obj.results[0].postcode+'</a></td></tr>';
?
?
? ? ? ? ? ? var itemEnd = '</tbody></table></div></ul><div style="width:100%;"><div id="container" style="width:100%;height:360px"></div><p class="top-space"><a href="https://ditu.amap.com/dir" target="_blank">?? 點擊前往高德地圖導(dǎo)航</a></p></div>';
?
?
? ? ? ? ? ? if(obj.results[0].street!=''){
?
?
? ? ? ? ? ? ? $(".pc_right").html(itemFront+'<tr><th>街道</th><td>'+obj.results[0].street+'</td></tr>'+itemEnd);
?
?
? ? ? ? ? ? }else{
?
?
? ? ? ? ? ? ? $(".pc_right").html(itemFront+itemEnd);
?
?
? ? ? ? ? ? }
?
?
? ? ? ? ? ? codeAddress(obj);
?
?
? ? ? ? ? }else if(obj.num>1){
?
?
? ? ? ? ? ? pages = parseInt(obj.results.length / pageSize) + 1;
?
?
? ? ? ? ? ? var html = '<ul style="margin-bottom:20px;">';
?
?
? ? ? ? ? ? if(address!=''){
?
?
? ? ? ? ? ? ? if(loc==''){
?
?
? ? ? ? ? ? ? ? html += '<li><b>搜索詞:</b><span itemprop="name">'+decodeURI(address)+'</span></li>';
?
?
? ? ? ? ? ? ? }
?
?
? ? ? ? ? ? }
?
?
? ? ? ? ? ? html += '</ul><div class="view-content-scroll"><table class="zipcode-datas top-space bottom-space"></table></div>';
?
?
?
?
?
? ? ? ? ? ? if(pages>1){
?
?
? ? ? ? ? ? ? html += '<ul class="paging"><li><a href="javascript:void(0);" onclick="previous();">上一頁</a></li><li><a href="javascript:void(0);" onclick="next();">下一頁</a></li></ul><div style="clear:both;"></div>';
?
?
? ? ? ? ? ? }
?
?
? ? ? ? ? ? $(".pc_right").html(html);
?
?
? ? ? ? ? ? paging(0,obj.results);
?
?
? ? ? ? ? ? allData = obj.results;
?
?
? ? ? ? ? ? $(".paging li a:first").addClass("disabled");
?
?
? ? ? ? ? }
?
?
? ? ? ? },
?
?
? ? ? ? error: (error) => {
?
?
? ? ? ? ? $(".pc_right").html('<img src="/skins/Green/resources/images/noresult.svg" alt="無結(jié)果" width="180px" height="auto"><p>抱歉,未查詢到結(jié)果!請嘗試使用更標(biāo)準(zhǔn)的地址進行查詢。比如:在查詢詞的前面加上城市或者區(qū)縣。</P>');
?
?
? ? ? ? },
?
?
? ? ? ? complete: () => {}
?
?
? ? ? });
?
?
? ? ? gtag('event', 'search', {
?
?
? ? ? ? 'event_category': 'baidusearch',
?
?
? ? ? ? 'event_label': $("input#content").val(),
?
?
? ? ? ? 'value': ''
?
?
? ? ? });
?
?
? ? }else{
?
?
? ? ? $(".pc_right").html('<img src="/skins/Green/resources/images/noresult.svg" alt="無結(jié)果" width="180px" height="auto"><p>抱歉,未查詢到結(jié)果!請嘗試使用更標(biāo)準(zhǔn)的地址進行查詢。比如:在查詢詞的前面加上城市或者區(qū)縣。</P>');
?
?
? ? }
?
?
? })
?
?
</script>
?
?
? ? <script type="text/javascript">
?
?
? ? if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/baiduboxapp|MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
?
?
? ? document.write("<!-- 搜索結(jié)果落地頁2022-7-3 -->");
?
?
? ? document.write("<div style=\"text-align: center;\"><script type=\"text/javascript\" src=\"//code.geonamebase.com/common/l/common/g/static/f-i-pdydd.js\"><\/script></div>");
?
?
? ? }
?
?
? ? </script>
?
?
</html>
?
</html>
?
{{DISPLAYTITLE:搜索結(jié)果}}
?

2024年12月27日 (五) 08:15的最新版本

分享功能測試

分享功能測試