前端工具文件



function UtileObj() {
    this.Pagination = function (pageTotal, pageCount, currentPage) {
        this.pageNumArray = [];
        var pageStart,pageEnd;
        if (currentPage <= pageCount / 2 + 1) {
            pageStart = 1;
            pageEnd = pageCount;
        } else if (currentPage > pageCount / 2 + 1) {
            pageStart = currentPage - pageCount / 2;
            pageEnd = currentPage + pageCount / 2 - 1;
        }
        // 对pageEnd 进行校验,并重新赋值
        if (pageEnd > pageTotal) {
            pageEnd = pageTotal;
        }
        if (pageEnd <= pageCount) {// 当不足pageNum数目时,要全部显示,所以pageStart要始终置为1
            pageStart = 1;
        }
        for (var i = pageStart; i <= pageEnd; i++) {
            this.pageNumArray.push(i);
        }
        return (this.pageNumArray);
    };
    this.lazyloadJS = function (url) {
        var t = document.createElement("script");
        t.src = url;
        document.body.appendChild(t);
    };
    this.lazyloadCCS = function (url) {
        var t = document.createElement("link");
        t.href = url;
        t.rel = "stylesheet";
        document.body.appendChild(t);
    };
    this.formatTime = function (date, type){
        var date = new Date(date),
         year = date.getFullYear(),
         month = date.getMonth() + 1,
         day = date.getDate(),
         hour = date.getHours(),
         minute = date.getMinutes(),
         second = date.getSeconds();
        switch (type) {
            case 'hh:mm:ss YYYY-MM-dd':
                return hour < 12? 'AM':'PM'+ ' ' +[hour, minute, second].map(this.formatNumber).join(':')+ ' ' + [year, month, day].map(this.formatNumber).join('-');
            case 'dd-MM-YY':
              //   一月:Jan .二月:Feb.三月:Mar. 四月:Apr.五月:May. 六月:Jun.
              // 七月:Jul.八月:Aug.九月:Sept.十月:Oct.十一月:Nov.十二月:Dec.
              var monthCn = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];
                return [day, monthCn[month-1],year].map(this.formatNumber).join('-');
        }
    };
    this.formatNumber = function (n){
        n = n.toString();
        return n[1] ? n : '0' + n
    };
    this.jeDateLinkage = function(timeId) {
        var startTime = {
            multiPane: true,
            onClose: false,
            isClear: false,
            isToday: false,      //是否显示清空
            minDate: '2013-01-01 0:0:0',
            maxDate: $.nowDate({DD: 0}), //最大日期 当前日期的前一天
            format: 'YYYY-MM-DD',
            okfun: function(obj){
                table_param.time = (new Date(obj.val)).getTime();
            },
            clearfun:function(elem, val) {
                table_param.time = '';
            }
        };
        $('#' + timeId).jeDate(startTime);
    };
    this.timeoutLogin = function() {
        var curtime = new Date().getTime(),
          a = sessionStorage.getItem('loginTime') - (-owlzerOBj.G_DDP_SEESION_CHECK);
        if (a < curtime) {
            sessionStorage.clear();
            Q.go('login');
        } else {
            sessionStorage.setItem('loginTime',curtime);
        }
    };
    // 提示框
    this.alertP = function(msg, time) {
        var t = time || 1000,$alertId = $('#alertId');
        $alertId.css('display','block');
        $('#alertId .boostTip').html(msg);
        var a = setTimeout(function () {
            $alertId.css('display','none');
            clearTimeout(a)
        }, t)
    }
}

<!--弹框提示信息-->
<div id="alertId" class="boostTipBox">
  <div class="boostTip"></div>
</div>

/*提示框的样式*/
.boostTipBox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
}
.boostTip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto auto;
  width: 400px;
  height: 128px;
  line-height: 126px;
  text-align: center;
  border: 1px solid #dadada;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 10px #bbb;
}

分页使用
   table_allPages: owlzerOBj.UTILE.Pagination(data.error_info.totalPage, table_param.pageSize, table_param.pageNum)
  <!--分页-->
  <ul id="paginationId" class="carListFy margin_right_64">
  </ul>
 // 分页
var pageList = '';
            $.each(tableObj.table_allPages, function (i, items) {
                pageList += '<li class="carListPage" data-index="' + items + '">' + items + '</li>';
            });
            pageList += '<li id="carListAfter" class="carListAfter"></li><li class="carListPageTo"><span>跳到</span><input type="text" name="goToPage"/></li><li class="carListSure"><span id="goToPage">确定</span></li>';
            // console.log(timeTd + list);
            $pagId.html(pageList);
            $("#paginationId").find(".carListPage").eq(table_param.pageNum - 1).addClass("bluePage").siblings().removeClass('bluePage');
/*分页*/
.carListFy {
  margin: 10px auto 50px;
  display: table
}

.carListFy > li {
  display: table-cell;
  vertical-align: middle
}
.carListPre {
  height: 26px;
  width: 26px;
  border: 1px solid #dadada;
  cursor: pointer;
  background: url(../images/qamgr.png) no-repeat 10px -283px
}
.carListPreFirst {
  background-position: 10px -263px;
}
.carListPage {
  height: 26px;
  min-width: 26px;
  padding: 0 2px;
  cursor: pointer;
  border: 1px solid #dadada;
  color: #27282A;
  text-align: center;
  line-height: 25px
}
.carListAfter {
  height: 26px;
  width: 26px;
  border: 1px solid #dadada;
  cursor: pointer;
  background: url(../images/qamgr.png) no-repeat 10px -323px
}
.carListAfterLast {
  background-position: 10px -303px;
}
.carListPageTo {
  margin-left: 20px
}

.carListPageTo > span {
  color: #686868;
  padding-left: 10px
}

.carListPageTo > input {
  border: 1px solid #dadada;
  width: 40px;
  line-height: 24px;
  padding-left: 5px;
  margin: 0 10px;
}
.carListSure {
  color: #188AE2;
  margin-left: 20px;
  cursor: pointer
}

.margin_right_64 {
  margin-right: 64px
}

.bluePage {
  background: #188AE2;
  color: #fff
}
.bg_e5e9f7 {
  background: #e5e9f7;
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
抓取指定web前端所有文件工具可以使用爬虫技术来实现。一种常用的方式是通过解析网页的HTML源代码来获取相关的文件链接,并通过网络请求下载这些文件。 首先,我们可以使用Python编写一个网络爬虫程序。该程序可以使用第三方库如Requests或是Scrapy来发送HTTP请求并获取响应内容。 接着,我们需要通过解析HTML源代码来提取出所有的文件链接。可以使用Python的正则表达式或是BeautifulSoup等HTML解析库来实现。我们可以根据前端文件的特点设置相应的正则表达式,例如,CSS文件的链接通常以.css结尾,JavaScript文件的链接通常以.js结尾。 在解析HTML源代码时,可以使用正则表达式或是BeautifulSoup的相关方法,如find_all来提取文件的链接,并将它们保存在一个列表中。 最后,我们可以通过网络请求将下载链接对应的文件保存到本地。可以使用Python的Requests库发送GET请求,并将响应内容保存为二进制文件。在保存文件时,需要将文件名从链接中提取出来,并加上适当的路径。 总结起来,抓取指定web前端所有文件工具可以通过编写一个网络爬虫程序来实现。该程序可以使用Python的第三方库发送HTTP请求并获取响应,解析HTML源代码提取文件链接,并通过网络请求将文件保存到本地。我们可以根据前端文件的特点来设置相应的解析规则,以获得准确的文件链接。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值