◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

“Widget:ProfileCard/total”的版本间的差异

来自少前百科GFwiki
跳转至: 导航搜索
(优化加载)
(根据屏幕剩余空间及调整比例模板自动缩放)
第1行: 第1行:
<includeonly><script type="text/javascript">(window.RLQ=window.RLQ||[]).push(function(){
+
<includeonly><style>
 +
#profilecardview {
 +
    position: fixed;
 +
    top: 0;
 +
    right: 0;
 +
    border: 1px solid grey;
 +
    text-align: center;
 +
    line-height: 50vh;
 +
}
 +
.profilecard img:hover {
 +
    box-shadow: 0 0 12px 2px #eaeaea;
 +
}
 +
</style>
 +
<script type="text/javascript">(window.RLQ=window.RLQ||[]).push(function(){
 
var view = new Image();
 
var view = new Image();
view.setAttribute("width", "1024px");
+
view.id = "profilecardview";
view.setAttribute("height", "760px");
+
view.alt = "加载中";
view.setAttribute("id", "profilecardview");
 
view.style.left = "500px";
 
view.style.position = "fixed";
 
 
view.style.visibility = "hidden";
 
view.style.visibility = "hidden";
view.style.border = "1px solid grey";
+
$("#bodyContent:first").append(view);
document.querySelector("#bodyContent").appendChild(view);
 
  
var card = $(".profilecard").children().children().children("img");
+
var card = $(".profilecard img");
card.mouseover(function(){display(this);});
+
card.mouseover(function() {
card.mouseout(function(){undisplay(this);});
+
    var root = "";
 
+
    var path = this.src.replace(/((https?:)?(\/\/)?www\.gfwiki\.org)/, function(m) {
function display(element){
+
        root = m; return "";
     $(element).css({"boxShadow":"0 0 12px 2px #eaeaea"});
+
     }).split("/").slice(3, 6).join("/");
     var view = document.querySelector("#profilecardview");
+
     view.src = root + "/images/" + path;
     var scrstr = element.getAttribute("src");
+
     var ratioString = $(this).parent()[0].getAttribute("data-aspect-ratio");
     view.setAttribute("src", "http://www.gfwiki.org/images/" + scrstr.slice(14, scrstr.indexOf("/" + Number($(element).width()) +"px")));
+
     var box = this.getBoundingClientRect();
    console.log("http://www.gfwiki.org/images/" + scrstr.slice(14, scrstr.indexOf("/" + Number($(element).width()) +"px")));
+
    if(ratioString && box) {
   view.style.top = parseInt((Number(document.body.offsetHeight) - 760)/2) + "px";
+
        var ratio = ratioString.split(":");
 +
        var imgWidth = parseFloat(ratio[0]);
 +
        var imgHeight = parseFloat(ratio[1]);
 +
        var availWidth = $(document.body).width() - box.right;
 +
        var availHeight = $(document.body).height();
 +
        var scale = Math.min(availWidth/imgWidth, availHeight/imgHeight) * 0.99;
 +
        var width = imgWidth * scale;
 +
        var height = imgHeight * scale;
 +
        view.width = width;
 +
        view.height = height;
 +
        view.style.width = width + "px";
 +
        view.style.height = height + "px";
 +
        view.style.top = (availHeight - height)/2 + "px";
 +
    }
 
     view.style.visibility = "visible";
 
     view.style.visibility = "visible";
}
+
});
function undisplay(element){
+
card.mouseout(function() {
    $(element).css({"boxShadow":"0 0 0px 0px #eaeaea"});
 
    var view = document.querySelector("#profilecardview");
 
 
     view.style.visibility = "hidden";
 
     view.style.visibility = "hidden";
}
+
    view.src = "";
 +
});
 
})</script></includeonly>
 
})</script></includeonly>

2021年8月5日 (四) 19:01的版本