Ad code static js common function _ javascript skills

Source: Internet
Author: User
Ad code static js common functions /*
JavaScript Document
Ad code static js common functions
In principle, each page should not have a fixed domain name point.
*/
/*
Config
*/
Var sSiteUrl = "http://www.spvjoy.com ";
// Var sSiteUrl = "http: // 192.168.1.30: 82 ";
Var sSendSite = "http://send.mmstoon.com ";
Var sMp3Url = "http://r01.mmstoon.com/mp3 ";
Var sRingUrl = "http://r01.mmstoon.com/ring ";
Var sSpUrl = "http://r01.mmstoon.com ";
Var sMmfUrl = "http://r01.mmstoon.com/MmfRing ";
Var sPhotoUrl = "http://p01.mmstoon.com/mmsimg/comm ";
Var sVideoPicUrl = "http://r01.mmstoon.com/video ";
// Var ServerUrl = "http://search.mmstoon.com/netServer ";
// Var ServerUrl = "http: // 192.168.1.30/netServer /";
Var ServerUrl = "http: // 221.238.249.17/netServer /";

/*
Function: Get the value of a specified parameter from the URL.
*/
Function GetUrlArg (strArg, strUrl ){
Var _ url;
If (typeof (strUrl) = "undefined ")
_ Url = location. href + "&";
Else
_ Url = strUrl + "&";
Var regex = new RegExp ("(\\? | \\&) "+ StrArg +" = ([^ \\\\?] *) \ & "," Gi ");
If (! Regex. test (_ url) return "";
Var arr = regex.exe c (_ url );
Return (RegExp. $2 );
}

Function urlQuery (){
Var sq = "";
For (I = 0; I if (sq! = "") Sq = sq + = "&";
Sq + = arguments [I] + "=" + GetUrlArg (arguments [I]);
}
Return sq;
}

/*
Global Variables
*/
Var f = GetUrlArg ("f ");
Var lower_cooid = GetUrlArg ("lower_cooid ");
Var adfcid = GetUrlArg ("adfcid"); // escape the lower_cooid parameter of the second line
Var ad_id = GetUrlArg ("ad_id ");
Var s = GetUrlArg ("s ");
Var num = GetUrlArg ("num ");
Var ty = GetUrlArg ("ty ");
Var d = GetUrlArg ("d ");
If (ty = "")
{
Ty = "mp3 ";
}
If (lower_cooid = "" & adfcid! = "") Lower_cooid = adfcid;

/*
Open a link to a common function without parameters. In special cases, it is not recommended to use
*/
Function openCommonWin (url ){
// Sort out the main parameters
Var sf = GetUrlArg ("f", url)
Var slower_cooid = GetUrlArg ("lower_cooid", url)
Var sad_id = GetUrlArg ("ad_id", url)
If (sf = "") sf = f;
If (slower_cooid = "") slower_cooid = lower_cooid;
If (sad_id = "") sad_id = ad_id;
If (url. substring (0, "http://un.mmstoon.com". length) = "http://un.mmstoon.com "){
OpenUn ();
} Else {
Var sUrl = url. split ("? ") [0] + "? F = "+ sf +" & lower_cooid = "+ slower_cooid +" & ad_id = "+ sad_id +" & d = "+ d;
If (url. split ("? ") [1]! = Null) sUrl = sUrl + "&" + url. split ("? ") [1]
/* Exception Handling */
If (window. location. href. indexOf ("/MSNcode/")> 0 ){
Window. open (sUrl, "_ self ");
} Else {
Window. open (sUrl, "_ blank ");
}
}
}

/*
Open Homepage
*/
Function openHome (){
If (window. location. href. indexOf ("/blue/")> 0 ){
Window. open ("http://www.spjoy.com/AdFiles/blue/blue.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & d = "+ d, '_ blank ');
} Else {
Window. open (sSiteUrl + "? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & d = "+ d, '_ blank ');
}
}

/*
Open Alliance
*/
Function openUn (){
// The Alliance turns to take care of the second-level alliance
If (f = "98213 ")
{
Window. open ("http://union.00yes.com/", '_ blank ');
}
Else
{
Window. open ("http://un.mmstoon.com /? F = "+ f, '_ blank ');
}
}

/*
Summary on the topic page
*/
Function openSpecial (){
Var ips = 36;
Window. open (sSiteUrl + "/ncList.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & ty = special & ps = "+ ips +" & d = "+ d, '_ blank ');
// Window. location. href = sSiteUrl + "/ncList.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & ty = special & ps = "+ ips;
}

/*
Open Search Page
*/
Function openSearch (){
Window. open (sSiteUrl + "/search.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & d = "+ d, '_ blank ');
// Window. location. href = sSiteUrl + "/search.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id;
}

/*
Open the MMS diy page
*/
Function openDiy (){
Window. open (sSiteUrl + "/zyzse.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & d = "+ d, '_ blank ');
}

/*
Open link in new window
*/
Function openSendWin (ty, num ){
If (ty = "") ty = "mp3 ";
// Window. open (sSendSite + "/Send/SendRedirect. asp? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & num = "+ num +" & ty = "+ ty, '_ blank', 'left = 100, top = 0, width = 100, height = 100, status = yes, resizable = yes ');
Window. open (sSendSite + "/Send/SendRedirect. asp? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & num = "+ num +" & ty = "+ ty + "& d = "+ d, '_ blank ');
// Window. showModalDialog (sSendSite + "/Send/SendRedirect. asp? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & num = "+ num +" & ty = "+ ty, '_ blank', 'dialogwidth: 432px; dialogHeight: 400px; center: yes; status: 0; help: 0; edge: raised; resizable: 1; scroll: 1 ');
}

/*
Open link in iframe
*/
Function openSendWinInIfr (ty, num, sSubject, sReviewFile ){
Window. open (sSendSite + "/Send/SendFalse. asp? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & num = "+ num +" & ty = "+ ty + "& subject = "+ sSubject +" & u = "+ sReviewFile +" & d = "+ d, 'winsend ');
}

/*
Open the general function of the artist album page. The default resource type can be changed here.
*/
Function openSongerWin (strSonger, ty ){
Var sty = "mp3 ";
If (typeof (ty )! = "Undefined") sty = ty
Window. open (sSiteUrl + "/searchResult.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & search = "+ strSonger +" & ty = "+ sty + "& d = "+ d, '_ spvsearch ');
}

/*
Open the chord column list
*/
Function openChnChordWin (chn ){
OpenChnList ("ring", chn );
}

/*
Open Mp3 topic list
*/
Function openChnMp3Win (chn ){
// OpenChnList ("mp3", chn );
OpenChnList ("spring", chn );
}

/*
Open the special effect topic list
*/
Function openChnSpWin (chn ){
OpenChnList ("spring", chn );
}

/*
Open the MMF special effect topic list
*/
Function openChnMmfWin (chn ){
OpenChnList ("mmf", chn );
}

/*
Open the MMS topic list
*/
Function openPicWin (chn ){
OpenChnList ("photo", chn );
}

/*
Open the exquisite color chart column list
*/
Function openPicsWin (chn ){
OpenChnList ("photo", chn );
}

/*
Open the column list in the framework
*/
Function openListWin (chn ){
Var sCurUrl = window. location. href;
Var sQuery = "f =" + f + "& lower_cooid =" + lower_cooid + "& ad_id =" + ad_id + "& ty =" + ty + "& chn =" + chn + "& ps =" + ps + "& d =" + d;
/* Webpage template shunting */
If (sCurUrl. indexOf ("/blue/")> 0 ){
Switch (ty ){
Case "photo ":
Window. open (sSiteUrl + "/blue/plist.htm? "+ SQuery, 'ifrlist ');
Break;
Case "video ":
Window. open (sSiteUrl + "/blue/vlist.htm? "+ SQuery, 'ifrlist ');
Break;
Case "ivr ":
Window. open (sSiteUrl + "/blue/ilist.htm? "+ SQuery, 'ifrlist ');
Break;
Default:
Window. open (sSiteUrl + "/blue/mlist.htm? "+ SQuery, 'ifrlist ');
Break;
}
} Else {
Window. open (sSiteUrl + "/list.htm? "+ SQuery, 'ifrlist ');
}
}

Function openChnList (ty, chn ){
Var schn = "";
Var ips = 92;
If (ty = "photo" | ty = "video") ips = 16;
If (typeof (chn )! = "Undefined") schn = chn;
Var sCurUrl = window. location. href;
/* Webpage template shunting */
If (sCurUrl. indexOf ("/blue/")> 0 ){
Ips = 36;
If (ty = "photo" | ty = "video") ips = 16;
// Location. replace (sSiteUrl + "/blue/" + ty + ". htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & ty = "+ ty +" & chn = "+ schn + "& ps = "+ ips );
Window. open (sSiteUrl + "/blue/" + ty + ". htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & ty = "+ ty +" & chn = "+ schn + "& ps = "+ ips +" & d = "+ d, '_ spvchn ');
}
Else
Window. open (sSiteUrl + "/cList.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & ty = "+ ty +" & chn = "+ schn + "& ps = "+ ips +" & d = "+ d, '_ spvchn ');
}
/*
Search form submission
*/
Var des = "enter a singer or song name ";
Function cf (e) {if (e. value = des) {e. value = ""; e. select ();}}
Function cl (e) {if (e. value. replace (// g ,""). replace (// g, "") = '') {e. value = des ;}}

Function searchSubmit (e ){
Try {
If (e. nodeName. toLowerCase () = "input ")
E = e. parentElement. previussibling. firstChild;

If (e. value = des | e. value. replace (// g, "") = ''){
E. select ();
Return false;
}
Else
Window. open (sSiteUrl + "/searchResult.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & search = "+ e. value + "& d =" + d, '_ spvsearch ');
// Window. location. href = sSiteUrl + "/searchResult.htm? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & search = "+ e. value;
} Catch (ee)
{
// Alert (ee );
}
}

/*
Event processing after page loading is complete
*/
Function funcOnload (){
Var oIfr = document. all ("winSend ");
If (oIfr! = Null ){
OIfr. src = sSendSite + "/send/SendSearchM. asp? F = "+ f +" & lower_cooid = "+ lower_cooid +" & ad_id = "+ ad_id +" & l = 1 & s = "+ s +" & num = "+ num + "& d =" + d
}
/*
Focus XX
*/
// Var oTxtSearch = document. all ("search ");
// If (oTxtSearch! = Null ){
// OTxtSearch. focus ();
//} Else {
// Var oLink = document. getElementsByTagName ("");
// If (oLink. length> 0 ){
// OLink [0]. focus ();
//}
//}
}
Window. attachEvent ("onload", funcOnload );

/*
Page statistics writing
*/
Function PvStat (){
Var ty = GetUrlArg ("ty ");
Document. write ("");
}

/*
Search Keyword statistics write
*/
Function SearchKeyStat (strKey ){
Var ty = GetUrlArg ("ty ");
Var sKey;
If (typeof (strKey )! = "Undefined "){
SKey = strKey;
}
Else {
SKey = GetUrlArg ("search ");
}
Document. write ("");
}


Function wrLoading (){
Try {
Var oBody = Invalid Response Doc ument. body;
Var it op = 250;
Var iLeft = 400;
If (oBody! = Null ){
ITop = oBody. clientHeight/2-20;
ILeft = oBody. clientWidth/2-75;
}
/*
Var strDiv ="

";
StrDiv + ="


";StrDiv + ="
";
StrDiv + =" ";
StrDiv + = "loading data. Please wait... tired .....";
StrDiv + =" ";
StrDiv + ="

";
*/
Var strDiv ="

";
StrDiv + ="


";StrDiv + ="
";
StrDiv + = "loading data. Please wait ......";
StrDiv + ="

";
Document. write (strDiv );
} Catch (e ){
Alert (e. description );
}
}
// WrLoading ();
Function hideLoading (){
If (typeof (loading )! = "Undefined ")
Loading. style. display = "none ";
}
// Window. attachEvent ("onload", hideLoading );

/* Write a logo
Function writeLogo (){
Var iTop = document. body. scrollHeight-45;
Var oDiv = document. createElement ("

");
Document. body. appendChild (oDiv );
Document. all ("DivLogo"). innerHTML = ""
}
If (f = 117215 & window. location. href. indexOf ("/FullChannel2/")> 0 ){
Window. attachEvent ("onload", writeLogo );
}
*/
/*
* ******************** Video code jump *************** * ************* Begin
If (location. href. substring (0, "http://www.spjoy.com/AdFiles/sp760-300/sp760-300.htm". length) = "http://www.spjoy.com/AdFiles/sp760-300/sp760-300.htm ")
{
Location. href = "http://www.spjoy.com/AdFiles/760-300-1/760-300-1.htm? "+ Location. href. split ("? ") [1];
}

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/sp760-80/760-80.htm". length) = "http://www.spjoy.com/AdFiles/sp760-80/760-80.htm ")
{
Location. href = "http://www.spjoy.com/AdFiles/760-80-3/760-80-3.htm? "+ Location. href. split ("? ") [1];
}
* ******************** Video code jump *************** * ************* End
*/
/*
* ******************** Part of the code jumps to IVR ************** * ******** Begin

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/300-300-6/300-300-6.htm". length) = "http://www.spjoy.com/AdFiles/300-300-6/300-300-6.htm ")
{
Location. replace ("http://www.spjoy.com/AdFiles/ivr300-300/ivr300-300.htm? "+ Location. href. split ("? ") [1]);
}

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/468-60-3/468-60-3.htm". length) = "http://www.spjoy.com/AdFiles/468-60-3/468-60-3.htm ")
{
Location. replace ("http://www.spjoy.com/AdFiles/ivr468-60/ivr468-60.htm? "+ Location. href. split ("? ") [1]);
}

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/DJ760-90/dj760-90.htm". length) = "http://www.spjoy.com/AdFiles/DJ760-90/dj760-90.htm ")
{
Location. replace ("http://www.spjoy.com/AdFiles/ivr760-90/ivr760-90.htm? "+ Location. href. split ("? ") [1]);
}

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/468-95-2/468-95-2.htm". length) = "http://www.spjoy.com/AdFiles/468-95-2/468-95-2.htm ")
{
Location. replace ("http://www.spjoy.com/AdFiles/ivr468-95/ivr468-95.htm? "+ Location. href. split ("? ") [1]);
}

If (location. href. substring (0, "http://www.spjoy.com/AdFiles/650-70-2/650-70-2.htm". length) = "http://www.spjoy.com/AdFiles/650-70-2/650-70-2.htm ")
{
Location. replace ("http://www.spjoy.com/AdFiles/ivr650-70/ivr650-70.htm? "+ Location. href. split ("? ") [1]);
}
* ******************** Part of the code jumps to IVR ************** * ************** End
*/
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.