TrainSignManage/WebFrame/bower_components/bootstrap-datepicker/docs/_screenshots/script/screenshot.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* jshint phantom:true, devel:true */
/* Usage: phantomjs screenshot.js in.html out.png */

var sys = require('system'),
    page = new WebPage();
page.viewportSize = {
    width: 800,
    height: 600
};

page.open(sys.args[1], function(status){
    if (status !== 'success'){
        console.log('Bad status: %s', status);
        phantom.exit(1);
    }
    window.setTimeout(function(){
        var box = page.evaluate(function(){
            var lefts, rights, tops, bottoms,
                padding = 10, // px
                selection, show;

            // Call setup method
            if (window.setup)
                window.setup();
            // Show all pickers, or only those marked for showing
            show = $('body').data('show');
            show = show ? $(show) : $('*');
            show
                .filter(function(){
                    return 'datepicker' in $(this).data();
                })
                .datepicker('show');

            // Get bounds of selected elements
            selection = $($('body').data('capture'));
            tops = selection.map(function(){
                return $(this).offset().top;
            }).toArray();
            lefts = selection.map(function(){
                return $(this).offset().left;
            }).toArray();
            bottoms = selection.map(function(){
                return $(this).offset().top + $(this).outerHeight();
            }).toArray();
            rights = selection.map(function(){
                return $(this).offset().left + $(this).outerWidth();
            }).toArray();

            // Convert bounds to single bounding box
            var b = {
                top: Math.min.apply(Math, tops),
                left: Math.min.apply(Math, lefts)
            };
            b.width = Math.max.apply(Math, rights) - b.left;
            b.height = Math.max.apply(Math, bottoms) - b.top;

            // Return bounding box
            return {
                top: Math.max(b.top - padding, 0),
                left: Math.max(b.left - padding, 0),
后面还有 9 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。