我想说的就是。下面的功能可以查看视频网站的真实地址的。
1网站的编码有的是gb212.有的是utf-8
我即想用到gb212又想用到utf-8...而不是单一的,如果是单一的。。可以查看一种。。另外一种始终是一个乱码。
所在想问一下。。看看有什么方法。。或是意见或是可以在这个JS这个代码里修改?
js 代码如下:
var button_label0='获取地址';
var button_label1='正在获取';
var result_label0='等待提交...';
var result_label1='<img src="/images/load.gif" alt="loading" /> 获取中(专辑需时稍长,不要关闭本页)...';
var input_label0='在这里粘贴视频页面的地址...';
var msg = "请用右键“目标另存为”或用快车下载\n【提示:大部分视频无法使用迅雷下载】";
$(document).ready(function(){
/*绑定事件 javascript
function $(id){return window.document.getElementById(id);}
$('videoPageURI').onfocus = function(){this.select();if(this.value==input_label0){this.value='';}};
$(videoPageURI).onblur = function(){if(this.value==''){this.value=input_label0}};
*/
//绑定事件 use jquery
$('#videoPageURI').focus(function(){this.select();if(this.value==input_label0){this.value='';}});
$('#videoPageURI').blur(function(){if(this.value==''){this.value=input_label0}});
//$('#fetchButton').click(function(){parseFlv();}); //写在html里更容易维护

//根据url的地址,执行init
var videoPageURI=location.toString().queryString('url');
$('#fetchButton').val(button_label0);
if(videoPageURI==null){
$('#videoPageURI').val(input_label0);
$('#resultbox').hide();
} else {
if(videoPageURI.indexOf('http')===0){
$('#videoPageURI').val(decodeURIComponent(videoPageURI).replace('http:##','http://').replace('https:##','https://'));
getFlv();
} else {
videoPageURI=decodeBase64(videoPageURI).replace('http:##','http://').replace('https:##','https://');
if(videoPageURI.indexOf('http')!==0 && videoPageURI.indexOf(':')===0) videoPageURI='http'+videoPageURI;
$('#videoPageURI').val(videoPageURI);
getFlv();
}
}
$('#examplebox').show();
});function getFlv() {
  var uri = $('#videoPageURI').val();
  if ((uri == null) || (uri == "")) return;
  $('#fetchButton').attr('disabled',"disabled");
  $('#fetchButton').val(button_label1);
  $('#result').css('display','block');
  $('#result').html(result_label1);
  $('#resultbox').show();
$.getScript("http://www.xxx.com/getFlv.php?url="+encodeBase64(uri.replace('http://','http:##').replace('https://','https:##')), function(){
$('#fetchButton').attr('disabled','');
$('#fetchButton').val(button_label0);
});
}
function copyToClipboard(txt) 

 if(window.clipboardData)  
  { 
    window.clipboardData.clearData(); 
    window.clipboardData.setData("Text", txt); 
  } 
  else if(navigator.userAgent.indexOf("Opera") != -1)  
  { 
    window.location = txt; 
  }  
  else if (window.netscape)  
  { 
    try  
    { 
      netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
    }  
    catch (e)  
    { 
      //alert("您的firefox安全限制限制您进行剪贴板操作,请在地址栏中输入“about:config”将“signed.applets.codebase_principal_support”设置为“true”之后重试"); 
      return false; 
    } 
    var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
    if (!clip) 
      return; 
    var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
    if (!trans) 
      return; 
    trans.addDataFlavor('text/unicode'); 
    var str = new Object(); 
    var len = new Object(); 
    var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
    var copytext = txt; 
    str.data = copytext; 
    trans.setTransferData("text/unicode",str,copytext.length*2); 
    var clipid = Components.interfaces.nsIClipboard; 
    if (!clip) 
      return false; 
    clip.setData(trans,null,clipid.kGlobalClipboard); 
  }
  return true;
}  
function down(flv,vname) {
if(copyToClipboard(vname)){
alert("\n已复制文件名:"+vname);
}else{
alert("\n浏览器不允许复制。");
}
var winobj=window.open(flv,"down");
if(winobj==null) window.location=flv;
return false;
}
function parseFlv(){
var uri=$('#videoPageURI').val();
if(uri.indexOf('http')!==0){
alert('Invalid URI');
location.href='/';
return;
}
top.location='?url=' + encodeBase64(uri.replace('http://','http:##').replace('https://','https:##'));
}
String.prototype.queryString = function(key){
    var sValue=this.match(new RegExp("[\?\&]"+key+"=([^\&]*)(\&?)","i"));
    return sValue ? sValue[1]:sValue
}String.prototype.setKeyValue = function(key,value){
    if(this.queryString(key) != null){
        var reg = new RegExp("([\?\&])(" + key + "=)([^\&]*)(\&?)","i");
        return this.replace(reg,"$1$2" + value + "$4");
    }else{
        var add = arguments[2];
        if(add === true){
            return this + (this.indexOf("?") > -1 ? "&" : "?") + key + 
"=" + value;
        }else return this;
    }
}function in_array(stringToSearch, arrayToSearch) {
    for (s = 0; s <arrayToSearch.length; s++) {
        thisEntry = arrayToSearch[s].toString();
        if (thisEntry == stringToSearch) {
            return true;
        }
    }
    return false;
}
function switchbox(boxid){
var boxes=Array('lastquerybox','supportsitebox','examplebox','lastupdatebox','advbox');
if( in_array(boxid,boxes) ){
for (s = 0; s <boxes.length; s++) {
$('#'+boxes[s]).hide();
}
if(boxid=='lastquerybox') $.getScript("http://www.xxx.com/lastquery.php");
if(boxid=='lastupdatebox') $.getScript("http://www.xxx.com/lastupdate.php");
if(boxid=='supportsitebox') $.getScript("http://www.xxx.com/supportsite.php");
$('#'+boxid).show();
}
}
function preview(sharecode){
$('#previewbox').html(sharecode);
$('#previewbox').slideDown('slow');
}