集成html模板功能。

This commit is contained in:
Renpc-kilig 2020-09-11 16:09:08 +08:00
parent b0e28be372
commit 1f73336f45
25 changed files with 3137 additions and 11 deletions

View File

@ -0,0 +1,43 @@
package com.cm.news.controller.apis.template;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResultData;
import com.cm.news.pojo.vos.template.TemplateVO;
import com.cm.news.service.template.ITemplateService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @ClassName: NewsContentController
* @Description: 新闻内容的存储
* @Author: WenG
* @Date: 2020-04-29 17:02
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "模板接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/template")
public class TemplateController extends AbstractController {
@Autowired
private ITemplateService templateService;
@ApiOperation(value = "跳转模板", notes = "跳转模板接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("totemplate")
public SuccessResultData<String> toTemplate() throws SearchException {
return new SuccessResultData<String>("success");
}
@ApiOperation(value = "请求生成模板接口", notes = "请求生成模板接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("creattemplate")
public SuccessResultData<String> creatTemplate(@RequestBody TemplateVO templateVO) throws SearchException {
return templateService.creatTemplate(templateVO);
}
}

View File

@ -0,0 +1,28 @@
package com.cm.news.pojo.util;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: TemplateProperties
* @Description: 配置模板项目请求地址
* @Author: renpc
* @Date: 2020/09/10 11:21
* @Version: 1.0
**/
@Component
@ConfigurationProperties(prefix = "template")
public class TemplateSystemProperties {
private String creatTemplateUrl;
public String getCreatTemplateUrl() {
return creatTemplateUrl == null ? "" : creatTemplateUrl;
}
public void setCreatTemplateUrl(String creatTemplateUrl) {
this.creatTemplateUrl = creatTemplateUrl;
}
}

View File

@ -0,0 +1,36 @@
package com.cm.news.pojo.vos.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: TeamVO
* @Description: 志愿者团队表
* @Author: WenG
* @Date: 2020-05-13 13:43
* @Version: 1.0
**/
@ApiModel
public class TemplateVO {
@ApiModelProperty(name = "htmlStr", value = "html字符串")
private String htmlStr;
public String getHtmlStr() {
return htmlStr == null ? "" : htmlStr;
}
public void setHtmlStr(String htmlStr) {
this.htmlStr = htmlStr;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"htmlStr\":\"")
.append(htmlStr).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,31 @@
package com.cm.news.service.template;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.news.pojo.dtos.newstypesetting.NewsTypesettingDTO;
import com.cm.news.pojo.vos.newstypesetting.NewsTypesettingVO;
import com.cm.news.pojo.vos.template.TemplateVO;
import java.util.List;
import java.util.Map;
/**
* @ClassName: ITemplateService
* @Description: html模板
* @Author: renpc
* @Date: 2020-09-10 11:16
* @Version: 1.0
**/
public interface ITemplateService {
/**
* 生成htm模板
* @param templateVO
*/
SuccessResultData<String> creatTemplate(TemplateVO templateVO);
}

View File

@ -0,0 +1,52 @@
package com.cm.news.service.template.impl;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
import com.cm.common.result.SuccessResultData;
import com.cm.news.pojo.util.TemplateSystemProperties;
import com.cm.news.pojo.vos.template.TemplateVO;
import com.cm.news.service.BaseService;
import com.cm.news.service.template.ITemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: TemplateServiceImpl
* @Description: html模板
* @Author: renpc
* @Date: 2020-09-10 11:16
* @Version: 1.0
**/
@Service
public class TemplateServiceImpl extends BaseService implements ITemplateService {
@Autowired
private TemplateSystemProperties templateSystemProperties;
@Override
public SuccessResultData<String> creatTemplate(TemplateVO templateVO) {
HttpHeaders httpHeaders = new HttpHeaders();
MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8");
httpHeaders.setContentType(type);
RestTemplate restTemplate = new RestTemplate();
String url = templateSystemProperties.getCreatTemplateUrl();
Map<String, String> requestMap = new HashMap<>();
requestMap.put("htmlStr", templateVO.getHtmlStr());
HttpEntity requestEntity = new HttpEntity(requestMap,httpHeaders);
String responseAsString = restTemplate.postForObject(url, requestEntity, String.class);
System.out.println(responseAsString);
JSONObject jsonObject = JSONObject.parseObject(responseAsString);
return new SuccessResultData<String>(jsonObject.get("data").toString());
}
}

View File

@ -1,11 +1,11 @@
news:
nginxAddress: http://192.168.0.104/ # Nginx地址
nginxAddress: http://192.168.0.111/ # Nginx地址
mainServerAddress: # 门户服务器地址
serverAddress: http://192.168.0.104:8082/news/ # 新闻服务器地址
serverAddress: http://192.168.0.111:8082/news/ # 新闻服务器地址
server:
port: 8082
url: http://192.168.0.104:8082/news
url: http://192.168.0.111:8082/news
title: news
servlet:
context-path: /news
@ -29,7 +29,7 @@ spring:
db-type: mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
password: admin
password: 123456
initial-size: 2
min-idle: 2
max-active: 5
@ -79,18 +79,18 @@ security:
oauth-server: https://www.wgink.ink/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: b05e18273f824e40883c0405a10da0f4
client-secret: dG5uQ3FDVEI1VUpZOER3bDFpMnc4SlJlOERCbzhSaS9LNVE0MmI1T3BpTW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg
user-authorization-uri: ${security.oauth2.oauth-server}/oauth/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth/token
client-id: 3e5048ffa21449ee8ffd033457dbcdb6
client-secret: blJjQjNNSXFTQ3dlcGhaVnhjS1dBZkpEN01teHozeTZFVFF6RVVFTnFXRW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
grant-type: authorization_code
resource:
jwt:
key-uri: ${security.oauth2.oauth-server}/oauth/token_key
token-info-uri: ${security.oauth2.oauth-server}/oauth/check_token
key-uri: ${security.oauth2.oauth-server}/oauth_client/token_key
token-info-uri: ${security.oauth2.oauth-server}/oauth_client/check_token
user-info-uri: ${security.oauth2.oauth-server}/user
authorization:
check-token-access: ${security.oauth2.oauth-server}/oauth/token_key
check-token-access: ${security.oauth2.oauth-server}/oauth_client/token_key
api-path:
user-center: ${security.oauth2.oauth-server}
@ -126,3 +126,8 @@ logging:
level:
root: error
com.cm: debug
# 访问其他项目
template:
titile: 模板项目
creatTemplate-url: http://192.168.0.111:8081/template/resource/template/creattemplaterelease

View File

@ -0,0 +1,25 @@
/*样式重置*/
body,div,p,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,form,span,a,img{margin: 0;padding: 0;}
a{text-decoration: none;}img{border: 0px;}li{list-style: none;}
body{background: #f1f1f1;}
/*默认样式*/
h1{font-size: 28px;}
h2{height: 36px;padding: 0 0 0 10px;overflow:hidden;font-size: 20px;font-weight:normal;line-height: 36px;color: #333;font-family: '微软雅黑';}
p,li{line-height: 24px;font-size: 14px;color: #555;}
p{padding: 5px;text-indent: 2em;}
ul{padding: 5px;}
ul li{list-style: inside;}
ul li a{color: #444;}
ul li a:hover{text-decoration: underline;}
.row:after{content: '.';visibility: hidden;display: block;clear: both;height: 0;}
.row{}
.row .col{float: left;width: 100%;min-height: 50px;}
.row .col-50{width: 50%;}
.row .col-50 .lyrow{border-right: #cfcfcf 1px solid;}
.row .col-50 .box,.row .col-50 .wdg{border-right: #eaeaea 1px solid;}
.row .col-33{width: 33.3%;}
.row .col-25{width: 25%;}
.row .col-20{width: 20%;}

View File

@ -0,0 +1,238 @@
/*reset styles*/
/*========gallery========*/
.Gallery{
position: relative;
zoom: 1;
}
.Gallery .slide-wrap{
width: 100%;
overflow: hidden;
}
.Gallery ul{padding: 0;}
.Gallery li{
float: left;
line-height: auto;
list-style: none;
}
.Gallery li a{ display: block;}
.Gallery .imgs-container{
overflow: hidden;
zoom: 1;
}
.Gallery .shadow{
width: 100%;
position: absolute;
bottom: 0;
background: #000;
opacity: 0.4;
filter:alpha(opacity=40);
}
.Gallery .titles{
position: absolute;
bottom: 10px;
left: 10px;
overflow: hidden;
padding: 0;
text-indent: 0;
}
.Gallery .titles a
{
color: #fff;
font-size: 14px;
text-decoration: none;
display: none;
}
.Gallery .titles a.curInfo{
display: inline;
}
.Gallery .buttons{
position: absolute;
bottom: 14px;
right: 8px;
zoom: 1;
}
.Gallery .buttons a{
display: block;
width: 10px;
height: 10px;
margin-right: 5px;
font-family: "微软雅黑",宋体, sans-serif;
font-size: 14px;
line-height: 14px;
/*font-weight: bold;*/
color: #916330;
text-indent:-10em;
text-align: center;
overflow:hidden;
background:#fafafa;
}
.Gallery .buttons a{
border-radius:50px;
-moz-box-shadow:1px 1px 1px #A9A9A9 inset;
-webkit-box-shadow:1px 1px 1px #A9A9A9 inset;
box-shadow:1px 1px 1px #A9A9A9 inset;
}
.Gallery .buttons a.on{
background-color: #b6d5e8;
-moz-box-shadow:1px 1px 1px #974b00 inset;
-webkit-box-shadow:1px 1px 1px #974b00 inset;
box-shadow:1px 1px 1px #974b00 inset;
background:#ff9626;
}
.Gallery .img-btns{
position: absolute;
}
.Gallery .img-btns a{
margin-right: 5px;
padding: 4px;
}
.Gallery .img-btns a.on{
background: #ff9626;
}
.Gallery .square a{
border-radius: 0px;
font-size: 12px;
}
.Gallery .hasTxt{
position: absolute;
bottom: 12px;
right: 10px;
zoom: 1;
}
.Gallery .hasTxt a{
text-indent: 0;
width: 14px;
height: 14px;
line-height: 14px;
color: #888;
box-shadow:none;
background: #fff;
-moz-box-shadow:0px 1px 2px #333;
-webkit-box-shadow:0px 1px 2px #333;
box-shadow:0px 1px 2px #333;
}
.Gallery .hasTxt a.on{
box-shadow: none;
color: #fff;
}
.Gallery .prev-btn,
.Gallery .next-btn{
color: #fff;
font-size: 30px;
text-align: center;
font-weight: bold;
font-family: 宋体, sans-serif;
width: 36px;
height: 34px;
background: #000;
opacity: 0.4;
filter:alpha(opacity=40);
position: absolute;
z-index: 999;
display: none;
}
.Gallery a.prev-btn:hover,
.Gallery a.next-btn:hover{
opacity: 0.9;
filter:alpha(opacity=80);
background: #ff9626;
}
.Gallery .prev-btn{
left: 0;
top: 38%;
}
.Gallery .next-btn{
right: 0;
top: 38%;
}
.Gallery .no-fade{
display: block;
}
.Gallery .arrows-out{
position: absolute;
top: -32px;
right: 0px;
height: 20px;
line-height: 20px;
}
.Gallery .arrows-out a{
border-radius: 25px;
width: 20px;
height: 20px;
line-height: 20px;
font-size: 14px;
display: block;
position: relative;
left: 0;
top: 0;
float: left;
}
.Gallery .arrows-out span{
display: block;
width: 20px;
height:22px;
font-size: 14px;
font-family: '微软雅黑';
color: #888;
float: left;
}
.Gallery .arrows-out span.curNum{
width: 14px;
color: #555;
text-align: right;
}
/*styles for demo
*使用插件时,demo的html标签和样式都可以为去掉
*/
.wrapper{
width: 758px;
padding: 20px 0 0 20px;
border: #c0c0c0 1px solid;
background: #fff;
margin: 50px auto;
overflow: hidden;
zoom: 1;
/*box-shadow: 0px 3px 8px rgba(0,0,0,0.3);*/
}
.wrapper h1{
height: 30px;
line-height: 30px;
font-size: 24px;
text-align: center;
margin: 0;
}
.Demo01,.Demo04{
float: left;
padding: 8px;
border: #cfcfcf 1px solid;
width: 720px;
background: #fff;
margin: 20px auto;
box-shadow: 0px 2px 4px rgba(0,0,0,0.2);
}
.Demo02,.Demo03{
float: left;
padding: 0px 8px 8px 8px;
border: #cfcfcf 1px solid;
width: 340px;
background: #fff;
margin: 20px auto;
box-shadow: 0px 2px 4px rgba(0,0,0,0.2);
}
.Demo03{
padding-top: 10px;
margin: 52px 0 0 20px;
}
.Demo02 h2,.Demo03 h2{
height: 42px;
line-height: 42px;
font-size: 18px;
font-family: '微软雅黑';
font-weight: normal;
color: #333;
}

View File

@ -0,0 +1,96 @@
.bigpicker{
width:227px;
height:163px;
position: absolute;
z-index: 9999;
background-color: #F0F0F0;
padding: 2px 0 1px 5px;
border-left: solid 1px #CCCCCC;
border-top: solid 1px #CCCCCC;
border-right: solid 1px #565656;
border-bottom: solid 1px #565656;
display: none;
}
.bigpicker .nocolor{
display: block;
width:17px;
height: 17px;
margin: 2px 0 0;
background: url(../img/nocolor.png) no-repeat;
}
.bigpicker .nocolor:hover{
background: url(../img/nocolor_over.png) no-repeat;
}
.bigpicker-sections-color{
margin: 0;
padding: 0;
}
.bigpicker-sections-color ul{
margin: 0;
padding: 0;
float: left;
}
.bigpicker-sections-color ul li{
list-style: none outside none;
margin: 0;
padding: 0;
border-top:solid 1px #000000;
border-left:solid 1px #000000;
width:10px;
height: 10px;
overflow:hidden;
line-height:0px;
font-size:0px;
}
.bigpicker .biglayout{
width:10px;
height:10px;
border:solid 1px #FFFFFF;
position: absolute;
z-index: 10000;
display: none;
line-height: 10px;
overflow: hidden;
cursor: default;
}
.bigpicker-bgview-text{
margin: 0;
padding: 0;
height: 24px;
}
.bigpicker-bgview-text li{
padding: 0 5px 0 0 ;
list-style: none outside none;
float: left;
line-height:18px;
}
.bigpicker-bgview-text li div{
margin: 0;
padding: 0;
height: 20px;
width: 55px;
background-color: #000000;
border-left: solid 1px #CCCCCC;
border-top: solid 1px #CCCCCC;
border-right: solid 1px #2B2B2B;
border-bottom: solid 1px #2B2B2B;
}
.bigpicker-bgview-text li input{
margin: 0;
padding: 0;
height: 17px;
width: 55px;
}
.bigpicker-bgimage{
background-image:url(../img/big_bgcolor.jpg);
}

View File

@ -0,0 +1,129 @@
/**/
body{background: #f1f1f1;}
/**/
.file-btns{overflow: hidden;zoom: 1;background: #383c42;position: absolute;left:0;top:0;width: 100%;}
.file-btns .logo-sec{float: left;padding-left: 15px;height: 34px;}
.file-btns .logo-sec a{font-size: 18px;font-family: '微软雅黑';font-weight:bold;color: #fff;line-height: 34px;text-indent: -999em; }
.file-btns ul{float: right;padding: 0;}
.file-btns li{display: block;float: left;}
.file-btns li a{display: block;color: #e1e2e5;padding: 5px 8px;border-left: #3f4248 1px solid;border-right: #32353b 1px solid;font-size: 14px;font-family: '微软雅黑';}
.file-btns li a:hover{background: #25282d;border-left-color: #26282d;border-right-color: #26282d;color: #fff;text-decoration: none;}
.file-btns li a.active{background: #f1f1f1;color: #26282d;font-weight: bold;}
/*===========*/
.side-bar{position: absolute;left: 0;top: 0;width: 100px;background: #383c42;float: left;}
.side-bar .logo a{display:block;height: 34px;line-height: 34px;font-size: 24px;color: #fff;font-family: '微软雅黑';font-weight: bold;text-align: center;border-bottom: #32353b 1px solid;border-right: #32353b 1px solid;padding-bottom: 20px}
.top-nav{padding: 0;}
.top-nav li{display: block;zoom: 1;}
.top-nav li a{display: block;padding-left:20px;position: relative;height: 36px;line-height: 36px;text-align: center;zoom: 1;
font-family: '微软雅黑';font-size: 14px;color: #fff;border-top: #3f4248 1px solid;border-bottom: #32353b 1px solid;
background:url(../img/icons.gif) 18px 0 no-repeat;}
.top-nav li .view ul li{line-height: 24px;}
.top-nav li .view ul li a{display: inline;font-weight: normal;font-size: 14px;color: #444;font-family: '宋体';border: none;padding: 0;background: none;line-height: 24px;}
.top-nav li a:hover,
.top-nav li a.open{background: #292c32 url(../img/icons.gif) 18px 0 no-repeat;border-top-color: #292c32;border-bottom-color: #282a30;text-decoration: none;}
.top-nav li .elements,.top-nav li .elements.open,.top-nav li .elements:hover{background-position: 18px -36px;}
.top-nav li .widgets,.top-nav li .widgets.open,.top-nav li .widgets:hover{background-position: 18px -72px;}
.sub-nav{padding: 0;border-bottom: #32353b 1px solid;display: none;}
.sub-nav li span{border-bottom: #3f4248 1px solid;}
.sub-nav li.last span{border-bottom: none;}
.sub-nav .lyrow,.sub-nav .box,.sub-nav .wdg{position: relative;background: #2e343b;}
.sub-nav .wdg .slider{width: 100%;}
.sub-nav .ctrl-btns{position: absolute;right: 6px;top: 8px;}
.sub-nav .ctrl-btns .edit,.sub-nav .ctrl-btns .drag,.sub-nav .ctrl-btns .remove{display: none;}
.sub-nav .ctrl-btns .drag{background: #1a1e27;font-size: 12px;color:#bbb;padding: 2px 5px;border: #161921 1px solid;float:left;cursor: pointer;line-height: 14px;}
.sub-nav .preview{display: block;padding-left:18px;height: 34px;line-height: 34px;text-align:center;font-size: 14px;font-family: '微软雅黑';color: #cfcfcf;cursor: move;}
.sub-nav .view{display: none;}
.sub-nav .view .slider ul{padding: 0;position: relative;width: 400px;height: 200px;}
.sub-nav .view .slider ul li{position: absolute;left: 0;top: 0;}
.sub-nav .view .slider ul li img{width: 400px;height: 200px;}
.sub-nav .view img{width: 400px;height: 200px;}
.sub-nav .slider li a{border: none;padding: 0;background: none;height: 200px;}
/*============*/
.doc-wrap{padding: 20px;background: #f1f1f1;margin: 34px 0 0 100px; }
.scroll{overflow-y:scroll;}
.demo{min-height: 200px;padding: 5px 15px 15px 15px;border: #ddd 1px solid;background: #f5f5f5;}
/*公共*/
.sub-nav .ui-draggable-dragging{padding:5px;border: #cacaca 1px solid;background: #dfdfdf;z-index: 999;}
.sub-nav .ui-draggable-dragging .preview{display:inline;background: none;border: none;color: #000;padding-left: 0px;}
/*.sub-nav .ui-sortable-helper .preview{display: none;}*/
.ui-draggable-dragging .remove{display: none;}
.ui-draggable-dragging .drag{right: 8px;top: 8px;background: #555;border-color: #444;}
.ui-draggable-dragging .view{ display:block;}
.demo .lyrow{position: relative;background: #eaeaea;border: #cfcfcf 1px solid;margin: 10px auto 0 auto;}
.demo .lyrow .lyrow{border-top:#cfcfcf 1px solid;}
.demo .preview{display: none;}
.demo .resizable{position: relative;}
.demo .resizable .resize-handle{border-left: #aaa 1px dashed;cursor: e-resize;position: absolute;right: 0;bottom: 0;width: 0px;height: 100%;padding: 0 2px;z-index: 999;}
.demo .ctrl-btns{position: absolute;right: 2px;top: 2px;}
.demo .ctrl-btns .edit,
.demo .ctrl-btns .remove,
.demo .ctrl-btns .drag{display: none;margin-left:2px;float:left;background:#dd7e6b;padding: 2px 5px;color: #f3f3f3;font-size: 12px;border: #c86956 1px solid;cursor: pointer;}
.demo .ctrl-btns .drag{background: #828282;border-color: #6d6d6d;display: none;}
.demo .ctrl-btns .edit{background: #78a5c9;border-color:#5089b7;display: none;}
.demo .ctrl-btns .edit:hover{background: #5790bd;border-color: #3a709b;}
.demo .remove:hover{background: #d1553d;color: #fff;border-color: #ba4832;}
.demo .drag:hover{background: #636363;color: #fff;border-color:#4c4c4c; }
.demo .show .edit,.demo .show .remove,.demo .show .drag{display: block;}
.demo .lyrow .ctrl-btns{z-index: 1000;}.demo .box .ctrl-btns,.demo .wdg .ctrl-btns{z-index: 999;}
.demo .preview{display: none;}
.demo .view img{width: 200px;height: 100px;}
.source-preview .demo .show {display: none;}
.demo .box,.demo .wdg{position: relative;border-bottom:#eaeaea 1px solid;background: #fff;}
.demo .ui-sortable-placeholder{ border: #383C42 1px dashed;visibility: visible!Important;z-index: 99;background: none;}
.row .col .ui-sortable-placeholder{border: #b0b0b0 1px dashed;}
.demo .box .remove{right: 3px;top: 3px;}
.demo .box .drag{right: 41px;top: 3px;}
.demo .wdg .remove{right: 2px;top: 2px;}
.demo .wdg .drag{right: 40px;top: 2px;}
/**/
.source-preview{background: #fff;}
.source-preview .file-btns li a.active{background: #fff;}
.source-preview .logo-sec a{text-indent: 0;}
.source-preview .doc-wrap{margin-left: 0;background: #fff;}
.source-preview .doc-wrap .demo{border: none;background: none;}
.source-preview .demo .lyrow,
.source-preview .demo .box,
.source-preview .demo .wdg{border: none;background: none;}
.source-preview .demo .resize-handle{display: none;}
.modals{position: absolute;left:0;top:0;width: 100%;height:100%;background: rgba(33, 36, 46, 0.4);display: none;z-index: 999;}
.modals .modal{background: #fff;position: absolute;left: 30%;top: 25%;box-shadow: 0px 1px 5px rgba(0,0,0,0.4);-webkit-box-shadow: 0px 1px 4px rgba(0,0,0,0.4);display: none;}
.modals .modal .close{display: block;width: 15px;height: 15px;line-height:15px;border-radius:7px;color: #efefef;font-size: 10px;font-family:'微软雅黑';text-align: center;position: absolute;right: 8px;top: 8px;}
.modals .modal .close:hover{color: #fff;font-weight: bold;}
.modals .modal .tab-pane{background: #383C42;overflow: hidden;zoom: 1;padding: 0 50px 0 0;}
.modals .modal .tab-pane a{display: block;padding:0 15px;height: 30px;line-height: 30px;color: #fff;
font-size: 16px;text-align: center;float: left;font-size: 14px;}
.modals .modal .tab-pane a.on{background: #fff;color: #555;font-weight: bold;}
.modals .modal .tab-content .tc{display: none;font-size: 14px;padding-top: 15px;min-width: 230px;}
.modals .modal .tab-content .active{display: block;}
.edit-layer table{border-collapse: collapse;width: 100%;}
.edit-layer table td{vertical-align:text-top;padding: 8px 5px 8px 15px;vertical-align: middle;border-bottom: #cfcfcf 1px solid;border-top: #cfcfcf 1px solid;
font-size: 14px;color: #383C42;font-weight: bold;}
.edit-layer table td div{padding: 0;text-indent: 0;font-size: 12px;height: 28px;line-height: 28px;}
.edit-layer table td .float{float: left;margin-right: 10px;}
.edit-layer table label{display: block;float: left;height: 28px;line-height: 28px;color: #666;}
.edit-layer table p{margin: 0;padding: 0;float: left;position: relative;text-indent: 0;margin-top: 3px;}
.edit-layer table input{display: block;height:20px;margin: 0;padding:0;border: 0px;border: #bfbfbf 1px solid;}
.edit-layer table select{margin: 0;padding: 0;color: #555}
.edit-layer table option{color: #555;}
.edit-layer table span{display: block;width: 20px;height: 20px;border-left: #bfbfbf 1px solid;background: #cfcfcf;position: absolute;top: 1px;right: 1px;line-height: 20px;color: #777;text-align: center;}
.edit-layer table .size{width: 80px;}
.edit-layer table .color-picker{width: 60px;}
.edit-layer table .hidden{display: none;}
.edit-layer .submit{text-align: center;background: #dfdfdf;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,446 @@
/*=================可编辑样式====================*/
var Data={
type:{
head:{css:['size','background','border','text']},
paragraph:{css:['size','background','border','text']},
list:{css:['size','background','border','text']},
image:{css:['size','border']},
gallery:{css:[]}
}
};
// function(cssArr){
// var i=0,l=cssArr.length,html;
// for(i;i<cssArr.length;i++){
// switch (cssArr[i]){
// case 'align':
// }
// }
// }
/*=============================================*/
$(function(){
/*
**获取本地存储并填充
*/
var demo=$('.demo'),
htmlData;
function supportstorage() {
if (typeof window.localStorage=='object')
return true;
else
return false;
};
function clearResizeHtml(){//填充之前清除之前resize时动态增加的html 避免重新初始化时冲突
$('.ui-resizable').removeClass('ui-resizable');
$('.ui-resizable-handle').remove();
};
function restoreData(){
if (supportstorage()) {
htmlData = JSON.parse(localStorage.getItem("htmlData"));
if(!htmlData){
htmlData={count:0,step:[demo.html()],css:''};
return false;
};
if(!htmlData.count){return false;}
demo.html(htmlData.step[htmlData.count]);
clearResizeHtml();
$('#css-wrap').text(htmlData.css)
}
};
function reBuild(e){
var html='<div><ul>'+$('ul',e).html()+'</ul></div>',
p=e.parent(),
w=p.width(),
h=w/2;
e.empty()
.data('gallery',null)
.removeClass()
.addClass('slider')
.html(html)
.gallery({height:h,width:w});
}
function reSlide(wrap,reb){
box=wrap?wrap:demo;
$.each($('.slider',box),function(k,v){
if(reb){reBuild($(this));}
else{
var h=$(this).parent().width()/2;
$(this).gallery({height:h});
}
});
}
restoreData();
//尺寸调整
var docWindow=$(window),
wrap=$('.doc-wrap'),
sideBar=$('.side-bar'),
mp=parseInt(wrap.css('paddingTop'))
+parseInt(wrap.css('paddingTop'))
+parseInt(wrap.css('marginTop')),
resizeTid=null;
function modalMove(){
$('.modal:visible').each(function(){
$(this).css({left:($(window).width()-$(this).width())/2});
})
}
function heightChe(r){
if(demo.innerHeight()>wrap.height()){
wrap.addClass('scroll');
resizeInit($('.row',demo).data('resize',0));
reSlide(demo,1);
}else{
if(wrap.hasClass('scroll')){
wrap.removeClass('scroll');
reSlide(demo,1)
}else{
r && reSlide(demo,1);
};
r && resizeInit($('.row',demo).data('resize',0));
}
};
function sizeInit(){
var H=docWindow.height();
sideBar.css('height',H);
wrap.css('height',H-mp);
modalMove();
heightChe(1)
resizeTid=null;
};
document.onselectstart=function(){return false;};
sizeInit();
docWindow.on('resize',function(){
resizeTid && clearTimeout(resizeTid);
resizeTid=setTimeout(sizeInit,50);
});
//左侧菜单折叠
var topNav=$('.top-nav'),
subNav=$('.sub-nav');
$('.top-nav>li>a')
.on('click',function(e){
e.preventDefault();
e.stopPropagation()
var menuList=$(this).next();
if(menuList.css('display')=='block'){
menuList.slideUp('fast');
$(this).removeClass('open');
}else{
$(this).addClass('open');
menuList.slideDown('fast');
}
});
/*
**拖拽及排序:
**变量&&绑定&&初始化
**控制按钮组
*/
var drag=0,
sort=0,
selector='.lyrow,.box,.wdg',
body=$('body').addClass('edit'),
idNames=[];
function setId(eleName){
$.each($('.'+eleName,demo),function(k, v){
var child=$('.view',v).children();
if(!child.attr('id')){child.attr('id',eleName+(new Date()).getTime())}
})
};
function htmlRec(del,eleName){
eleName && setId(eleName);
var html=demo.html(),
data=htmlData;
data.count++;
if(del){ data.step.push(html);heightChe();return false;}
!drag && !sort && data.step.push(html);
heightChe();
};
function initContainer(){
var opts={
connectWith: '.col',
opacity: .5,
handle: '.drag',
start: function(e,t) {(sort===0) && (sort++)},
stop: function(e,t) {sort--;drag || htmlRec();}
},opts2=$.extend({},opts,{
stop: function(e,t) {
sort--;
if(!drag){htmlRec();}
}
});
demo.sortable(opts);
$('.col',demo).sortable(opts2);
};
function resizeInit(rows){
$.each(rows,function(){
if(!$(this).data('resize')){
var row=$(this).addClass('resizable'),
cols=$('.col',row),
rWidth=row.width(),
dis=(100/$('.col',row).length).toFixed(1);
$.each(cols,function(k,v){
var col=$(v),
next=col.next();
if(next.length){
var drag;
if(!next.hasClass('resize-handle')){
drag=$('<div></div>').addClass('resize-handle').insertAfter(col).css('left',(k+1)*dis+'%');
}else{drag=col.next()}
var prevs=drag.prevAll('.resize-handle'),
prev=prevs.eq(0),
len=prevs.length,
nextCol=drag.next();
drag.iqlDrag({
ready:function(opts){
opts.max=parseInt(drag.css('left'))+nextCol.width(),
opts.min=(len)?parseInt(prev.css('left')):0;
},
upCall:function(o,l,max,min){
o.css('left',(l/rWidth*100).toFixed(1)+'%');
col.css('width',((l-min)/rWidth*100).toFixed(1)+'%');
nextCol.css('width',((max-l)/rWidth*100).toFixed(1)+'%');
reSlide(row,1);
htmlRec();
}
});
}
});
$(this).data('resize',1);
}
})
};
//排序初始化
initContainer();
//左侧拖拽&&右侧排序
$('.sidebar-nav .lyrow').draggable({
connectToSortable: '.demo',
helper: 'clone',
opacity: .5,
start: function(e,t) {drag++;},
drag: function(e,t) {t.helper.width(400);},
stop: function(e,t) {
drag--;
htmlRec(0,'lyrow');
var cols=$('.col',demo);
cols.sortable({
opacity: .5,
connectWith: '.col',
handle:'.drag',
start: function(e,t) {(sort===0) && (sort++)},
stop: function(e,t) {
sort--;
if(!drag){
reSlide(t.item.eq(0),1);
htmlRec();
}
}
});
resizeInit($('.row',demo));
t.helper.attr('id','idname')
}
});
$('.sidebar-nav .box').draggable({
connectToSortable: '.col',
helper: 'clone',
opacity: .5,
start: function(e,t) {drag++},
drag: function(e,t) {t.helper.width(400);},
stop: function(e,t) {drag--;htmlRec(0,'box');}
});
$('.sidebar-nav .wdg').draggable({
connectToSortable: '.col',
helper: 'clone',
opacity: .5,
start: function(e,t) {drag++},
drag: function(e, t) {t.helper.width(400)},
stop: function() {
reSlide();
drag--;
htmlRec(0,'wdg');
}
});
//按钮组件相关
function fadeOut(){
$('.modals').fadeOut(100, function() {
$(this).find('.edit-layer').hide();
});
}
$('.tabs').tinyTab();
demo
.on('click','.remove',function(e) {
e.preventDefault();
$(this).parent().parent().remove();
htmlRec(true);
idNames.push($(this).parent().next().children().attr('id'));
})
.on('click','.edit',function(e) {
e.preventDefault();
var p=$(this).parent().parent(),
type=p.data('type'),
idName=$(this).parent().next().children().addClass('editing').attr('id');
$('.modals').fadeIn(200, function() {
var layer=$('.edit-layer',this),
css=Data['type'][type]['css'].join(','),trs=$('tr',layer).removeClass('hidden'),len=trs.length-1,i;
for(i=0;i<len;i++){
if(css.indexOf(trs[i].className)===-1){trs.eq(i).addClass('hidden')}
};
layer.css({left:($(window).width()-layer.width())/2}).fadeIn(100);;
});
});
$('.edit-layer .close').click(function(e){
e.preventDefault();fadeOut();return false;
})
$('.css-edit button').click(function(e){
e.preventDefault();
var eles=$('input,select',$('.css-edit form')),
len=eles.length,
cssStr='',
editing=$('.editing'),
Id='#'+editing.attr('id'),
cssTxt=$('#css-wrap').text();
for(var i=0;i<len;i++){
var t=eles.eq(i);
if(!!t.val() && (t.attr('type')!='submit')){
var px=(t.next().text()=='px')? 'px':'';
cssStr+=t.attr('name')+':'+t.val()+px+';';
}
};
if(cssStr){
cssStr=Id+'{'+cssStr+'}\n';
if(cssTxt.indexOf(Id)!==-1){
var pattern=Id+'\\S*\\n';
cssTxt=cssTxt.replace(new RegExp(pattern),cssStr);
}else{
cssTxt+=cssStr;
};
$('#css-wrap').text(cssTxt);
editing.removeClass('editing');
};
fadeOut();
return false;
});
$(".color-picker").bigColorpicker(function(el,color){$(el).val(color);});
$('.edit .demo')
.on('mouseover',selector,function(e){
e.stopPropagation();
$(this).children('.ctrl-btns').addClass('show');
})
.on('mouseleave',selector,function(){
$(this).children('.ctrl-btns').removeClass('show');
})
.on('mouseout',selector,function(){
$(this).children('.ctrl-btns').removeClass('show');
});
/*
**顶部操作按钮
**编辑-预览-撤销-重做-清空-下载-保存
*/
var topBtns=$('.file-btns'),
cN={e:'edit',sp:'source-preview',ac:'active'};
function uiAlt(e){
var data=e.data,
ac=cN.ac,
x=(data.cN1===cN.sp)? 1:0;
e.preventDefault();
topBtns.find('.active').removeClass(ac);
$(this).addClass(ac);
x && body.removeClass(data.cN1).addClass(data.cN2);
sideBar.animate({left:data.lv},180,function(){
!x && body.removeClass(data.cN1).addClass(data.cN2);
reSlide(demo,1);
});
return false;
};
function reWrite(e){
e.preventDefault();
var data=htmlData,
id=$(this).attr('id');
if((id==='back') && (data.count!==0)){
data.count-- ;
}else{
if((id==='forward') && (data.count<(data.step.length-1))){data.count++}else{
return false;
}
};
$('.demo').html(data.step[data.count]);
initContainer();
resizeInit($('.row',demo));
reSlide(demo,1);
};
function saveLayout(){
var data = htmlData,
len=data.step.length,
count=data.count,
n;
if (len>count) {
n=len-count;
data.step.splice(count+1,len-count+1)
};
data['css']=$('#css-wrap').text();
if (supportstorage()) {
localStorage.setItem("htmlData",JSON.stringify(data));
}
}
function getCss(){};
$('#edit').on('click',{cN1:cN.sp,cN2:cN.e,lv:0},uiAlt);
$('#preview').on('click',{cN1:cN.e,cN2:cN.sp,lv:-100},uiAlt);
$('#back').on('click',reWrite);
$('#forward').on('click',reWrite);
$('#clean-up').on('click',function(e){
e.preventDefault();
demo.empty();
htmlData={count:0,step:[demo.html()]}
});
var resultData = {};
$('#save').on('click',function(e){
e.preventDefault();
saveLayout();
var style = $('#css-wrap').text()
style += '.preview, .ctrl-btns{display: none}'
var p='<html>' +
'<head>' +
'<title>html</title>' +
'<link rel="stylesheet" type="text/css" href="css/default.css">' +
'<link rel="stylesheet" type="text/css" href="css/layout.css">' +
'<link rel="stylesheet" type="text/css" href="css/jquery-gallery.css"/>' +
'<link rel="stylesheet" type="text/css" href="css/jquery.bigcolorpicker.css"/>' +
'<style type="text/css">' + style + '</style>' +
'<scr'+'ipt type="text/javascript" src="js/jquery-2.0.0.min.js"></scr'+'ipt>' +
'<scr'+'ipt type="text/javascript" src="js/jquery-ui.js"></scr'+'ipt>' +
'<scr'+'ipt type="text/javascript" src="js/jquery.bigcolorpicker.js"></scr'+'ipt>' +
'<scr'+'ipt type="text/javascript" src="js/widgets.js"></scr'+'ipt>' +
'<scr'+'ipt type="text/javascript" src="js/bases.js"></scr'+'ipt>' +
'</head>' +
'<body>'+$('.demo').html()+'</body>' +
'</html>';
var data = {"htmlStr": p}
top.restAjax.post(top.restAjax.path('api/template/creattemplate', []), data, null, function(code, successData) {
resultData = successData;
console.log(resultData.data)
downloadFun(resultData.data);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
function downloadFun(id) {
window.open('http://192.168.0.111:8081/template/route/file/downloadfile/false/' + id, 'aaa.html');
}
})

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,295 @@
/************
* name: jquery-gallery
* version: 2.0
* date: 2014-02-24
* author: kevin
* github: https://github.com/FishBooy
* email: qwk.love@gmail.com
*
**************/
;(function($) {
/*====构造函数====*/
var Gallery = function(opts, gallery) {
this.opts = $.extend({}, this.defaultOpts, opts ? opts : {});
this.gallery = gallery.addClass('Gallery');
this.slideWrap = $('div',this.gallery).addClass('slide-wrap');
this.setData();
this.eventsBind();
}
/*====对象属性以及方法====*/
//滑动算法
Gallery.prototype.Tween = {
Quart: {
easeOut: function(t, b, c, d) {
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
}
},
Back: {
easeOut: function(t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
}
},
Bounce: {
easeOut: function(t, b, c, d) {
if ((t /= d) < (1 / 2.75)) {
return c * (7.5625 * t * t) + b;
} else if (t < (2 / 2.75)) {
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
} else if (t < (2.5 / 2.75)) {
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
} else {
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}
}
}
};
//默认参数
Gallery.prototype.defaultOpts = {
width:0,
height:0,
animation: 'slide',
shaHeight: 42,
hasTitle: true,
hasArrow: true,
arrType: 'inside',
arrAni: true,
hasBtn: true,
btnType: 'btn',
btnBorder: 8,
btnShape: '',
btnsMar: 40,
btnMar: 5,
btnTxt: false,
auto: true,
duration: 40,
pause: 3000,
interval: 10,
onStart: function() {},
onFinish: function() {}
};
//完善当前dom并将各主要元素的jquery对象与对象属性相对应
Gallery.prototype.setData = function() {
var bHtml = '',
tHtml = '',
btnStr = '',
btnsWidth,
gallery=this.gallery,
img=$('img', gallery);
this.mounts = img.length;
this.width = (this.opts.width)? this.opts.width:gallery.width();
gallery.css('width',this.width);
this.imgsContainer = $('ul', gallery).addClass('imgs-container').css('width', this.mounts * this.width);
this.height = (this.opts.height)? this.opts.height:gallery.height();
this.images = img.css({
width: this.width,
height: this.height
});
this.shadow = $('<div>').addClass('shadow').css('height',this.opts.shaHeight).appendTo(gallery);
for (var i = 1; i <= this.mounts; i++) {
btnStr = (this.opts.btnType=='img')? '<img src="'+this.images.eq(i-1).attr('src')+'"/>':i;
bHtml += '<li><a href="">' + btnStr + '</a></li>';
tHtml += '<a href="">' + this.images.eq(i - 1).attr('alt') + '</a>';
};
this.buttons = (this.opts.hasBtn)? $('<ol>').addClass('buttons'+(' '+this.opts.btnShape)+' '+((this.opts.btnTxt)?'hasTxt':'')).html(bHtml).appendTo(gallery):null;
if(this.opts.btnType=='img'){
btnsWidth = this.width-this.opts.btnsMar,
bW = parseInt(btnsWidth/this.mounts)-this.opts.btnMar,
bH = this.height*bW/this.width;
this.buttons.removeClass('buttons').addClass('img-btns').css({
width: btnsWidth,
left: this.opts.btnsMar/2,
bottom: this.opts.btnMar
});
this.buttons.find('img').css({
width: bW-this.opts.btnBorder,
height:bH
})
}
this.titles = (this.opts.hasTitle)? $('<p>').addClass('titles').html(tHtml).appendTo(gallery):null;
if(this.opts.hasArrow){
var f=(this.opts.arrAni)? '':'no-fade';
preHtml ='<a href="" class="prev-btn '+f+'"><</a>',
nextHtml = '<a href="" class="next-btn '+f+'">></a>';
if(this.opts.arrType==='outside'){
this.arrows = $('<div>').addClass('arrows-out').html(preHtml+'<span class="curNum"></span><span>/'+this.mounts+'</span>'+nextHtml).appendTo(gallery);
}else{
this.arrows = (this.opts.hasArrow)?($(preHtml+nextHtml).appendTo(gallery)):null;
}
}else{
this.arrows = null;
}
this.target = null;
this.begin = this.slideWrap.scrollLeft();
this.change = this.width;
this.cFixed = this.width;
this.timer = 0;
this.timeId = null;
this.auto = this.opts.auto;
};
//事件绑定
Gallery.prototype.eventsBind = function() {
var self = this,
btns = self.buttons;
btns && $('a', btns).eq(0).addClass('on');
self.titles && $('a', self.titles).eq(0).addClass('curInfo');
self.arrows && (self.opts.arrType==='outside') && (self.arrows.find('.curNum').text(1));
btns && $.each($('a', btns), function(k, v) {
$(v).bind('mouseover', {
index: k,
self: self
}, self.setBeforeSlide)
.bind('mouseleave', function() {
self.auto = true;
self.timer == 0 && self.setBeforeSlide()
}).click(function(e) {
e.preventDefault()
})
});
if (self.opts.hasArrow) {
$('a.next-btn', this.gallery).bind('click', {
Event: 'next',
self: self
}, this.setBeforeSlide);
$('a.prev-btn', this.gallery).bind('click', {
Event: 'prev',
self: self
}, this.setBeforeSlide);
(self.opts.arrType==='outside') || (!self.opts.arrAni) || self.gallery
.bind({
mouseover: function(e) {
self.arrows.fadeIn(300)
},
mouseleave: function() {
self.arrows.fadeOut(100)
}
})
.contents()
.not('ul,a.prev-btn,a.next-btn')
.not($('ul', self.container).contents())
.not('.slide-wrap')
.bind('mouseover', function(e) {
e.stopPropagation()
self.arrows.fadeOut(100)
})
};
self.auto && self.setBeforeSlide()
};
//开始滑动之前的预设
Gallery.prototype.setBeforeSlide = function(e) {
if (e == undefined) {
clearTimeout(this.timeId);
var self = this;
self.begin = self.slideWrap.scrollLeft();
self.change = (self.begin == (self.mounts - 1) * self.cFixed) ? -self.begin : self.cFixed;
self.alterClassName();
self.timeId = setTimeout(function() {self.slideRun()}, self.opts.pause)
} else {
e.preventDefault();
var self = e.data.self;
clearTimeout(self.timeId);
self.begin = self.slideWrap.scrollLeft();
if (e.data.Event) {
var destination;
e.preventDefault()
if (e.data.Event == 'next') {
var num = self.begin / self.cFixed;
if (self.begin != (self.mounts - 1) * self.cFixed) {
/*next平滑的方式是判断Data.begin / Data.cFixed为浮点还是整型
**整型则+1浮点型+2(num=...表达式中)
**/
if (num == parseInt(num)) {
inte = parseInt(num) + 1;
} else {
if (parseInt(num) == (self.mounts - 2)) {
inte = parseInt(num) + 1
} else {
inte = parseInt(num) + 2
}
};
destination = inte * self.cFixed;
self.alterClassName(inte);
}else{
destination=self.begin;
}
} else {
if (self.begin != 0) {
var index = parseInt(self.begin / self.cFixed - 1);
destination = index * self.cFixed;
self.alterClassName(index);
}
};
self.change = destination - self.begin;
self.timer = 0;
self.slideRun()
} else {
var index = e.data.index;
self.auto = false;
self.target = index * self.cFixed;
self.change = self.target - self.begin;
self.timer = 0;
self.alterClassName(index);
self.slideRun();
}
};
};
//开始滑动之前按钮和标题的更换
Gallery.prototype.alterClassName = function(index) {
var b=this.buttons,
t=this.titles,
arrNum= (this.arrows && (this.opts.arrType==='outside'))? this.arrows.find('.curNum'):null;
b && this.buttons.find('a.on').removeClass('on');
t && this.titles.find('.curInfo').removeClass('curInfo');
if (typeof index == 'number') {
b && $('a', this.buttons).eq(index).addClass('on')
t && $('a', this.titles).eq(index).addClass('curInfo');
arrNum && arrNum.text(index+1);
} else {
var next = parseInt(this.begin / this.cFixed);
b && $('a', this.buttons).eq(next).addClass('on')
t && $('a', this.titles).eq(next).addClass('curInfo');
arrNum && arrNum.text(next+1);
};
};
//滑动主体
Gallery.prototype.slideRun = function() {
var self = this;
if (this.timer <= this.opts.duration) {
var position = Math.round(this.Tween.Quart.easeOut(this.timer, this.begin, this.change, this.opts.duration))
this.slideWrap.scrollLeft(position);
this.timer++;
this.timeId = setTimeout(function() {self.slideRun()}, this.opts.interval)
} else {
this.timer = 0;
this.auto && this.setBeforeSlide()
}
};
/*================转化===============*/
//转化为jquery插件
$.fn.gallery = function(opts) {
return this.each(function() {
$(this).data('gallery') || $(this).data('gallery', new Gallery(opts ? opts : {}, $(this)))
});
}
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,334 @@
;(function($){
var bigColorPicker = new function(){
var currentPicker = null; //<2F><>ǰ<EFBFBD><C7B0>ʰȡ<CAB0><C8A1><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
var allColorArray = [];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>Ϊ6<CEAA><36><EFBFBD><EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ܵĶ<DCB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var sideLength = 6;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>߳<EFBFBD>
this.init = function(){
$("body").append('<div id="bigpicker" class="bigpicker"><ul class="bigpicker-bgview-text" ><li><div id="bigBgshowDiv"></div></li><li><input id="bigHexColorText" size="7" maxlength="7" value="#000000" /></li><li><span class="nocolor" title="clear color" ></span></li></ul><div id="bigSections" class="bigpicker-sections-color"></div><div id="bigLayout" class="biglayout" ></div></div>');
$("#bigLayout").hover(function(){
$(this).show();
},function(){
$(this).hide();
}).click(function(){
$("#bigpicker").hide();
});
//<2F><><EFBFBD><EFBFBD><EFBFBD>ɫ
$("#bigpicker .nocolor").click(function(){
$("#bigHexColorText").val("");
invokeCallBack("");
$("#bigpicker").hide();
});
//<2F><>ɫʰȡ<CAB0><C8A1>text<78><74><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>¼<EFBFBD>
$("#bigHexColorText").keypress(function(){
var text = $.trim($(this).val());
$(this).val(text.replace(/[^A-Fa-f0-9#]/g,''));
if(text.length <= 0)return;
text = text.charAt(0)=='#'?text:"#" + text;
var countChar = 7 - text.length;
if(countChar < 0){
text = text.substring(0,7);
}else if(countChar > 0){
for(var i=0;i<countChar;i++){
text += "0";
};
}
$("#bigBgshowDiv").css("backgroundColor",text);
}).keyup(function(){
var text = $.trim($(this).val());
$(this).val(text.replace(/[^A-Fa-f0-9#]/g,''));
}).focus(function(){
this.select();
});
//<2F><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵط<C4B5>ʱѡ<CAB1><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$(document).bind('mousedown',function(event){
if(!($(event.target).parents().andSelf().is('#bigpicker'))){
$("#bigpicker").hide();
}
});
};
this.showPicker = function(callback,engine,sideLength_){
if($("body").length > 0 && $("#bigpicker").length <= 0){
bigColorPicker.init();
}
var sl_ = parseInt(sideLength_,10);
if(engine == "L" && !isNaN(sl_) && sl_ >=2 && sl_ <= 10){
sideLength = sl_;
}else{
sideLength = 6;
}
this.getAllColorArray = function(){
allColorArray = new Array(sideLength*3 + 2);
//<2F><><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
var mixColorArray = [];
var blackWhiteGradientArray = gradientColor(new RGB(0,0,0),new RGB(255,255,255));
for(var i=0;i<blackWhiteGradientArray.length;i++){
mixColorArray[i] = blackWhiteGradientArray[i];
}
var baseArray = [new RGB(255,0,0),new RGB(0,255,0),new RGB(0,0,255),new RGB(255,255,0),new RGB(0,255,255),new RGB(255,0,255),new RGB(204,255,0),new RGB(153,0,255),new RGB(102,255,255),new RGB(51,0,0)];
mixColorArray = mixColorArray.concat(baseArray.slice(0, sideLength));
allColorArray[0] = mixColorArray;
//<2F><><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
var blackArray = new Array(sideLength*2);
for(var i=0;i<blackArray.length;i++){
blackArray[i] = new RGB(0,0,0);
}
allColorArray[1] = blackArray;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var cornerColorArray = new Array();//<2F><><EFBFBD><EFBFBD>Ԫ<EFBFBD>أ<EFBFBD>ÿ<EFBFBD><C3BF>Ԫ<EFBFBD>ط<EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ɫ<EFBFBD><C9AB>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
cornerColorArray.push(generateBlockcornerColor(0),generateBlockcornerColor(51),generateBlockcornerColor(102),generateBlockcornerColor(153),generateBlockcornerColor(204),generateBlockcornerColor(255));
var count = 0;
var halfOfAllArray1 = [];
var halfOfAllArray2 = [];
for(var i=0;i<cornerColorArray.length;i++){
var startArray = gradientColor(cornerColorArray[i][0][0],cornerColorArray[i][0][1]);
var endArray = gradientColor(cornerColorArray[i][1][0],cornerColorArray[i][1][1]);
for(var j=0;j<sideLength;j++){
if(i < 3){
halfOfAllArray1[count] = gradientColor(startArray[j],endArray[j]);
}else{
halfOfAllArray2[count - sideLength*3] = gradientColor(startArray[j],endArray[j]);
}
count++;
}
}
for(var i=0;i<halfOfAllArray1.length;i++){
allColorArray[i + 2] = halfOfAllArray1[i].concat(halfOfAllArray2[i]);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>RGB<47><42>ɫת<C9AB><D7AA><EFBFBD><EFBFBD>Hex<65><78>ʽ
for(var i=0;i<allColorArray.length;i++){
for(var j=0;j<allColorArray[i].length;j++){
allColorArray[i][j] = RGBToHex(allColorArray[i][j]);
}
}
};
this.getAllColorArray();
$(this).data("bigpickerCallback",callback);
if(engine){
try{
engine = engine.toUpperCase();
}catch(e){
engine = "P";
}
}
if(engine == "L" ){
$("#bigSections").unbind("mousemove").unbind("mouseout").removeClass("bigpicker-bgimage");
var ulArray = new Array();
for(var i=0;i<sideLength*3 + 2;i++){
ulArray.push("<ul>");
for(var j=0;j<sideLength*2;j++){
ulArray.push("<li data-color='" + allColorArray[i][j] + "' style='background-color: " + allColorArray[i][j] + ";' ></li>");
}
ulArray.push("</ul>");
}
$("#bigSections").html(ulArray.join(""));
var minBigpickerHeight = 90;
var minBigpickerWidth = 148;
var minSectionsHeight = minBigpickerHeight - 29;
var minSectionsWidth = minBigpickerWidth - 1;
var defaultSectionsWidth = (sideLength*3 + 2)*11 + 1;
if(defaultSectionsWidth < minSectionsWidth){
$("#bigSections li,#bigLayout").width(minSectionsWidth/(sideLength*3 + 2) - 2)
.height(minSectionsHeight/(sideLength*2) - 1);
$("#bigpicker").height(minBigpickerHeight).width(minBigpickerWidth);
$("#bigSections").height(minSectionsHeight).width(minSectionsWidth);
}else{
$("#bigSections").width(defaultSectionsWidth)
.height(sideLength*2*11);
$("#bigpicker").width(defaultSectionsWidth + 5)
.height(sideLength*2*11 + 29);
}
$("#bigSections ul").find("li:last").css("border-bottom","1px solid #000000");
$("#bigSections ul:last li").css("border-right","1px solid #000000");
$("#bigSections li").hover(function(){
var $this = $(this);
$("#bigLayout").css({"left":$this.position().left,"top":$this.position().top}).show();
var cor = $this.attr("data-color");
$("#bigBgshowDiv").css("backgroundColor",cor);
$("#bigHexColorText").val(cor);
invokeCallBack(cor);
},function(){
$("#bigLayout").hide();
});
}else{
//Ԥ<><D4A4><EFBFBD><EFBFBD>ͼƬ
var bgmage = new Image();
bgmage.src = "img/big_bgcolor.jpg";
//<2F><>ʼ<EFBFBD><CABC>ΪĬ<CEAA><C4AC><EFBFBD><EFBFBD>ʽ
$("#bigSections").height(134).width(222).addClass("bigpicker-bgimage").empty();
$("#bigpicker").width(227).height(163);
//Pģʽʱ<CABD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫС<C9AB><D0A1><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD><CAB1>ȡ<EFBFBD><C8A1>ɫ
$("#bigSections").unbind("mousemove").unbind("mouseout").mousemove(function(event){
var xSections = getSections(sideLength*3 + 2);
var ySections = getSections(sideLength*3);
var $this = $(this);
var cursorXPos = event.pageX - $this.offset().left;
var cursorYPos = event.pageY - $this.offset().top;
var xi = 0;
var yi = 0;
for(var i=0;i<(sideLength*3+2);i++){
if(cursorXPos >= xSections[i][0] && cursorXPos <= xSections[i][1]){
xi = i;
break;
}
}
for(var i=0;i<(sideLength*3);i++){
if(cursorYPos >= ySections[i][0] && cursorYPos <= ySections[i][1]){
yi = i;
break;
}
}
$("#bigLayout").css({"left":$this.position().left + xi*11,"top":$this.position().top + yi*11}).show();
var hex = allColorArray[xi][yi];
$("#bigBgshowDiv").css("backgroundColor",hex);
$("#bigHexColorText").val(hex);
invokeCallBack(hex);
}).mouseout(function(){
$("#bigLayout").hide();
});
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>ɫ<EFBFBD><C9AB>Ԫ<EFBFBD>ذ<EFBFBD>click<63>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫʰȡ<CAB0><C8A1>
$(this).bind("click",function(event){
currentPicker = event.currentTarget;
$("#bigBgshowDiv").css("backgroundColor","#000000");
$("#bigHexColorText").val("#000000");
var pos = calculatePosition ($(currentPicker));
$("#bigpicker").css({"left":pos.left + "px","top":pos.top + "px"}).fadeIn(300);
var bigSectionsP = $("#bigSections").position();
$("#bigLayout").css({"left":bigSectionsP.left,"top":bigSectionsP.top}).show();
});
};
this.hidePicker = function(){
$("#bigpicker").hide();
};
this.movePicker = function(){
var pos = calculatePosition ($(currentPicker));
$("#bigpicker").css({"left":pos.left + "px","top":pos.top + "px"});
$("#bigLayout").hide();
};
//<2F><><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1><EFBFBD><EFBFBD><EFBFBD>left,top<6F><70><EFBFBD><EFBFBD>
function calculatePosition ($el) {
var offset = $el.offset();
var compatMode = document.compatMode == 'CSS1Compat';
var w = compatMode ? document.documentElement.clientWidth : document.body.clientWidth;
var h = compatMode ? document.documentElement.clientHeight : document.body.clientHeight;
var pos = {left:offset.left,top:offset.top + $el.height() + 7};
var $bigpicker = $("#bigpicker");
if(offset.left + $bigpicker.width() > w){
pos.left = offset.left - $bigpicker.width() - 7;
if(pos.left < 0){
pos.left = 0;
}
}
if(offset.top + $el.height() + 7 + $bigpicker.height() > h){
pos.top = offset.top - $bigpicker.height() - 7;
if(pos.top < 0){
pos.top = 0;
}
}
return pos;
}
//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>ǵ<EFBFBD><C7B5><EFBFBD>ɫ<EFBFBD><C9AB>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
function generateBlockcornerColor(r){
var a = new Array(2);
a[0] = [new RGB(r,0,0),new RGB(r,255,0)];
a[1] = [new RGB(r,0,255),new RGB(r,255,255)];
return a;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
function gradientColor(startColor,endColor){
var gradientArray = [];
gradientArray[0] = startColor;
gradientArray[sideLength-1] = endColor;
var averageR = Math.round((endColor.r - startColor.r)/sideLength);
var averageG = Math.round((endColor.g - startColor.g)/sideLength);
var averageB = Math.round((endColor.b - startColor.b)/sideLength);
for(var i=1;i<sideLength-1;i++){
gradientArray[i] = new RGB(startColor.r + i*averageR,startColor.g + i*averageG,startColor.b + i*averageB);
}
return gradientArray;
}
/*<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[0,11],[12,23],[24,37]..
* sl:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
*/
function getSections(sl){
var sections = new Array(sl);
var initData = 0;
for(var i=0;i<sl;i++){
var temp = initData + 1;
initData += 11;
sections[i] = [temp,initData];
}
return sections;
}
function RGBToHex(rgb){
var hex = "#";
for(c in rgb){
var h = rgb[c].toString(16).toUpperCase();
if(h.length == 1){
hex += "0" + h;
}else{
hex += h;
}
}
return hex;
}
//RGB<47><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>һ<EFBFBD><D2BB>RGB<47><42>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
function RGB(r,g,b){
this.r = Math.max(Math.min(r,255),0);
this.g = Math.max(Math.min(g,255),0);
this.b = Math.max(Math.min(b,255),0);
}
function invokeCallBack(hex){
var callback_ = $(currentPicker).data("bigpickerCallback");
if($.isFunction(callback_)){
callback_(currentPicker,hex);
}else if(callback_ == undefined || callback_ == ""){
$(currentPicker).val(hex);
}else{
if(callback_.charAt(0) != "#"){
callback_ = "#" + callback_;
}
$(callback_).val(hex);
}
}
};
$.fn.bigColorpicker = bigColorPicker.showPicker;
$.fn.bigColorpickerMove = bigColorPicker.movePicker; //ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>קʱʰȡ<CAB0><C8A1><EFBFBD><EFBFBD><E6B8A1><EFBFBD>ƶ<EFBFBD>λ<EFBFBD><CEBB>
$.fn.bigColorpickerHide = bigColorPicker.hidePicker; //<2F><>ӦһЩ<D2BB>ض<EFBFBD><D8B6><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ҫ<EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>ʱʹ<CAB1>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>
})(jQuery);

View File

@ -0,0 +1,576 @@
/*
HTML Clean for jQuery
Anthony Johnston
http://www.antix.co.uk
version 1.3.1
$Revision$
requires jQuery http://jquery.com
Use and distibution http://www.opensource.org/licenses/bsd-license.php
2010-04-02 allowedTags/removeTags added (white/black list) thanks to David Wartian (Dwartian)
2010-06-30 replaceStyles added for replacement of bold, italic, super and sub styles on a tag
2012-04-30 allowedAttributes added, an array of attributed allowed on the elements
2013-02-25 now will push non-inline elements up the stack if nested in an inline element
2013-02-25 comment element support added, removed by default, see AllowComments in options
*/
(function ($) {
$.fn.htmlClean = function (options) {
// iterate and html clean each matched element
return this.each(function () {
var $this = $(this);
if (this.value) {
this.value = $.htmlClean(this.value, options);
} else {
this.innerHTML = $.htmlClean(this.innerHTML, options);
}
});
};
// clean the passed html
$.htmlClean = function (html, options) {
options = $.extend({}, $.htmlClean.defaults, options);
var tagsRE = /(<(\/)?(\w+:)?([\w]+)([^>]*)>)|<!--(.*?--)>/gi;
var attrsRE = /([\w\-]+)=(".*?"|'.*?'|[^\s>]*)/gi;
var tagMatch;
var root = new Element();
var stack = [root];
var container = root;
var protect = false;
if (options.bodyOnly) {
// check for body tag
if (tagMatch = /<body[^>]*>((\n|.)*)<\/body>/i.exec(html)) {
html = tagMatch[1];
}
}
html = html.concat("<xxx>"); // ensure last element/text is found
var lastIndex;
while (tagMatch = tagsRE.exec(html)) {
var tag = tagMatch[6]
? new Tag("--", null, tagMatch[6], options)
: new Tag(tagMatch[4], tagMatch[2], tagMatch[5], options);
// add the text
var text = html.substring(lastIndex, tagMatch.index);
if (text.length > 0) {
var child = container.children[container.children.length - 1];
if (container.children.length > 0
&& isText(child = container.children[container.children.length - 1])) {
// merge text
container.children[container.children.length - 1] = child.concat(text);
} else {
container.children.push(text);
}
}
lastIndex = tagsRE.lastIndex;
if (tag.isClosing) {
// find matching container
if (popToTagName(stack, [tag.name])) {
stack.pop();
container = stack[stack.length - 1];
}
} else {
// create a new element
var element = new Element(tag);
// add attributes
var attrMatch;
while (attrMatch = attrsRE.exec(tag.rawAttributes)) {
// check style attribute and do replacements
if (attrMatch[1].toLowerCase() == "style"
&& options.replaceStyles) {
var renderParent = !tag.isInline;
for (var i = 0; i < options.replaceStyles.length; i++) {
if (options.replaceStyles[i][0].test(attrMatch[2])) {
if (!renderParent) {
tag.render = false;
renderParent = true;
}
container.children.push(element); // assumes not replaced
stack.push(element);
container = element; // assumes replacement is a container
// create new tag and element
tag = new Tag(options.replaceStyles[i][1], "", "", options);
element = new Element(tag);
}
}
}
if (tag.allowedAttributes != null
&& (tag.allowedAttributes.length == 0
|| $.inArray(attrMatch[1], tag.allowedAttributes) > -1)) {
element.attributes.push(new Attribute(attrMatch[1], attrMatch[2]));
}
}
// add required empty ones
$.each(tag.requiredAttributes, function () {
var name = this.toString();
if (!element.hasAttribute(name)) element.attributes.push(new Attribute(name, ""));
});
// check for replacements
for (var repIndex = 0; repIndex < options.replace.length; repIndex++) {
for (var tagIndex = 0; tagIndex < options.replace[repIndex][0].length; tagIndex++) {
var byName = typeof (options.replace[repIndex][0][tagIndex]) == "string";
if ((byName && options.replace[repIndex][0][tagIndex] == tag.name)
|| (!byName && options.replace[repIndex][0][tagIndex].test(tagMatch))) {
// set the name to the replacement
tag.rename(options.replace[repIndex][1]);
repIndex = options.replace.length; // break out of both loops
break;
}
}
}
// check container rules
var add = true;
if (!container.isRoot) {
if (container.tag.isInline && !tag.isInline) {
if (add = popToContainer(stack)) {
container = stack[stack.length - 1];
}
} else if (container.tag.disallowNest && tag.disallowNest
&& !tag.requiredParent) {
add = false;
} else if (tag.requiredParent) {
if (add = popToTagName(stack, tag.requiredParent)) {
container = stack[stack.length - 1];
}
}
}
if (add) {
container.children.push(element);
if (tag.toProtect) {
// skip to closing tag
while (tagMatch2 = tagsRE.exec(html)) {
var tag2 = new Tag(tagMatch2[3], tagMatch2[1], tagMatch2[4], options);
if (tag2.isClosing && tag2.name == tag.name) {
element.children.push(RegExp.leftContext.substring(lastIndex));
lastIndex = tagsRE.lastIndex;
break;
}
}
} else {
// set as current container element
if (!tag.isSelfClosing && !tag.isNonClosing) {
stack.push(element);
container = element;
}
}
}
}
}
// render doc
return $.htmlClean.trim(render(root, options).join(""));
};
// defaults
$.htmlClean.defaults = {
// only clean the body tagbody
bodyOnly: true,
// only allow tags in this array, (white list), contents still rendered
allowedTags: [],
// remove tags in this array, (black list), contents still rendered
removeTags: ["basefont", "center", "dir", "font", "frame", "frameset", "iframe", "isindex", "menu", "noframes", "s", "strike", "u"],
// array of [attributeName], [optional array of allowed on elements] e.g. [["id"], ["style", ["p", "dl"]]] // allow all elements to have id and allow style on 'p' and 'dl'
allowedAttributes: [],
// array of attribute names to remove on all elements in addition to those not in tagAttributes e.g ["width", "height"]
removeAttrs: [],
// array of [className], [optional array of allowed on elements] e.g. [["aClass"], ["anotherClass", ["p", "dl"]]]
allowedClasses: [],
// format the result
format: false,
// format indent to start on
formatIndent: 0,
// tags to replace, and what to replace with, tag name or regex to match the tag and attributes
replace: [
[["b", "big"], "strong"],
[["i"], "em"]
],
// styles to replace with tags, multiple style matches supported, inline tags are replaced by the first match blocks are retained
replaceStyles: [
[/font-weight:\s*bold/i, "strong"],
[/font-style:\s*italic/i, "em"],
[/vertical-align:\s*super/i, "sup"],
[/vertical-align:\s*sub/i, "sub"]
],
allowComments: false
};
function applyFormat(element, options, output, indent) {
if (!element.tag.isInline && output.length > 0) {
output.push("\n");
for (i = 0; i < indent; i++) output.push("\t");
}
}
function render(element, options) {
var output = [], empty = element.attributes.length == 0, indent;
if (element.tag.isComment) {
if (options.allowComments) {
output.push("<!--");
output.push(element.tag.rawAttributes);
output.push(">");
if (options.format) applyFormat(element, options, output, indent - 1);
}
} else {
var openingTag = this.name.concat(element.tag.rawAttributes == undefined ? "" : element.tag.rawAttributes);
// don't render if not in allowedTags or in removeTags
var renderTag
= element.tag.render
&& (options.allowedTags.length == 0 || $.inArray(element.tag.name, options.allowedTags) > -1)
&& (options.removeTags.length == 0 || $.inArray(element.tag.name, options.removeTags) == -1);
if (!element.isRoot && renderTag) {
// render opening tag
output.push("<");
output.push(element.tag.name);
$.each(element.attributes, function () {
if ($.inArray(this.name, options.removeAttrs) == -1) {
var m = RegExp(/^(['"]?)(.*?)['"]?$/).exec(this.value);
var value = m[2];
var valueQuote = m[1] || "'";
// check for classes allowed
if (this.name == "class" && options.allowedClasses.length > 0) {
value =
$.grep(value.split(" "), function (c) {
return $.grep(options.allowedClasses, function (a) {
return a == c
|| (a[0] == c && (a.length == 1 || $.inArray(element.tag.name, a[1]) > -1));
}).length > 0;
})
.join(" ");
}
if (value != null && (value.length > 0 || $.inArray(this.name, element.tag.requiredAttributes) > -1)) {
output.push(" ");
output.push(this.name);
output.push("=");
output.push(valueQuote);
output.push(value);
output.push(valueQuote);
}
}
});
}
if (element.tag.isSelfClosing) {
// self closing
if (renderTag) output.push(" />");
empty = false;
} else if (element.tag.isNonClosing) {
empty = false;
} else {
if (!element.isRoot && renderTag) {
// close
output.push(">");
}
var indent = options.formatIndent++;
// render children
if (element.tag.toProtect) {
var outputChildren = $.htmlClean.trim(element.children.join("")).replace(/<br>/ig, "\n");
output.push(outputChildren);
empty = outputChildren.length == 0;
} else {
var outputChildren = [];
for (var i = 0; i < element.children.length; i++) {
var child = element.children[i];
var text = $.htmlClean.trim(textClean(isText(child) ? child : child.childrenToString()));
if (isInline(child)) {
if (i > 0 && text.length > 0
&& (startsWithWhitespace(child) || endsWithWhitespace(element.children[i - 1]))) {
outputChildren.push(" ");
}
}
if (isText(child)) {
if (text.length > 0) {
outputChildren.push(text);
}
} else {
// don't allow a break to be the last child
if (i != element.children.length - 1 || child.tag.name != "br") {
if (options.format) applyFormat(child, options, outputChildren, indent);
outputChildren = outputChildren.concat(render(child, options));
}
}
}
options.formatIndent--;
if (outputChildren.length > 0) {
if (options.format && outputChildren[0] != "\n") applyFormat(element, options, output, indent);
output = output.concat(outputChildren);
empty = false;
}
}
if (!element.isRoot && renderTag) {
// render the closing tag
if (options.format) applyFormat(element, options, output, indent - 1);
output.push("</");
output.push(element.tag.name);
output.push(">");
}
}
// check for empty tags
if (!element.tag.allowEmpty && empty) { return []; }
}
return output;
}
// find a matching tag, and pop to it, if not do nothing
function popToTagName(stack, tagNameArray) {
return pop(
stack,
function (element) {
return $.inArray(element.tag.nameOriginal, tagNameArray) > -1
});
}
function popToContainer(stack) {
return pop(
stack,
function (element) {
return element.isRoot || !element.tag.isInline;
});
}
function pop(stack, test, index) {
index = index || 1;
var element = stack[stack.length - index];
if (test(element)) {
return true;
} else if (stack.length - index > 0
&& pop(stack, test, index + 1)) {
stack.pop();
return true;
}
return false;
}
// Element Object
function Element(tag) {
if (tag) {
this.tag = tag;
this.isRoot = false;
} else {
this.tag = new Tag("root");
this.isRoot = true;
}
this.attributes = [];
this.children = [];
this.hasAttribute = function (name) {
for (var i = 0; i < this.attributes.length; i++) {
if (this.attributes[i].name == name) return true;
}
return false;
};
this.childrenToString = function () {
return this.children.join("");
};
return this;
}
// Attribute Object
function Attribute(name, value) {
this.name = name;
this.value = value;
return this;
}
// Tag object
function Tag(name, close, rawAttributes, options) {
this.name = name.toLowerCase();
this.nameOriginal = this.name;
this.render = true;
this.init = function () {
if (this.name == "--") {
this.isComment = true;
this.isSelfClosing = true;
} else {
this.isComment = false;
this.isSelfClosing = $.inArray(this.name, tagSelfClosing) > -1;
this.isNonClosing = $.inArray(this.name, tagNonClosing) > -1;
this.isClosing = (close != undefined && close.length > 0);
this.isInline = $.inArray(this.name, tagInline) > -1;
this.disallowNest = $.inArray(this.name, tagDisallowNest) > -1;
this.requiredParent = tagRequiredParent[$.inArray(this.name, tagRequiredParent) + 1];
this.allowEmpty = $.inArray(this.name, tagAllowEmpty) > -1;
this.toProtect = $.inArray(this.name, tagProtect) > -1;
}
this.rawAttributes = rawAttributes;
this.requiredAttributes = tagAttributesRequired[$.inArray(this.name, tagAttributesRequired) + 1];
if (options) {
if (!options.tagAttributesCache) options.tagAttributesCache = [];
if ($.inArray(this.name, options.tagAttributesCache) == -1) {
var cacheItem = tagAttributes[$.inArray(this.name, tagAttributes) + 1].slice(0);
// add extra ones from options
for (var i = 0; i < options.allowedAttributes.length; i++) {
var attrName = options.allowedAttributes[i][0];
if ((
options.allowedAttributes[i].length == 1
|| $.inArray(this.name, options.allowedAttributes[i][1]) > -1
) && $.inArray(attrName, cacheItem) == -1) {
cacheItem.push(attrName);
}
}
options.tagAttributesCache.push(this.name);
options.tagAttributesCache.push(cacheItem);
}
this.allowedAttributes = options.tagAttributesCache[$.inArray(this.name, options.tagAttributesCache) + 1];
}
}
this.init();
this.rename = function (newName) {
this.name = newName;
this.init();
};
return this;
}
function startsWithWhitespace(item) {
while (isElement(item) && item.children.length > 0) { item = item.children[0] }
if (!isText(item)) return false;
var text = textClean(item);
return text.length > 0 && $.htmlClean.isWhitespace(text.charAt(0));
}
function endsWithWhitespace(item) {
while (isElement(item) && item.children.length > 0) { item = item.children[item.children.length - 1] }
if (!isText(item)) return false;
var text = textClean(item);
return text.length > 0 && $.htmlClean.isWhitespace(text.charAt(text.length - 1));
}
function isText(item) { return item.constructor == String; }
function isInline(item) { return isText(item) || item.tag.isInline; }
function isElement(item) { return item.constructor == Element; }
function textClean(text) {
return text
.replace(/&nbsp;|\n/g, " ")
.replace(/\s\s+/g, " ");
}
// trim off white space, doesn't use regex
$.htmlClean.trim = function (text) {
return $.htmlClean.trimStart($.htmlClean.trimEnd(text));
};
$.htmlClean.trimStart = function (text) {
return text.substring($.htmlClean.trimStartIndex(text));
};
$.htmlClean.trimStartIndex = function (text) {
for (var start = 0; start < text.length - 1 && $.htmlClean.isWhitespace(text.charAt(start)); start++);
return start;
};
$.htmlClean.trimEnd = function (text) {
return text.substring(0, $.htmlClean.trimEndIndex(text));
};
$.htmlClean.trimEndIndex = function (text) {
for (var end = text.length - 1; end >= 0 && $.htmlClean.isWhitespace(text.charAt(end)); end--);
return end + 1;
};
// checks a char is white space or not
$.htmlClean.isWhitespace = function (c) { return $.inArray(c, whitespace) != -1; };
// tags which are inline
var tagInline = [
"a", "abbr", "acronym", "address", "b", "big", "br", "button",
"caption", "cite", "code", "del", "em", "font",
"hr", "i", "input", "img", "ins", "label", "legend", "map", "q",
"s", "samp", "select", "option", "param", "small", "span", "strike", "strong", "sub", "sup",
"tt", "u", "var"];
var tagDisallowNest = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "th", "td", "object"];
var tagAllowEmpty = ["th", "td"];
var tagRequiredParent = [
null,
"li", ["ul", "ol"],
"dt", ["dl"],
"dd", ["dl"],
"td", ["tr"],
"th", ["tr"],
"tr", ["table", "thead", "tbody", "tfoot"],
"thead", ["table"],
"tbody", ["table"],
"tfoot", ["table"],
"param", ["object"]
];
var tagProtect = ["script", "style", "pre", "code"];
// tags which self close e.g. <br />
var tagSelfClosing = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
// tags which do not close
var tagNonClosing = ["!doctype", "?xml"];
// attributes allowed on tags
var tagAttributes = [
["class"], // default, for all tags not mentioned
"?xml", [],
"!doctype", [],
"a", ["accesskey", "class", "href", "name", "title", "rel", "rev", "type", "tabindex"],
"abbr", ["class", "title"],
"acronym", ["class", "title"],
"blockquote", ["cite", "class"],
"button", ["class", "disabled", "name", "type", "value"],
"del", ["cite", "class", "datetime"],
"form", ["accept", "action", "class", "enctype", "method", "name"],
"input", ["accept", "accesskey", "alt", "checked", "class", "disabled", "ismap", "maxlength", "name", "size", "readonly", "src", "tabindex", "type", "usemap", "value"],
"img", ["alt", "class", "height", "src", "width"],
"ins", ["cite", "class", "datetime"],
"label", ["accesskey", "class", "for"],
"legend", ["accesskey", "class"],
"link", ["href", "rel", "type"],
"meta", ["content", "http-equiv", "name", "scheme", "charset"],
"map", ["name"],
"optgroup", ["class", "disabled", "label"],
"option", ["class", "disabled", "label", "selected", "value"],
"q", ["class", "cite"],
"script", ["src", "type"],
"select", ["class", "disabled", "multiple", "name", "size", "tabindex"],
"style", ["type"],
"table", ["class", "summary"],
"th", ["class", "colspan", "rowspan"],
"td", ["class", "colspan", "rowspan"],
"textarea", ["accesskey", "class", "cols", "disabled", "name", "readonly", "rows", "tabindex"],
"param", ["name", "value"],
"embed", ["height", "src", "type", "width"]
];
var tagAttributesRequired = [[], "img", ["alt"]];
// white space chars
var whitespace = [" ", " ", "\t", "\n", "\r", "\f"];
})(jQuery);

View File

@ -0,0 +1,379 @@
/***********
* name: jquery-gallery
* version: 2.0
* date: 2014-02-24
* author: kevin
* github: https://github.com/FishBooy
* email: qwk.love@gmail.com
*
**************/
;(function($) {
/*====构造函数====*/
var Gallery = function(opts, gallery) {
this.opts = $.extend({}, this.defaultOpts, opts ? opts : {});
this.gallery = gallery.addClass('Gallery');
this.slideWrap = $('div',this.gallery).addClass('slide-wrap');
this.setData();
this.eventsBind();
}
/*====对象属性以及方法====*/
//滑动算法
Gallery.prototype.Tween = {
Quart: {
easeOut: function(t, b, c, d) {
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
}
},
Back: {
easeOut: function(t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
}
},
Bounce: {
easeOut: function(t, b, c, d) {
if ((t /= d) < (1 / 2.75)) {
return c * (7.5625 * t * t) + b;
} else if (t < (2 / 2.75)) {
return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
} else if (t < (2.5 / 2.75)) {
return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
} else {
return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
}
}
}
};
//默认参数
Gallery.prototype.defaultOpts = {
width:0,
height:0,
animation: 'slide',
shaHeight: 42,
hasTitle: true,
hasArrow: true,
arrType: 'inside',
arrAni: true,
hasBtn: true,
btnType: 'btn',
btnBorder: 8,
btnShape: '',
btnsMar: 40,
btnMar: 5,
btnTxt: false,
auto: true,
duration: 40,
pause: 3000,
interval: 10,
onStart: function() {},
onFinish: function() {}
};
//完善当前dom并将各主要元素的jquery对象与对象属性相对应
Gallery.prototype.setData = function() {
var bHtml = '',
tHtml = '',
btnStr = '',
btnsWidth,
gallery=this.gallery,
img=$('img', gallery);
this.mounts = img.length;
this.width = (this.opts.width)? this.opts.width:gallery.width();
gallery.css('width',this.width);
this.imgsContainer = $('ul', gallery).addClass('imgs-container').css('width', this.mounts * this.width);
this.height = (this.opts.height)? this.opts.height:gallery.height();
this.images = img.css({
width: this.width,
height: this.height
});
this.shadow = $('<div>').addClass('shadow').css('height',this.opts.shaHeight).appendTo(gallery);
for (var i = 1; i <= this.mounts; i++) {
btnStr = (this.opts.btnType=='img')? '<img src="'+this.images.eq(i-1).attr('src')+'"/>':i;
bHtml += '<li><a href="">' + btnStr + '</a></li>';
tHtml += '<a href="">' + this.images.eq(i - 1).attr('alt') + '</a>';
};
this.buttons = (this.opts.hasBtn)? $('<ol>').addClass('buttons'+(' '+this.opts.btnShape)+' '+((this.opts.btnTxt)?'hasTxt':'')).html(bHtml).appendTo(gallery):null;
if(this.opts.btnType=='img'){
btnsWidth = this.width-this.opts.btnsMar,
bW = parseInt(btnsWidth/this.mounts)-this.opts.btnMar,
bH = this.height*bW/this.width;
this.buttons.removeClass('buttons').addClass('img-btns').css({
width: btnsWidth,
left: this.opts.btnsMar/2,
bottom: this.opts.btnMar
});
this.buttons.find('img').css({
width: bW-this.opts.btnBorder,
height:bH
})
}
this.titles = (this.opts.hasTitle)? $('<p>').addClass('titles').html(tHtml).appendTo(gallery):null;
if(this.opts.hasArrow){
var f=(this.opts.arrAni)? '':'no-fade';
preHtml ='<a href="" class="prev-btn '+f+'"><</a>',
nextHtml = '<a href="" class="next-btn '+f+'">></a>';
if(this.opts.arrType==='outside'){
this.arrows = $('<div>').addClass('arrows-out').html(preHtml+'<span class="curNum"></span><span>/'+this.mounts+'</span>'+nextHtml).appendTo(gallery);
}else{
this.arrows = (this.opts.hasArrow)?($(preHtml+nextHtml).appendTo(gallery)):null;
}
}else{
this.arrows = null;
}
this.target = null;
this.begin = this.slideWrap.scrollLeft();
this.change = this.width;
this.cFixed = this.width;
this.timer = 0;
this.timeId = null;
this.auto = this.opts.auto;
};
//事件绑定
Gallery.prototype.eventsBind = function() {
var self = this,
btns = self.buttons;
btns && $('a', btns).eq(0).addClass('on');
self.titles && $('a', self.titles).eq(0).addClass('curInfo');
self.arrows && (self.opts.arrType==='outside') && (self.arrows.find('.curNum').text(1));
btns && $.each($('a', btns), function(k, v) {
$(v).bind('mouseover', {
index: k,
self: self
}, self.setBeforeSlide)
.bind('mouseleave', function() {
self.auto = true;
self.timer == 0 && self.setBeforeSlide()
}).click(function(e) {
e.preventDefault()
})
});
if (self.opts.hasArrow) {
$('a.next-btn', this.gallery).bind('click', {
Event: 'next',
self: self
}, this.setBeforeSlide);
$('a.prev-btn', this.gallery).bind('click', {
Event: 'prev',
self: self
}, this.setBeforeSlide);
(self.opts.arrType==='outside') || (!self.opts.arrAni) || self.gallery
.bind({
mouseover: function(e) {
self.arrows.fadeIn(300)
},
mouseleave: function() {
self.arrows.fadeOut(100)
}
})
.contents()
.not('ul,a.prev-btn,a.next-btn')
.not($('ul', self.container).contents())
.not('.slide-wrap')
.bind('mouseover', function(e) {
e.stopPropagation()
self.arrows.fadeOut(100)
})
};
self.auto && self.setBeforeSlide()
};
//开始滑动之前的预设
Gallery.prototype.setBeforeSlide = function(e) {
if (e == undefined) {
clearTimeout(this.timeId);
var self = this;
self.begin = self.slideWrap.scrollLeft();
self.change = (self.begin == (self.mounts - 1) * self.cFixed) ? -self.begin : self.cFixed;
self.alterClassName();
self.timeId = setTimeout(function() {self.slideRun()}, self.opts.pause)
} else {
e.preventDefault();
var self = e.data.self;
clearTimeout(self.timeId);
self.begin = self.slideWrap.scrollLeft();
if (e.data.Event) {
var destination;
e.preventDefault()
if (e.data.Event == 'next') {
var num = self.begin / self.cFixed;
if (self.begin != (self.mounts - 1) * self.cFixed) {
/*next平滑的方式是判断Data.begin / Data.cFixed为浮点还是整型
**整型则+1浮点型+2(num=...表达式中)
**/
if (num == parseInt(num)) {
inte = parseInt(num) + 1;
} else {
if (parseInt(num) == (self.mounts - 2)) {
inte = parseInt(num) + 1
} else {
inte = parseInt(num) + 2
}
};
destination = inte * self.cFixed;
self.alterClassName(inte);
}else{
destination=self.begin;
}
} else {
if (self.begin != 0) {
var index = parseInt(self.begin / self.cFixed - 1);
destination = index * self.cFixed;
self.alterClassName(index);
}
};
self.change = destination - self.begin;
self.timer = 0;
self.slideRun()
} else {
var index = e.data.index;
self.auto = false;
self.target = index * self.cFixed;
self.change = self.target - self.begin;
self.timer = 0;
self.alterClassName(index);
self.slideRun();
}
};
};
//开始滑动之前按钮和标题的更换
Gallery.prototype.alterClassName = function(index) {
var b=this.buttons,
t=this.titles,
arrNum= (this.arrows && (this.opts.arrType==='outside'))? this.arrows.find('.curNum'):null;
b && this.buttons.find('a.on').removeClass('on');
t && this.titles.find('.curInfo').removeClass('curInfo');
if (typeof index == 'number') {
b && $('a', this.buttons).eq(index).addClass('on')
t && $('a', this.titles).eq(index).addClass('curInfo');
arrNum && arrNum.text(index+1);
} else {
var next = parseInt(this.begin / this.cFixed);
b && $('a', this.buttons).eq(next).addClass('on')
t && $('a', this.titles).eq(next).addClass('curInfo');
arrNum && arrNum.text(next+1);
};
};
//滑动主体
Gallery.prototype.slideRun = function() {
var self = this;
if (this.timer <= this.opts.duration) {
var position = Math.round(this.Tween.Quart.easeOut(this.timer, this.begin, this.change, this.opts.duration))
this.slideWrap.scrollLeft(position);
this.timer++;
this.timeId = setTimeout(function() {self.slideRun()}, this.opts.interval)
} else {
this.timer = 0;
this.auto && this.setBeforeSlide()
}
};
/*================转化===============*/
//转化为jquery插件
$.fn.gallery = function(opts) {
return this.each(function() {
$(this).data('gallery') || $(this).data('gallery', new Gallery(opts ? opts : {}, $(this)))
});
}
})(jQuery);
/************
* name: drag
* date: 2014-04-03
**************/
(function($){
function Drag(opts,ele){
this.opts = $.extend({}, this.args, opts ? opts : {});
this.msLeft=0;
this.sLeft=0;
this.handle=ele;
this.handle.bind('mousedown',{self:this},this.down);
};
Drag.prototype.args={
ready: function(){},
moveCall:function(){},
upCall:function(){},
max:1000,
min:0,
limit:5,
};
Drag.prototype.down=function(e){
var self=e.data.self;
self.opts.ready(self.opts);
self.msLeft=e.pageX;
self.sLeft=parseInt(self.handle.css('left'));
self.handle.addClass('down');
$(document).bind('mousemove',{self:self},self.move).bind('mouseup',{self:self},self.up);
};
Drag.prototype.move=function(e){
var self=e.data.self,
msEndX=e.pageX,
distance=msEndX-self.msLeft,
finalLeft=Math.min(Math.max(self.sLeft+distance, self.opts.min+self.opts.limit), self.opts.max-self.opts.limit);
self.handle.css({left: finalLeft});
self.opts.moveCall(msEndX)
};
Drag.prototype.up=function(e){
// console.log('up!')
var self=e.data.self,
left=parseInt(self.handle.css('left'));
$(document).unbind('mousemove',self.move).unbind('mouseup',self.up);
self.handle.removeClass('down');
self.opts.upCall(self.handle,left,self.opts.max,self.opts.min);
};
$.fn.iqlDrag = function(opts) {
return this.each(function() {
$(this).data('iqlDrag') || $(this).data('iqlDrag', new Drag(opts ? opts : {}, $(this)))
});
}
})(jQuery);
/**tabs**/
(function($){
$.fn.tinyTab=function(){
return this.each(function(){
var tabPane=$('.tab-pane',this),
tabContent=$('.tab-content',this),
panes=$('.tab',tabPane),
contents=$('.tc',tabContent);
panes.eq(0).addClass('on');
contents.eq(0).addClass('active');
panes.click(function(e){
e.preventDefault();
$('.on',tabPane).removeClass('on');
$(this).addClass('on');
$('.active',tabContent).removeClass('active');
contents.eq(panes.index($(this))).addClass('active');
})
})
};
})(jQuery);
/************
* name: layer
* date: 2014-04-03
**************/

View File

@ -0,0 +1,395 @@
<!doctype html>
<html lang="en">
<head>
<base href="/news/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/template/css/default.css" >
<link rel="stylesheet" type="text/css" href="assets/js/vendor/template/css/layout.css" >
<link rel="stylesheet" type="text/css" href="assets/js/vendor/template/css/jquery-gallery.css"/>
<link rel="stylesheet" type="text/css" href="assets/js/vendor/template/css/jquery.bigcolorpicker.css"/>
<!-- layui.css、admin.css -->
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<!-- layui.css、admin.css -->
<style type="text/css" id="css-wrap"></style>
<script type="text/javascript" src="assets/js/vendor/template/js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="assets/js/vendor/template/js/jquery-ui.js"></script>
<script type="text/javascript" src="assets/js/vendor/template/js/jquery.bigcolorpicker.js"></script>
<script type="text/javascript" src="assets/js/vendor/template/js/widgets.js"></script>
<script type="text/javascript" src="assets/js/vendor/template/js/bases.js"></script>
</head>
<body>
<!--顶部按钮-->
<div class="file-btns">
<div class="logo-sec"><a href="javascript:void(0)">SPEC</a></div>
<ul>
<li><a href="" id="edit" class="active">编辑</a></li>
<li><a href="" id="preview">预览</a></li>
<li><a href="" id="back">撤销</a></li>
<li><a href="" id="forward">重做</a></li>
<li><a href="" id="clean-up">清空</a></li>
<li><a href="" id="save">保存</a></li>
<li><a href="" id="download">下载</a></li>
</ul>
</div>
<!--end-->
<!--拖拽元素-->
<div class="side-bar">
<div class="logo">
<a href="javascript:void(0)">SPEC</a>
</div>
<div class="sidebar-nav">
<ul class="top-nav">
<li>
<a href="" class="layout"><span>布局</span></a>
<ul class="sub-nav">
<li>
<div class="lyrow" data-type="row">
<span class="preview">通栏</span>
<div class="ctrl-btns">
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="row">
<div class="col"></div>
</div>
</div>
</div>
</li>
<li>
<div class="lyrow">
<span class="preview">两栏</span>
<div class="ctrl-btns">
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="row">
<div class="col col-50"></div>
<div class="col col-50"></div>
</div>
</div>
</div>
</li>
<li>
<div class="lyrow">
<span class="preview">三栏</span>
<div class="ctrl-btns">
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="row">
<div class="col col-33"></div>
<div class="col col-33"></div>
<div class="col col-33"></div>
</div>
</div>
</div>
</li>
<li>
<div class="lyrow">
<span class="preview">四栏</span>
<div class="ctrl-btns">
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="row">
<div class="col col-25"></div>
<div class="col col-25"></div>
<div class="col col-25"></div>
<div class="col col-25"></div>
</div>
</div>
</div>
</li>
<li class="last">
<div class="lyrow">
<span class="preview">五栏</span>
<div class="ctrl-btns">
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="row">
<div class="col col-20"></div>
<div class="col col-20"></div>
<div class="col col-20"></div>
<div class="col col-20"></div>
<div class="col col-20"></div>
</div>
</div>
</div>
</li>
</ul>
</li>
<li>
<a href="" class="elements"><span>元素</span></a>
<ul class="sub-nav">
<li>
<div class="box" data-type="head">
<span class="preview">标题</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<h2>从工作报告看改革大棋如何“落子”</h2>
</div>
</div>
</li>
<li>
<div class="box" data-type="paragraph">
<span class="preview">段落</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<p>自去年两会以来新一届国家领导集体履职即将满年各项内政外交大政方针有序铺开。本次全国人大会议上李克强首次以总理身份做工作报告代表国务院总结履职首年的工作并部署2014年的工作。在全面深化改革的开局之年如何推进十八届三中全会部署改革大棋如何“落子”无疑是此次工作报告的最大看点。</p>
</div>
</div>
</li>
<li>
<div class="box" data-type="list">
<span class="preview">列表</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<ul>
<li><a href="">终结越级上访重申法律原有之意</a></li>
<li><a href="">中国为何坚决反对朝鲜拥核</a></li>
<li><a href="">两岸破局,马英九当更进一步</a></li>
<li><a href="">钟南山的“医改变改医”也要两面看</a></li>
</ul>
</div>
</div>
</li>
<li class="last">
<div class="box" data-type="image">
<span class="preview">图片</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<img src="assets/js/vendor/template/img/demo.jpg" alt="" />
</div>
</div>
</li>
</ul>
</li>
<li>
<a href="" class="widgets"><span>组件</span></a>
<ul class="sub-nav">
<li>
<div class="wdg" data-type="gallery">
<span class="preview">幻灯</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="slider">
<div>
<ul>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="1" /></a></li>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="2" /></a></li>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="3" /></a></li>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="4" /></a></li>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="5" /></a></li>
<li><a href=""><img src="assets/js/vendor/template/img/demo.jpg" alt="6" /></a></li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="last">
<div class="wdg" data-type="other">
<span class="preview">其他</span>
<div class="ctrl-btns">
<span class="edit">编辑</span>
<span class="drag">拖拽</span>
<span class="remove">删除</span>
</div>
<div class="view">
<div class="other-demo">其他组件</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!--end-->
<!--预览区域-->
<div class="doc-wrap" id="doc-wrap">
<div class="demo">
</div>
</div>
<!--end-->
<!--弹窗区域-->
<div class="modals" id="doc-wrap">
<div class="edit-layer modal tabs">
<a href="" class="close">X</a>
<div class="tab-pane">
<a href="" class="tab">样式</a>
<a href="" class="tab">数据</a>
<a href="" class="tab">模板</a>
</div>
<div class="tab-content">
<div class="tc css-edit">
<form action="">
<table>
<tr>
<td colspan="2">不可编辑</td>
</tr>
<tr class="size">
<td>尺寸:</td>
<td>
<div><label for="">宽度:</label><p><input type="text" name="width" class="size"/><span>px</span></p></div>
<div><label for="">高度:</label><p><input type="text" name="height" class="size"/><span>px</span></p></div>
</td>
</tr>
<tr class="background">
<td>背景:</td>
<td><div><label for="">颜色:</label><p><input type="text" name="background-color" class="color-picker"/></p></div></td>
</tr>
<tr class="border">
<td>边框:</td>
<td>
<div><label for="">颜色:</label><p><input type="text" name="border-color" class="color-picker"/></p></div>
<div><label for="">厚度:</label><p><input type="text" name="border-width" class="size"/><span>px</span></p></div>
<div class="float">
<label for="">样式:</label>
<p>
<select name="border-style" id="">
<option value=""></option>
<option value="solid">实线</option>
<option value="dashed">虚线</option>
<option value="dotted">点线</option>
</select>
</p>
</div>
</td>
</tr>
<tr class="text">
<td>文字:</td>
<td>
<div><label for="">颜色:</label><p><input type="text" name="color" class="color-picker"/></p></div>
<div><label for="">大小:</label><p><input type="text" name="font-size" class="size"/><span>px</span></p></div>
<div><label for="">行高:</label><p><input type="text" name="line-height" class="size"/><span>px</span></p></div>
<div><label for="">字体:</label><p><input type="text" name="font-family" /></p></div>
<div class="float">
<label for="">样式:</label>
<p>
<select name="font-style" id="">
<option value=""></option>
<option value="italic">普通</option>
<option value="italic">斜体</option>
</select>
</p>
</div>
<div class="float">
<label for="">对齐:</label>
<p>
<select name="text-align" id="">
<option value=""></option>
<option value="left">左对齐</option>
<option value="center">中间对齐</option>
<option value="right">右对齐</option>
</select>
</p>
</div>
<div>
<label for="">粗细:</label>
<p>
<select name="font-weight" id="">
<option value=""></option>
<option value="normal">普通</option>
<option value="bold">加粗</option>
<option value="bolder">特粗</option>
</select>
</p>
</div>
</td>
</tr>
<tr>
<td colspan="2" class="submit"><button type="submit" name="submit" class="submitted">保存</button></td>
</tr>
</table>
</form>
</div>
<div class="tc">
<form action="">
</form>
</div>
<div class="tc">
<form action="">
</form>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate','laytpl','form','common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var laytpl = layui.laytpl;
var common = layui.common;
var resizeTimeout = null;
var form = layui.form;
var viewerObj = {};
var tableUrl = 'api/template/totemplate';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
page: true,
});
}
});
</script>
</body>
</html>