公共文件模块include
首先新建一个include
把所有引入的文件放入公共文件里
function getBaseURL() {
var pathName = window.document.location.pathname;
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
return location.protocol + "//" + location.hostname +
(location.port && ":" + location.port) + projectName + "/";
}
var httpUrl = getBaseURL(); // 公网服务器请求地址
var baseUrl = getBaseURL();
// CSS
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/awesome/css/font-awesome.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-table.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-dialog.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/toastr/toastr.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/select2/select2.min.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/css/jquery.datetimepicker.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/utstyle.css">');
document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/style.css">');
// JS
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery-1.11.3.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/underscore.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/page-jdmc.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/constant.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/js/bootstrap-table.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap-dialog.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.validate.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/toastr/toastr.min.js"></script>');
// select2插件
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/select2.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/i18n/zh-CN.js"></script>');
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/jquery.editable-select.min.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.editable-select.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrapValidator/js/bootstrapValidator.min.js"></script>');
// 滚动条修改
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/mCustomScrollbar/css/jquery.mCustomScrollbar.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mousewheel.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mCustomScrollbar.min.js"></script>');
// 时间控件
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.datetimepicker.full.min.js"></script>');
// 视频播放
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/video-player/mediaelementplayer.css">');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/mediaelement-and-player.min.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/lang/zh-cn.js"></script>')
//layer
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/layer/layer.js"></script>');
// backbone.js
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/backbone.js"></script>');
// vue.js
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/vue/vue.min.js"></script>')
// 公用js
document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/tool.js"></script>');
公共文件模块include的更多相关文章
- thinkphp 的两种建构模式 第一种一个单入口里面定义两个模块,前台和后台,函数控制模块必须function.php前台加载前台模块的汉书配置文件,后台加载后台模块的汉书配置文件,公共文件共用。第二种架构模式两个单入口文件,分别生成两个应用定义define。。。函数可以定义配置文件。。。。
thinkphp 的两种建构模式 第一种一个单入口里面定义两个模块,前台和后台,函数控制模块必须function.php前台加载前台模块的汉书配置文件,后台加载后台模块的汉书配置文件,公共文件共用. ...
- gulp批量打包文件并提取公共文件
gulp是前端开发过程中对代码进行构建的工具,是自动化项目的构建利器. browseriyf是模块化打包工具. 一般情况下,Browserify 会把所有的模块打包成单个文件.单个文件在大多数情况下是 ...
- Node文件模块
在上一篇文章中有提到,Node模块分为核心模块和文件模块,接下来就简单总结一下文件模块. 文件模块则是在运行时动态加载,需要完整的路径分析.文件定位.编译执行过程.速度相比核心模块稍微慢一些,但是用的 ...
- browserify 不打包某些文件或者把公共文件提取出来教程
var gulp = require('gulp') var fs = require("fs") var babelify = require('babelify') var b ...
- 【直接拿来用のandroid公共代码模块解析与分享】の Notification和NotificationManager
本文源代码托管在https://github.com/ASCE1885/asce-common,欢迎fork Android项目做得多了.会发现原来非常多基础的东西都是能够复用,这个系列介绍一些自己项 ...
- 系统中异常公共处理模块 in spring boot
最近在用spring boot 做微服务,所以对于异常信息的 [友好展示]有要求,我设计了两点: 一. 在业务逻辑代码中,异常的抛出 我做了限定,一般只会是三种: 1. OmcException // ...
- ansible文件模块使用
1. 文件组装模块-assemble assemble主要是将多份配置文件组装为一份配置文件. 参数 必填 默认 选项 说明 Backup 否 No Yes/no 是否创建备份文件,使用时间戳 Del ...
- php学习笔记6--php中的文件包含 include,require,include_once,require_once
php中的文件包含 include,require,include_once,require_once 文件包含:是指将一个文件的内容包含进另外一个文件,有利于代码的复用等.php中文件包含指令有4个 ...
- 微信小程序:import导入公共文件方式
wxss: @import "../common/ali_icon.wxss"; wxml: 公共文件(位置:../common/head.wxml)如下---- <temp ...
随机推荐
- bzoj1054: [HAOI2008]移动玩具 状压+爆搜即可
题意:在一个4*4的方框内摆放了若干个相同的玩具,某人想将这些玩具重新摆放成为他心中理想的状态,规定移动时只能将玩具向上下左右四个方向移动,并且移动的位置不能有玩具,请你用最少的移动次数将初的玩具状态 ...
- UVA-10384 The Wall Pushers (IDA*)
题目大意:走迷宫,遇到墙时可以推着墙走,但墙后还是墙时便不能推.求出一条任意的最短路径. 题目分析:这道题出的比较人性,输入的时候便是将四周的墙用二进制数表示好了,其实这样减轻了做题人的负担.IDA* ...
- Linux下weblogic启动报错unable to get file lock的问题
非正常结束weblogic进程导致weblogic无法启动 由于先前服务器直接down掉了,所有进程都非正常的进行关闭了,也就导致了下次启动weblogic的时候报了以下错误:<2012-3-2 ...
- ARIMA模型——本质上是error和t-?时刻数据差分的线性模型!!!如果数据序列是非平稳的,并存在一定的增长或下降趋势,则需要对数据进行差分处理!ARIMA(p,d,q)称为差分自回归移动平均模型,AR是自回归, p为自回归项; MA为移动平均,q为移动平均项数,d为时间序列成为平稳时所做的差分次数
https://www.cnblogs.com/bradleon/p/6827109.html 文章里写得非常好,需详细看.尤其是arima的举例! 可以看到:ARIMA本质上是error和t-?时刻 ...
- Digitalocean+DNSPod搭建Meteor.js博客Telescope.js
1. 什么是Meteor.js 基于Node.js的一个快速开发平台. 简言之,Node.js>Meteor.js 对等于Ruby>Ruby on Rails的关系. 官网:http:// ...
- Python - learn note(1)
1. 下载安装Python 2.7(为了向下兼容以前的版本), Python 3.5(VS2015不支持配置3.6的环境) 教程 需要使用VS2015进行开发,必须勾选上后面两项: 2. VS2015 ...
- Beta阶段第1周/共2周 Scrum立会报告+燃尽图 02
作业要求与 [https://edu.cnblogs.com/campus/nenu/2018fall/homework/2284] 相同 版本控制:https://git.coding.net/li ...
- Transaction ACID (转载)
Transaction 原文出处: 黄勇 Transaction 也就是所谓的事务了,通俗理解就是一件事情.从小,父母就教育我们,做事情要有始有终,不能半途而废.�0�2事务也是这样,不能做一般 ...
- c++的c风格字符串函数的实现
要注意使用断言判断传入的字符串非空. #include <cassert> //求字符串长度 size_t StrLen(const char *str) { assert(str != ...
- scikit-learn 学习笔记-- Generalized Linear Models (一)
scikit-learn 是非常优秀的一个有关机器学习的 Python Lib,包含了除深度学习之外的传统机器学习的绝大多数算法,对于了解传统机器学习是一个很不错的平台.每个算法都有相应的例子,既可以 ...