<!DOCTYPE html>
<html lang="en"><head>
    <meta charset="UTF-8">
	<base href="{%#local%}" />
    <title>网页图片浏览</title>
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="css/pic.css" rel="stylesheet" type="text/css" />
    <!--[if lt IE 8]>
         <style>
          .number_main .number_mainbody ul{
			margin-right:10px;
		}
     </style>
    <![endif]-->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <![endif]-->
	<script>
window.onerror=function (){return true};
 
function doList(){
window.location="{%#path%}?xmls=img.xmls&bk={%$http.get(bk)%}&name={%$http.get(name)%}&sw="+document.getElementById("sw").value+"&sh="+document.getElementById("sh").value+"&mw="+document.getElementById("mw").value+"&mh="+document.getElementById("mh").value;
} 
function SelectAll() {
 var checkboxs=document.getElementsByName("down");
 for (var i=0;i<checkboxs.length;i++) {
  var e=checkboxs[i];
  e.checked=!e.checked;
 }
}

 function DownloadAll() {
 var checkboxs=document.getElementsByName("down");
 for (var i=0;i<checkboxs.length;i++) {
  var e=checkboxs[i];
  if(e.checked)
  { window.external.get("?xmls=img.xmls&method=download&src="+encodeURIComponent(e.value)) ;
  }
 }
}
function setPath()
{ 
	var path=  window.external.folderBrowser(document.getElementById("path").value);
	if(path!=null)
	{
		document.getElementById("path").value=path;
	 window.external.get("?xmls=img.xmls&method=setPath&path="+encodeURIComponent(path)) ;
	}
	   
}
 
function openPath()
{ 
 window.external.openFolder(document.getElementById("path").value+"\\");
 
	   
}
function getLikeImg(src)
{ var newImg=new Image(); 
 newImg.src=src; 
	document.getElementById("sw").value=newImg.width;
	document.getElementById("sh").value=newImg.height;
	document.getElementById("mw").value=newImg.width;
	document.getElementById("mh").value=newImg.height;
	doList();
}
function allSearch()
{  
	document.getElementById("mw").value=0;
	document.getElementById("mh").value=0;
	document.getElementById("sw").value=0;
	document.getElementById("sh").value=0;
	doList();
}
 
function loadImg(o) {
    var src = o.getAttribute("src");
    if (src.length > 0) {
        var img = new Image();
        img.src = src;
        var imgWdith = img.width;
        var imgHeight = img.height;
        var scale = imgWdith / imgHeight;
        var top = 0, left = 0;
        if (imgWdith > 210) {
            imgWdith = 210;
        }
        else {
            left = (210 - imgWdith) / 2;
        }
        imgHeight = imgWdith / scale;
        if (imgHeight < 210) {
            top = (210 - imgHeight) / 2;
        }
        o.style.width = imgWdith+"px";
        o.style.height = imgHeight + "px";
        o.style.top = top + "px";
        o.style.left = left + "px";
    }
    
}
</script>
</head>
<body>
<div class="bgcolor">
<div class="bg">
    <header>
        <div class="center">
            <h2>网页图片浏览</h2>
      </div>
    </header>
    <div class="number_main">
        <div class="number_maintop">

            <div class="big">
                <button type="button"   onclick="allSearch()" class="skin left">所有图片</button>

                <span class="left">宽度&gt;</span>
                <input name="sw" id="sw"  type="text" class="width left" value="{%$http.get(sw,0)%}" placeholder="100">
                <span class="left">高度&gt;</span>
                <input name="sh" id="sh"  type="text" class="width left" value="{%$http.get(sh,0)%}" placeholder="100">

            

                <span class="left">宽度&lt;</span>
                <input name="mw" id="mw" type="text" class="width" value="{%$http.get(mw,0)%}" placeholder="100">
                <span class="left">高度&lt;</span>
                <input name="mh" id="mh"  type="text" class="width" value="{%$http.get(mh,0)%}" placeholder="100">
         
                <button type=“submit” class="btn right"  onclick="doList()">开始筛选</button>

            </div>
        </div>
        <div class="number_mainbody">
            {%@content%}
        
            <div class="number_mainbody_footer">
			
                <button type=“button” class="qb"   onclick="SelectAll()">全选</button>
                <button type=“button” class="xzsx" onClick="DownloadAll()">下载</button>
                <span>保存路径：</span>
               <input type="text" name="path" id="path"  class="lujing" value="{%$shell.getData(path)%}" readonly="readonly"/>
                <button type=“button” class="skin" onClick="setPath()">浏览</button>
                <button type=“button” class="open"  onclick="openPath()">打开</button>

            </div>
        </div>
    </div>

</div>
</div>
</body>
</html>