1 Star 3 Fork 2

mojie126/HDCN-PT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
curtain_imageresizer.js 2.38 KB
一键复制 编辑 原始数据 按行查看 历史
mojie126 提交于 2014-12-02 23:47 . 更换为SCEditor编辑器
if (navigator.appName == "Netscape") {
document.write("<style type='text/css'>body {overflow-y:scroll;}<\/style>");
}
var userAgent = navigator.userAgent.toLowerCase();
var is_ie = (userAgent.indexOf('msie') != -1) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
/*
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
*/
function Scale(image, max_width, max_height) {
var tempimage = new Image();
tempimage.src = image.src;
var tempwidth = tempimage.width;
var tempheight = tempimage.height;
if (tempwidth > max_width) {
image.height = tempheight = Math.round(((max_width) / tempwidth) * tempheight);
image.width = tempwidth = max_width;
}
if (max_height != 0 && tempheight > max_height)
{
image.width = Math.round(((max_height) / tempheight) * tempwidth);
image.height = max_height;
}
}
function check_avatar(image, langfolder) {
var tempimage = new Image();
tempimage.src = image.src;
var displayheight = image.height;
var tempwidth = tempimage.width;
var tempheight = tempimage.height;
if (tempwidth > 250 || tempheight > 250 || displayheight > 250) {
image.src = 'pic/forum_pic/' + langfolder + '/avatartoobig.png';
}
}
function Preview(image) {//修复冲突错误
if (!is_ie || is_ie >= 7) {
$('#lightbox').html("<a onclick=\"Return();\"><img src=\"" + image.src + "\" /></a>");
$('#curtain').css({"display": "block"});
$('#lightbox').css({"display": "block"});
}
else {
window.open(image.src);
}
}
function Previewurl(url) {//修复冲突错误
if (!is_ie || is_ie >= 7) {
$('#lightbox').html("<a onclick=\"Return();\"><img src=\"" + url + "\" /></a>");
$('#curtain').css({"display": "block"});
$('#lightbox').css({"display": "block"});
}
else {
window.open(url);
}
}
function findPosition(oElement) {
if (typeof (oElement.offsetParent) != 'undefined') {
for (var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent) {
posX += oElement.offsetLeft;
posY += oElement.offsetTop;
}
return [posX, posY];
} else {
return [oElement.x, oElement.y];
}
}
function Return() {//修复冲突错误
$('#lightbox').html("");
$('#curtain').css({"display": "none"});
$('#lightbox').css({"display": "none"});
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/mojie126/HDCN-PT.git
git@gitee.com:mojie126/HDCN-PT.git
mojie126
HDCN-PT
HDCN-PT
master

搜索帮助