Files
ClassContent/历届学生/逯帅帅/项目开发/学生项目/应越波/美食杰APP/js/page/voidInfo.js
2024-09-27 02:06:13 +08:00

28 lines
986 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class VoidInfo{
constructor(){
this.getVoidInfo();
}
async getVoidInfo(){
let video=document.querySelector('.header video');
let h2=document.querySelector('.content h2');
let p=document.querySelector('.content p');
video.src=getUrlSearch('vid');
h2.innerHTML=getUrlSearch('tid');
p.innerHTML=getUrlSearch('inif');
}
}
new VoidInfo();
function getUrlSearch(name) {
        if (!name) return null;
        var after = window.location.search;
        after = after.substr(1) || window.location.hash.split('?')[1];
        if (!after) return null;
        if (after.indexOf(name) === -1) return null;
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
        var r = decodeURI(after).match(reg);
        if (!r) return null;
        return r[2];
    }