批处理之家's Archiver

yu2n 发表于 2013-4-17 23:50

[HTA 源码] 豆瓣FM网页播放器

[HTA 源码] 豆瓣FM网页播放器,写给喜欢这个网页播放器的人 by yu2n

在线预览:[url]http://douban.fm/radio[/url]
源码下载:[attach]8017[/attach]

2015.01.08 更新:网络不通时,自动尝试重新连接(如将播放器加入系统启动项运行时,ADSL可能还未准备好。)。[code]<html>
<html>
<hta:Application ID="douban_fm" ApplicationName="douban_fm" Title="豆瓣FM"
border="thin" borderstyle="normal" caption="yes" icon="http://douban.fm/favicon.ico"
maximizebutton="no" minimizebutton="yes" closebutton="yes" showintaskbar="yes" singleinstance="yes"
sysmenu="yes" version="1.0" windowstate="minmize"
/>
  <head>
  <title>豆瓣FM</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script language=JavaScript type="text/javascript">
  // 在窗口显示前更改窗口大小
  while (true) {try {var w=420,h=0; window.resizeTo(w, h); window.moveTo((window.screen.width - w) / 2, (window.screen.height - h) / 2); break; } catch (e) {continue;} }

  // 屏蔽错误
  window.onerror=function(){return true;}

  // 在标题栏显示载入中
  var strTitle = document.title;
  document.title = strTitle + " - 载入中 ... ";

  // 判断网络连接
  if (!ping("douban.fm")) {
    document.title = strTitle + " - 网络故障,请检查网络连接 ...";
    setInterval("document.execCommand('Refresh');douban_fm.icon='http://douban.fm/favicon.ico';", 3000);
  };

  // 载入框架后执行
  function douban_loading()
  {
    win_resize(420,186);
    document.title = strTitle;
  }

  // 修改窗口内页面的大小(非窗口)
  function win_resize(w,h)
  {
    var winWidth, winHeight;
    var w2=w, h2=h;
    for (var i = 0; i < window.screen.width; i++)
    {
      //获取窗口宽度
      if (window.innerWidth)
        winWidth = window.innerWidth;
      else if ((document.body) && (document.body.clientWidth))
        winWidth = document.body.clientWidth;

      //获取窗口高度
      if (window.innerHeight)
        winHeight = window.innerHeight;
      else if ((document.body) && (document.body.clientHeight))
        winHeight = document.body.clientHeight;

      //通过深入Document内部对body进行检测,获取窗口大小
      if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth)
      {
        winHeight = document.documentElement.clientHeight;
        winWidth = document.documentElement.clientWidth;
      }
      
      // 小于指定大小时,调大窗口
      if (winWidth <= w)(w2 = w + i);
      if (winHeight <= h)(h2 = h + i);
      if ((winWidth >= w) && (winHeight >= h)){break;}
      window.resizeTo(w2, h2);
      window.moveTo((window.screen.width - w2) / 2, (window.screen.height - h2) / 2);
    }
  }

  // Ping
  function ping(host){
    var oWmic = GetObject("winmgmts:{impersonationLevel=impersonate}"
        ).ExecQuery("select * from Win32_PingStatus where address = '" + host + "'")
    var oEnum = new Enumerator(oWmic); for (; !oEnum.atEnd(); oEnum.moveNext()) {
      if (oEnum.item().ResponseTime != null && oEnum.item().ResponseTime >= 0) return(true);
    }; return(false);
  }
  </script>
  <style type="text/css">
  html, body { margin: 0px; padding: 0px; }
  .douban_fm_iframe {
    height: 100%; width: 100%;
    margin: 0px; padding: 0px;
    overflow: visible;
  }
  </style>
  </head>
  <body>
    <iframe class="douban_fm_iframe" src="http://douban.fm/radio" scrolling="NO" onload="douban_loading();">
  </body>
</html>
[/code]

BAT-VBS 发表于 2013-4-18 08:48

感谢分享!

ShadowFiend 发表于 2013-4-18 11:25

多谢分享!

Spring 发表于 2013-7-27 14:06

小东西还是做成hta好啊,去页面始终麻烦

yu2n 发表于 2014-5-19 21:06

[quote]多米音乐在线播放-online music  (by yu2n)[/quote][code]<html>
<hta:Application ID="duomi.com" ApplicationName="duomi.com"
border="thin" borderstyle="normal" caption="yes" icon="http://duomi.com/favicon.ico"
maximizebutton="no" minimizebutton="yes" closebutton="yes" showintaskbar="yes" singleinstance="yes"
sysmenu="yes" version="1.0" windowstate="minmize" />
  <head>
    <title>多米音乐在线播放-online music</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script language=JavaScript type="text/javascript">
        // 在窗口显示前更改窗口大小
                while (true) {try {var w=760,h=0; window.resizeTo(w, h); window.moveTo((window.screen.width - w) / 2, (window.screen.height - h) / 2); break; } catch (e) {continue;} }
        
        // 屏蔽错误
        window.onerror=function(){return true;}
        
        // 在标题栏显示载入中
        var strTitle = document.title;
        document.title = strTitle + " - Loading ... ";
        
        // 载入框架后执行
        function douban_loading()
        {
            win_resize(760,520);
            document.title = strTitle;
        }
        
        // 修改窗口内页面的大小(非窗口)
        function win_resize(w,h)
        {
            var winWidth, winHeight;
            var w2=w, h2=h;
            for (var i = 0; i < window.screen.width; i++)
            {
                //获取窗口宽度
                if (window.innerWidth)
                    winWidth = window.innerWidth;
                else if ((document.body) && (document.body.clientWidth))
                    winWidth = document.body.clientWidth;

                //获取窗口高度
                if (window.innerHeight)
                    winHeight = window.innerHeight;
                else if ((document.body) && (document.body.clientHeight))
                    winHeight = document.body.clientHeight;

                //通过深入Document内部对body进行检测,获取窗口大小
                if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth)
                {
                    winHeight = document.documentElement.clientHeight;
                    winWidth = document.documentElement.clientWidth;
                }
               
                // 小于指定大小时,调大窗口
                if (winWidth <= w)(w2 = w + i);
                if (winHeight <= h)(h2 = h + i);
                if ((winWidth >= w) && (winHeight >= h)){break;}
                window.resizeTo(w2, h2);
                window.moveTo((window.screen.width - w2) / 2, (window.screen.height - h2) / 2);
            }
                }
        </script>
    <style type="text/css">
    html, body { margin: 0px; padding: 0px; }
    .douban_fm_iframe {
        height: 100%; width: 100%;
        margin: 0px; padding: 0px;
        overflow: visible;
    }
    </style>
  </head>
    <body>
        <iframe class="douban_fm_iframe" src="http://app.duomiyy.com/webradio/hao123/" scrolling="NO" onload="douban_loading();">
    </body>
</html>[/code][quote]多米音乐在线播放-online music  (来自官方插件)[/quote][code]<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>在线音乐播放-online music</title>
</head>
<body style="text-align:center;background: #dbdbdb;color: #666666;overflow: hidden;">
<iframe src="http://app.duomiyy.com/webradio/hao123/"  id="iframepage" name="iframepage" width=760 height=520 frameBorder=0 scrolling=no style=""></iframe>
</body>
</html>[/code]

yu2n 发表于 2014-12-9 19:45

在MSN(123.msn.com)上看到另一个版本
[url]http://douban.fm/partner/msnav[/url]

klamer 发表于 2015-12-7 14:10

感谢楼主!我很喜欢用豆瓣的啦~

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.