崔宝铖提交

This commit is contained in:
cuibaocheng 2020-11-02 15:47:39 +08:00
parent 5d7306e38c
commit fe09aa380b
59 changed files with 130894 additions and 2618 deletions

View File

@ -13,12 +13,12 @@ import com.cm.news.pojo.dtos.newsantistop.NewsAntistopDTO;
import com.cm.news.pojo.vos.newsantistop.NewsAntistopVO; import com.cm.news.pojo.vos.newsantistop.NewsAntistopVO;
import com.cm.news.service.newsantistop.INewsAntistopService; import com.cm.news.service.newsantistop.INewsAntistopService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.shiro.crypto.hash.Hash;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @ClassName: NewsAntistopAppController * @ClassName: NewsAntistopAppController

View File

@ -72,4 +72,6 @@ public interface INewsCommentDao {
void updateNewsCommentStatus(Map<String, Object> params) throws UpdateException; void updateNewsCommentStatus(Map<String, Object> params) throws UpdateException;
List<NewsCommentDTO> getNewsCommentByNewsContentIdAndCommentContent(Map<String, Object> queryParams) throws SearchException; List<NewsCommentDTO> getNewsCommentByNewsContentIdAndCommentContent(Map<String, Object> queryParams) throws SearchException;
Integer getCountByNewsContentId(Map<String, Object> params) throws SearchException;
} }

View File

@ -64,4 +64,6 @@ public interface INewsCommentLikeDao {
List<NewsCommentLikeDTO> listNewsCommentLike(Map<String, Object> params) throws SearchException; List<NewsCommentLikeDTO> listNewsCommentLike(Map<String, Object> params) throws SearchException;
NewsCommentLikeDTO getByNewsCommentId(Map<String, Object> params) throws SearchException; NewsCommentLikeDTO getByNewsCommentId(Map<String, Object> params) throws SearchException;
Integer getCountByNewsContentId(Map<String, Object> params) throws SearchException;
} }

View File

@ -81,4 +81,6 @@ public interface INewsContentCollectDao {
Integer countNewsContentCollect(Map<String, Object> params) throws SearchException; Integer countNewsContentCollect(Map<String, Object> params) throws SearchException;
NewsContentCollectDTO getNewsContentCollectByNewsContentIdAndUserId(Map<String, Object> map) throws SearchException; NewsContentCollectDTO getNewsContentCollectByNewsContentIdAndUserId(Map<String, Object> map) throws SearchException;
Integer getCountByNewsContentId(Map<String, Object> params) throws SearchException;
} }

View File

@ -81,4 +81,6 @@ public interface INewsContentLikeDao {
Integer countNewsContentLike(Map<String, Object> params) throws SearchException; Integer countNewsContentLike(Map<String, Object> params) throws SearchException;
NewsContentLikeDTO getNewsContentLikeByNewsContentIdAndUserId(Map<String, Object> map) throws SearchException; NewsContentLikeDTO getNewsContentLikeByNewsContentIdAndUserId(Map<String, Object> map) throws SearchException;
Integer getCountByNewsContentId(Map<String, Object> params) throws SearchException;
} }

View File

@ -212,6 +212,7 @@ public class TemplateUtil {
temp.process(params, writer); temp.process(params, writer);
writer.flush(); writer.flush();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new SaveException("生成静态资源异常"); throw new SaveException("生成静态资源异常");
} }
/** /**

View File

@ -113,4 +113,6 @@ public interface INewsCommentService {
SuccessResult saveNewsCommentDislikeCount(String newsCommentId) throws Exception; SuccessResult saveNewsCommentDislikeCount(String newsCommentId) throws Exception;
SuccessResult updateNewsCommentStatus(String newsCommentId, NewsCommentViolationVO newsCommentViolationVO) throws Exception; SuccessResult updateNewsCommentStatus(String newsCommentId, NewsCommentViolationVO newsCommentViolationVO) throws Exception;
Integer getCountByNewsContentId(String newsContentId) throws SearchException;
} }

View File

@ -248,4 +248,11 @@ public class NewsCommentServiceImpl extends BaseService implements INewsCommentS
return new SuccessResult(); return new SuccessResult();
} }
@Override
public Integer getCountByNewsContentId(String newsContentId) throws SearchException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("newsContentId", newsContentId);
return newsCommentDao.getCountByNewsContentId(params);
}
} }

View File

@ -110,4 +110,5 @@ public interface INewsCommentLikeService {
NewsCommentLikeDTO getByNewsCommentId(String token, String newsCommentId) throws SearchException; NewsCommentLikeDTO getByNewsCommentId(String token, String newsCommentId) throws SearchException;
} }

View File

@ -172,4 +172,5 @@ public class NewsCommentLikeServiceImpl extends BaseService implements INewsComm
return newsCommentLikeDao.getByNewsCommentId(params); return newsCommentLikeDao.getByNewsCommentId(params);
} }
} }

View File

@ -118,4 +118,5 @@ public interface INewsContentService {
SuccessResultData<Integer> countShowData(Map<String, Object> params) throws SearchException; SuccessResultData<Integer> countShowData(Map<String, Object> params) throws SearchException;
} }

View File

@ -31,10 +31,13 @@ import com.cm.news.pojo.vos.newscontentcover.NewsContentCoverVO;
import com.cm.news.pojo.vos.newscontentfile.NewsContentFileVO; import com.cm.news.pojo.vos.newscontentfile.NewsContentFileVO;
import com.cm.news.pojo.vos.newslabelconfig.NewsLabelConfigVO; import com.cm.news.pojo.vos.newslabelconfig.NewsLabelConfigVO;
import com.cm.news.service.BaseService; import com.cm.news.service.BaseService;
import com.cm.news.service.newscomment.INewsCommentService;
import com.cm.news.service.newscommentlike.INewsCommentLikeService;
import com.cm.news.service.newscontent.INewsContentService; import com.cm.news.service.newscontent.INewsContentService;
import com.cm.news.service.newscontentcollect.INewsContentCollectService; import com.cm.news.service.newscontentcollect.INewsContentCollectService;
import com.cm.news.service.newscontentcover.INewsContentCoverService; import com.cm.news.service.newscontentcover.INewsContentCoverService;
import com.cm.news.service.newscontentfile.INewsContentFileService; import com.cm.news.service.newscontentfile.INewsContentFileService;
import com.cm.news.service.newscontentlike.INewsContentLikeService;
import com.cm.news.service.newsdirectories.INewsDirectoriesService; import com.cm.news.service.newsdirectories.INewsDirectoriesService;
import com.cm.news.service.newslabel.INewsLabelService; import com.cm.news.service.newslabel.INewsLabelService;
import com.cm.news.service.newslabelconfig.INewsLabelConfigService; import com.cm.news.service.newslabelconfig.INewsLabelConfigService;
@ -75,6 +78,10 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
@Autowired @Autowired
private INewsContentCollectService iNewsContentCollectService; private INewsContentCollectService iNewsContentCollectService;
@Autowired @Autowired
private INewsCommentService iNewsCommentService;
@Autowired
private INewsContentLikeService iNewsContentLikeService;
@Autowired
private IUserService iUserService; private IUserService iUserService;
@Autowired @Autowired
private TemplateProperties templateProperties; private TemplateProperties templateProperties;
@ -389,7 +396,22 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
// 第二步 查找配置的标签项 // 第二步 查找配置的标签项
List<NewsLabelConfigDTO> configList = iNewsLabelConfigService.getNewsLabelConfigByNewsContentId(appDTO.getNewsContentId()); List<NewsLabelConfigDTO> configList = iNewsLabelConfigService.getNewsLabelConfigByNewsContentId(appDTO.getNewsContentId());
appDTO.setNewsContentLabelList(configList); appDTO.setNewsContentLabelList(configList);
// 第三步 是否收藏 /***
* 2020年10月19日10:44:08添加三四五步骤 , 之前在mapper中为子表查询
*/
// 第三步 查找评论数
Integer commentCount = iNewsCommentService.getCountByNewsContentId(appDTO.getNewsContentId());
// 第四步 查找点赞数
Integer commentLikeCount = iNewsContentLikeService.getCountByNewsContentId(appDTO.getNewsContentId());
// 第五步 查找收藏数
Integer collectCount = iNewsContentCollectService.getCountByNewsContentId(appDTO.getNewsContentId());
appDTO.setNewsContentCommentNumber(commentCount);
appDTO.setNewsContentCollectionNumber(collectCount);
appDTO.setNewsContentLikeNumber(commentLikeCount);
// 第六步 是否收藏
if(!StringUtil.isEmpty(userId)) { if(!StringUtil.isEmpty(userId)) {
NewsContentCollectDTO likeDTO = iNewsContentCollectService.getNewsContentCollectByNewsContentIdAndUserId(userId, appDTO.getNewsContentId()); NewsContentCollectDTO likeDTO = iNewsContentCollectService.getNewsContentCollectByNewsContentIdAndUserId(userId, appDTO.getNewsContentId());
if(likeDTO == null) { if(likeDTO == null) {

View File

@ -153,4 +153,5 @@ public interface INewsContentCollectService {
*/ */
SuccessResultData<Integer> countNewsContentCollect(Map<String, Object> params) throws SearchException; SuccessResultData<Integer> countNewsContentCollect(Map<String, Object> params) throws SearchException;
Integer getCountByNewsContentId(String newsContentId) throws SearchException;
} }

View File

@ -201,4 +201,11 @@ public class NewsContentCollectServiceImpl extends BaseService implements INewsC
return new SuccessResultData<>(countNumberNewsContentCollect(params)); return new SuccessResultData<>(countNumberNewsContentCollect(params));
} }
@Override
public Integer getCountByNewsContentId(String newsContentId) throws SearchException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("newsContentId", newsContentId);
return newsContentCollectDao.getCountByNewsContentId(params);
}
} }

View File

@ -155,4 +155,5 @@ public interface INewsContentLikeService {
*/ */
SuccessResultData<Integer> countNewsContentLike(Map<String, Object> params) throws SearchException; SuccessResultData<Integer> countNewsContentLike(Map<String, Object> params) throws SearchException;
Integer getCountByNewsContentId(String newsContentId) throws SearchException;
} }

View File

@ -201,4 +201,11 @@ public class NewsContentLikeServiceImpl extends BaseService implements INewsCont
return new SuccessResultData<>(countNumberNewsContentLike(params)); return new SuccessResultData<>(countNumberNewsContentLike(params));
} }
@Override
public Integer getCountByNewsContentId(String newsContentId) throws SearchException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("newsContentId", newsContentId);
return newsContentLikeDao.getCountByNewsContentId(params);
}
} }

View File

@ -1,12 +1,5 @@
# 访问其他项目 freemarker-template:
template: nginx-address: http://192.168.0.115:8088/
titile: 模板项目
creatTemplate-url: http://192.168.0.111:8081/template/resource/template/creattemplaterelease
# 智慧网闸配置
net-management:
config-path: D:\\net_manager_libs\\
so-path: D:\\net_manager_libs\\
news: news:
nginxAddress: http://192.168.0.115:8089/ # Nginx地址 nginxAddress: http://192.168.0.115:8089/ # Nginx地址
@ -35,8 +28,9 @@ socket:
server: server:
port: 8082 port: 8082
url: http://192.168.0.104:8082/news url: http://192.168.0.115:8082/news
title: news title: news
portal-url: http://www.wgink.ink/menhu
servlet: servlet:
context-path: /news context-path: /news
@ -100,13 +94,13 @@ file:
imageTypes: png,jpg,jpeg,gif,blob imageTypes: png,jpg,jpeg,gif,blob
videoTypes: mp4,rmvb videoTypes: mp4,rmvb
audioTypes: mp3,wmv audioTypes: mp3,wmv
fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf,html fileTypes: doc,docx,xls,xlsx,ppt,pptx,txt,zip,rar,apk,pdf,html,css,js,jpg
maxFileCount: 6 maxFileCount: 6
# 安全 # 安全
security: security:
oauth2: oauth2:
oauth-server: http://192.168.0.113:7001/usercenter oauth-server: http://49.233.36.36:8868/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url} oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client: client:
client-id: f8190a1a94354105b3748ad3ec40a64d client-id: f8190a1a94354105b3748ad3ec40a64d

View File

@ -21,6 +21,15 @@
<result column="comment_address" property="commentAddress"/> <result column="comment_address" property="commentAddress"/>
</resultMap> </resultMap>
<select id="getCountByNewsContentId" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
gen_news_comment t1
WHERE
t1.is_delete = 0 AND t1.news_content_id = #{newsContentId}
</select>
<select id="getNewsCommentByNewsContentIdAndCommentContent" parameterType="map" resultMap="newsCommentDTO"> <select id="getNewsCommentByNewsContentIdAndCommentContent" parameterType="map" resultMap="newsCommentDTO">
SELECT SELECT
t1.news_content_id, t1.news_content_id,

View File

@ -269,7 +269,9 @@
<!-- 新闻内容的存储列表 --> <!-- 新闻内容的存储列表 -->
<select id="listNewsContentToApp" parameterType="map" resultMap="newsContentAppDTO"> <select id="listNewsContentToApp" parameterType="map" resultMap="newsContentAppDTO">
SELECT SELECT app.* FROM
(
SELECT
t1.news_content_title, t1.news_content_title,
t1.news_content_type, t1.news_content_type,
t1.news_content_publish_time, t1.news_content_publish_time,
@ -279,11 +281,15 @@
t1.news_content_link, t1.news_content_link,
t1.news_content_summary, t1.news_content_summary,
t1.news_content_publish_department, t1.news_content_publish_department,
t1.news_content_score,
t2.template_record_url, t2.template_record_url,
t3.typesetting_code, t3.typesetting_code,
(SELECT COUNT(1) FROM gen_news_comment temp1 WHERE temp1.news_content_id = t1.news_content_id AND temp1.is_delete = 0 ) news_content_comment_number, /* (SELECT COUNT(1) FROM gen_news_comment temp1 WHERE temp1.news_content_id = t1.news_content_id AND
(SELECT COUNT(1) FROM gen_news_content_collect temp2 WHERE temp2.news_content_id = t1.news_content_id AND temp2.is_delete = 0 ) news_content_collection_number, temp1.is_delete = 0 ) news_content_comment_number,
(SELECT COUNT(1) FROM gen_news_content_like temp3 WHERE temp3.news_content_id = t1.news_content_id AND temp3.is_delete = 0 ) news_content_like_number, (SELECT COUNT(1) FROM gen_news_content_collect temp2 WHERE temp2.news_content_id = t1.news_content_id AND
temp2.is_delete = 0 ) news_content_collection_number,
(SELECT COUNT(1) FROM gen_news_content_like temp3 WHERE temp3.news_content_id = t1.news_content_id AND
temp3.is_delete = 0 ) news_content_like_number,*/
t4.news_config_comment, t4.news_config_comment,
t4.news_config_comment_image, t4.news_config_comment_image,
t4.news_config_web_switch, t4.news_config_web_switch,
@ -291,76 +297,81 @@
t4.news_config_description_text, t4.news_config_description_text,
t4.news_config_top, t4.news_config_top,
t4.news_config_hot t4.news_config_hot
FROM FROM
gen_news_content t1 gen_news_content t1
LEFT JOIN LEFT JOIN
gen_news_template_record t2 gen_news_template_record t2
ON ON
t1.news_content_id = t2.news_content_id t1.news_content_id = t2.news_content_id
LEFT JOIN LEFT JOIN
gen_news_typesetting t3 gen_news_typesetting t3
ON ON
t1.news_typesetting_id = t3.news_typesetting_id t1.news_typesetting_id = t3.news_typesetting_id
LEFT JOIN LEFT JOIN
gen_news_content_config t4 gen_news_content_config t4
ON ON
(t1.news_content_id = t4.news_content_id AND t4.is_delete = 0) (t1.news_content_id = t4.news_content_id AND t4.is_delete = 0)
LEFT JOIN LEFT JOIN
gen_news_directories t5 gen_news_directories t5
ON ON
t1.news_directories_id = t5.news_directories_id t1.news_directories_id = t5.news_directories_id
WHERE WHERE
t1.is_delete = 0 AND t1.news_content_publish_status = '1' AND t1.news_content_check_status = '2' AND (t4.news_config_status IS NULL OR t4.news_config_status = 1) t1.is_delete = 0 AND t1.news_content_publish_status = '1' AND t1.news_content_check_status = '2' AND
<if test="queryCollect != null and queryCollect != ''"> (t4.news_config_status IS NULL OR t4.news_config_status = 1)
AND t1.news_content_id IN (SELECT temp.news_content_id FROM gen_news_content_collect temp WHERE temp.is_delete = 0 AND temp.creator = #{creator}) <if test="queryCollect != null and queryCollect != ''">AND t1.news_content_id IN (SELECT temp.news_content_id
</if> FROM gen_news_content_collect temp WHERE temp.
<if test="newsDirectoriesId != null and newsDirectoriesId != ''"> is_delete = 0 AND temp.creator = #{creator})
AND t1.news_directories_id = #{newsDirectoriesId} </if>
</if> <if test="
<if test="newsDirectoriesParentId != null and newsDirectoriesParentId != ''"> newsDirectoriesId != null and newsDirectoriesId != ''">
AND t5.directories_parent_id = #{newsDirectoriesParentId} AND t1.news_directories_id = #{newsDirectoriesId}
</if> </if>
<if test="newsContentType != null and newsContentType != ''"> <if test="newsDirectoriesParentId != null and newsDirectoriesParentId != ''">
AND t1.news_content_type = #{newsContentType} AND t5.directories_parent_id = #{newsDirectoriesParentId}
</if> </if>
<if test="currentUserId != null and currentUserId != ''"> <if test="newsContentType != null and newsContentType != ''">
AND (t1.creator = #{currentUserId} OR t1.modifier = #{currentUserId}) AND t1.news_content_type = #{newsContentType}
</if> </if>
<if test="createUserIdList != null and createUserIdList.size > 0"> <if test="currentUserId != null and currentUserId != ''">
AND ( t1.creator = '1' OR AND (t1.creator = #{currentUserId} OR t1.modifier = #{currentUserId})
t1.creator IN </if>
<foreach collection="createUserIdList" index="index" open="(" separator="," close=")"> <if test="createUserIdList != null and createUserIdList.size > 0">
#{createUserIdList[${index}]} AND ( t1.creator = '1' OR
</foreach> ) t1.creator IN
</if> <foreach collection="createUserIdList" index="index" open="(" separator="," close=")">
<if test="keywords != null and keywords != ''"> #{createUserIdList[${index}]}
AND </foreach
( > )
t1.news_content_resource LIKE CONCAT('%', #{keywords}, '%') </if>
OR <if test="keywords != null and keywords != ''">
t1.news_content_title LIKE CONCAT('%', #{keywords}, '%') AND
OR (
t1.news_content_content LIKE CONCAT('%', #{keywords}, '%') t1.news_content_resource LIKE CONCAT('%', #{keywords}, '%')
OR OR
t1.news_content_author LIKE CONCAT('%', #{keywords}, '%') t1.news_content_title LIKE CONCAT('%', #{keywords}, '%')
) OR
</if> t1.news_content_content LIKE CONCAT('%', #{keywords}, '%')
<if test="startTime != null and startTime != ''"> OR
AND t1.news_content_author LIKE CONCAT('%', #{keywords}, '%')
LEFT(t1.news_content_publish_time, 10) <![CDATA[ >= ]]> #{startTime} )
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="startTime != null and startTime != ''">
AND AND
LEFT(t1.news_content_publish_time, 10) <![CDATA[ <= ]]> #{endTime} LEFT(t1.news_content_publish_time, 10) <![CDATA[ >= ]]> #{startTime}
</if> </if>
<if test="newsContentIds != null and newsContentIds.size > 0"> <if test="endTime != null and endTime != ''">
AND AND
t1.news_content_id IN LEFT(t1.news_content_publish_time, 10) <![CDATA[ <= ]]> #{endTime}
<foreach collection="newsContentIds" index="index" open="(" separator="," close=")"> </if>
#{newsContentIds[${index}]} <if test="newsContentIds != null and newsContentIds.size > 0">
</foreach> AND
</if> t1.news_content_id IN
ORDER BY t4.news_config_top DESC, t4.news_config_hot DESC, t1.news_content_score DESC , t1.news_content_publish_time DESC <foreach collection="newsContentIds" index="index" open="(" separator="," close=")">
#{newsContentIds[${index}]}
</foreach>
</if>
) app
ORDER BY app.news_config_top DESC, app.news_config_hot DESC, app.news_content_score DESC , app.news_content_publish_time DESC
</select> </select>
<!-- 新闻内容的存储列表 --> <!-- 新闻内容的存储列表 -->

View File

@ -7,6 +7,15 @@
<result column="news_content_id" property="newsContentId"/> <result column="news_content_id" property="newsContentId"/>
</resultMap> </resultMap>
<select id="getCountByNewsContentId" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
gen_news_content_collect t1
WHERE
t1.is_delete = 0 AND t1.news_content_id = #{newsContentId}
</select>
<select id="getNewsContentCollectByNewsContentIdAndUserId" parameterType="map" resultMap="newsContentCollectDTO"> <select id="getNewsContentCollectByNewsContentIdAndUserId" parameterType="map" resultMap="newsContentCollectDTO">
SELECT SELECT
news_content_collect_id, news_content_collect_id,

View File

@ -7,6 +7,16 @@
<result column="news_content_id" property="newsContentId"/> <result column="news_content_id" property="newsContentId"/>
</resultMap> </resultMap>
<select id="getCountByNewsContentId" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
gen_news_content_like t1
WHERE
t1.is_delete = 0 AND t1.news_content_id = #{newsContentId}
</select>
<select id="getNewsContentLikeByNewsContentIdAndUserId" parameterType="map" resultMap="newsContentLikeDTO"> <select id="getNewsContentLikeByNewsContentIdAndUserId" parameterType="map" resultMap="newsContentLikeDTO">
SELECT SELECT
news_content_like_id, news_content_like_id,

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,47 @@
/* Syntax highlighting for JSON objects */
ul.json-dict, ol.json-array {
list-style-type: none;
margin: 0 0 0 1px;
border-left: 1px dotted #ccc;
padding-left: 2em;
}
.json-string {
color: #0B7500;
}
.json-literal {
color: #1A01CC;
font-weight: bold;
}
/* Toggle button */
a.json-toggle {
position: relative;
color: inherit;
text-decoration: none;
}
a.json-toggle:focus {
outline: none;
}
a.json-toggle:before {
color: #aaa;
content: "\25BC"; /* down arrow */
position: absolute;
display: inline-block;
width: 1em;
left: -1em;
}
a.json-toggle.collapsed:before {
transform: rotate(-90deg); /* Use rotated down arrow, prevents right arrow appearing smaller than down arrow in some browsers */
-ms-transform: rotate(-90deg);
-webkit-transform: rotate(-90deg);
}
/* Collapsable placeholder links */
a.json-placeholder {
color: #aaa;
padding: 0 1em;
text-decoration: none;
}
a.json-placeholder:hover {
text-decoration: underline;
}

View File

@ -0,0 +1,148 @@
/**
* jQuery json-viewer
* @author: Alexandre Bodelot <alexandre.bodelot@gmail.com>
*/
(function($){
/**
* Check if arg is either an array with at least 1 element, or a dict with at least 1 key
* @return boolean
*/
function isCollapsable(arg) {
return arg instanceof Object && Object.keys(arg).length > 0;
}
/**
* Check if a string represents a valid url
* @return boolean
*/
function isUrl(string) {
var regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
return regexp.test(string);
}
/**
* Transform a json object into html representation
* @return string
*/
function json2html(json, options) {
var html = '';
if (typeof json === 'string') {
/* Escape tags */
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
if (isUrl(json))
html += '<a href="' + json + '" class="json-string">' + json + '</a>';
else
html += '<span class="json-string">"' + json + '"</span>';
}
else if (typeof json === 'number') {
html += '<span class="json-literal">' + json + '</span>';
}
else if (typeof json === 'boolean') {
html += '<span class="json-literal">' + json + '</span>';
}
else if (json === null) {
html += '<span class="json-literal">null</span>';
}
else if (json instanceof Array) {
if (json.length > 0) {
html += '[<ol class="json-array">';
for (var i = 0; i < json.length; ++i) {
html += '<li>';
/* Add toggle button if item is collapsable */
if (isCollapsable(json[i])) {
html += '<a href class="json-toggle"></a>';
}
html += json2html(json[i], options);
/* Add comma if item is not last */
if (i < json.length - 1) {
html += ',';
}
html += '</li>';
}
html += '</ol>]';
}
else {
html += '[]';
}
}
else if (typeof json === 'object') {
var key_count = Object.keys(json).length;
if (key_count > 0) {
html += '{<ul class="json-dict">';
for (var key in json) {
if (json.hasOwnProperty(key)) {
html += '<li>';
var keyRepr = options.withQuotes ?
'<span class="json-string">"' + key + '"</span>' : key;
/* Add toggle button if item is collapsable */
if (isCollapsable(json[key])) {
html += '<a href class="json-toggle">' + keyRepr + '</a>';
}
else {
html += keyRepr;
}
html += ': ' + json2html(json[key], options);
/* Add comma if item is not last */
if (--key_count > 0)
html += ',';
html += '</li>';
}
}
html += '</ul>}';
}
else {
html += '{}';
}
}
return html;
}
/**
* jQuery plugin method
* @param json: a javascript object
* @param options: an optional options hash
*/
$.fn.jsonViewer = function(json, options) {
options = options || {};
/* jQuery chaining */
return this.each(function() {
/* Transform to HTML */
var html = json2html(json, options);
if (isCollapsable(json))
html = '<a href class="json-toggle"></a>' + html;
/* Insert HTML in target DOM element */
$(this).html(html);
/* Bind click on toggle buttons */
$(this).off('click');
$(this).on('click', 'a.json-toggle', function() {
var target = $(this).toggleClass('collapsed').siblings('ul.json-dict, ol.json-array');
target.toggle();
if (target.is(':visible')) {
target.siblings('.json-placeholder').remove();
}
else {
var count = target.children('li').length;
var placeholder = count + (count > 1 ? ' items' : ' item');
target.after('<a href class="json-placeholder">' + placeholder + '</a>');
}
return false;
});
/* Simulate click on toggle button when placeholder is clicked */
$(this).on('click', 'a.json-placeholder', function() {
$(this).siblings('a.json-toggle').click();
return false;
});
if (options.collapsed == true) {
/* Trigger click to collapse all nodes */
$(this).find('a.json-toggle').click();
}
});
};
})(jQuery);

View File

@ -0,0 +1,228 @@
/**
* ContextJS Styles
* For use WITHOUT Twitters Bootstrap CSS
*/
.nav-header {
display: block;
padding: 3px 15px;
font-size: 11px;
font-weight: bold;
line-height: 20px;
color: #999;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-transform: uppercase;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
list-style: none;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
text-align:left;
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
*width: 100%;
height: 1px;
margin: 9px 1px;
*margin: -5px 0 5px;
overflow: hidden;
background-color: #e5e5e5;
border-bottom: 1px solid #ffffff;
}
.dropdown-menu a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 20px;
color: #333333;
white-space: nowrap;
text-decoration: none;
}
.dropdown-menu li > a:hover, .dropdown-menu li > a:focus, .dropdown-submenu:hover > a {
color: #ffffff;
text-decoration: none;
background-color: #0088cc;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid: dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}
.dropdown-menu .active > a, .dropdown-menu .active > a:hover {
color: #ffffff;
text-decoration: none;
background-color: #0088cc;
background-color: #0081c2;
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-repeat: repeat-x;
outline: 0;
filter: progid
: dximagetransform.microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}
.dropdown-menu .disabled > a, .dropdown-menu .disabled > a:hover {
color: #999999;
}
.dropdown-menu .disabled > a:hover {
text-decoration: none;
cursor: default;
background-color: transparent;
}
.open {
*z-index: 1000;
}
.open > .dropdown-menu {
display: block;
}
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
.dropup .caret, .navbar-fixed-bottom .dropdown .caret {
border-top: 0;
border-bottom: 4px solid #000000;
content: "\2191";
}
.dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 1px;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu > .dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px 6px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu > .dropdown-menu.drop-left{
left:-100%;
}
.dropdown-submenu:hover .dropdown-menu {
display: block;
}
.dropdown-submenu > a:after {
display: block;
float: right;
width: 0;
height: 0;
margin-top: 5px;
margin-right: -10px;
border-color: transparent;
border-left-color: #cccccc;
border-style: solid;
border-width: 5px 0 5px 5px;
content: " ";
}
.dropdown-submenu:hover > a:after {
border-left-color: #ffffff;
}
.dropdown .dropdown-menu .nav-header {
padding-right: 20px;
padding-left: 20px;
}
/**
* Context Styles
*/
.dropdown-context .nav-header {
cursor: default;
}
.dropdown-context:before, .dropdown-context-up:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-context:after, .dropdown-context-up:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
.dropdown-context-up:before, .dropdown-context-up:after {
top: auto;
bottom: -7px;
z-index: 9999;
}
.dropdown-context-up:before {
border-right: 7px solid transparent;
border-top: 7px solid #ccc;
border-bottom: none;
border-left: 7px solid transparent;
}
.dropdown-context-up:after {
border-right: 6px solid transparent;
border-top: 6px solid #ffffff;
border-left: 6px solid transparent;
border-bottom: none;
}
.dropdown-context-sub:before, .dropdown-context-sub:after {
display: none;
}
.dropdown-context .dropdown-submenu:hover .dropdown-menu {
display: none;
}
.dropdown-context .dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.compressed-context a{
padding-left: 14px;
padding-top: 0;
padding-bottom: 0;
font-size: 13px;
}
.compressed-context .divider{
margin: 5px 1px;
}
.compressed-context .nav-header{
padding:1px 13px;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View File

@ -0,0 +1,141 @@
/*
* Context.js
* Copyright Jacob Kelley
* MIT License
*/
var context = context || (function () {
var options = {
fadeSpeed: 100,
filter: function ($obj) {
// Modify $obj, Do not return
},
above: 'auto',
preventDoubleContext: true,
compress: false
};
function initialize(opts) {
options = $.extend({}, options, opts);
$(document).on('click', 'html', function () {
$('.dropdown-context').fadeOut(options.fadeSpeed, function(){
$('.dropdown-context').css({display:''}).find('.drop-left').removeClass('drop-left');
});
});
if(options.preventDoubleContext){
$(document).on('contextmenu', '.dropdown-context', function (e) {
e.preventDefault();
});
}
$(document).on('mouseenter', '.dropdown-submenu', function(){
var $sub = $(this).find('.dropdown-context-sub:first'),
subWidth = $sub.width(),
subLeft = $sub.offset().left,
collision = (subWidth+subLeft) > window.innerWidth;
if(collision){
$sub.addClass('drop-left');
}
});
}
function updateOptions(opts){
options = $.extend({}, options, opts);
}
function buildMenu(data, id, subMenu) {
var subClass = (subMenu) ? ' dropdown-context-sub' : '',
compressed = options.compress ? ' compressed-context' : '',
$menu = $('<ul class="dropdown-menu dropdown-context' + subClass + compressed+'" id="dropdown-' + id + '"></ul>');
var i = 0, linkTarget = '';
for(i; i<data.length; i++) {
if (typeof data[i].divider !== 'undefined') {
$menu.append('<li class="divider"></li>');
} else if (typeof data[i].header !== 'undefined') {
$menu.append('<li class="nav-header">' + data[i].header + '</li>');
} else {
if (typeof data[i].href == 'undefined') {
data[i].href = '#';
}
if (typeof data[i].target !== 'undefined') {
linkTarget = ' target="'+data[i].target+'"';
}
if (typeof data[i].subMenu !== 'undefined') {
$sub = ('<li class="dropdown-submenu"><a tabindex="-1" href="' + data[i].href + '">' + data[i].text + '</a></li>');
} else {
$sub = $('<li><a tabindex="-1" href="' + data[i].href + '"'+linkTarget+'>' + data[i].text + '</a></li>');
}
if (typeof data[i].action !== 'undefined') {
var actiond = new Date(),
actionID = 'event-' + actiond.getTime() * Math.floor(Math.random()*100000),
eventAction = data[i].action;
$sub.find('a').attr('id', actionID);
$('#' + actionID).addClass('context-event');
$(document).on('click', '#' + actionID, eventAction);
}
$menu.append($sub);
if (typeof data[i].subMenu != 'undefined') {
var subMenuData = buildMenu(data[i].subMenu, id, true);
$menu.find('li:last').append(subMenuData);
}
}
if (typeof options.filter == 'function') {
options.filter($menu.find('li:last'));
}
}
return $menu;
}
function addContext(selector, data) {
var d = new Date(),
id = d.getTime(),
$menu = buildMenu(data, id);
$('body').append($menu);
$(document).on('contextmenu', selector, function (e) {
e.preventDefault();
e.stopPropagation();
$('.dropdown-context:not(.dropdown-context-sub)').hide();
$dd = $('#dropdown-' + id);
if (typeof options.above == 'boolean' && options.above) {
$dd.addClass('dropdown-context-up').css({
top: e.pageY - 20 - $('#dropdown-' + id).height(),
left: e.pageX - 13
}).fadeIn(options.fadeSpeed);
} else if (typeof options.above == 'string' && options.above == 'auto') {
$dd.removeClass('dropdown-context-up');
var autoH = $dd.height() + 12;
if ((e.pageY + autoH) > $('html').height()) {
$dd.addClass('dropdown-context-up').css({
top: e.pageY - 20 - autoH,
left: e.pageX - 13
}).fadeIn(options.fadeSpeed);
} else {
$dd.css({
top: e.pageY + 10,
left: e.pageX - 13
}).fadeIn(options.fadeSpeed);
}
}
});
}
function destroyContext(selector) {
$(document).off('contextmenu', selector).off('click', '.context-event');
}
return {
init: initialize,
settings: updateOptions,
attach: addContext,
destroy: destroyContext
};
})();

View File

@ -0,0 +1,45 @@
/**
* author levi
* url http://levi.cg.am
*/
$(function() {
function debug(msg){
$("#debug").text(msg + "\n");
}
$(document).mousemove(function(e) {
if (!!this.move) {
var posix = !document.move_target ? {'x': 0, 'y': 0} : document.move_target.posix,
callback = document.call_down || function() {
var posTop = e.pageY - posix.y, posLeft = e.pageX - posix.x;
var canvas = $(this.move_target).parent();
if(posTop < 0){
posTop = 0;
}else if(posTop > canvas.innerHeight() - $(this.move_target).height()){
posTop = canvas.innerHeight() - $(this.move_target).height();
}
if(posLeft < 0){
posLeft = 0;
}else if(posLeft > canvas.innerWidth() - $(this.move_target).width()){
posLeft = canvas.innerWidth() - $(this.move_target).width();
}
$(this.move_target).css({
'top': posTop,
'left': posLeft
});
};
callback.call(this, e, posix);
return false;
}
}).mouseup(function(e) {
if (!!this.move) {
var callback = document.call_up || function(){};
callback.call(this, e);
$.extend(this, {
'move': false,
'move_target': null,
'call_down': false,
'call_up': false
});
}
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,16 @@
(function(){function C(){var a="{}";if("userDataBehavior"==f){g.load("jStorage");try{a=g.getAttribute("jStorage")}catch(b){}try{r=g.getAttribute("jStorage_update")}catch(c){}h.jStorage=a}D();x();E()}function u(){var a;clearTimeout(F);F=setTimeout(function(){if("localStorage"==f||"globalStorage"==f)a=h.jStorage_update;else if("userDataBehavior"==f){g.load("jStorage");try{a=g.getAttribute("jStorage_update")}catch(b){}}if(a&&a!=r){r=a;var l=p.parse(p.stringify(c.__jstorage_meta.CRC32)),k;C();k=p.parse(p.stringify(c.__jstorage_meta.CRC32));
var d,n=[],e=[];for(d in l)l.hasOwnProperty(d)&&(k[d]?l[d]!=k[d]&&"2."==String(l[d]).substr(0,2)&&n.push(d):e.push(d));for(d in k)k.hasOwnProperty(d)&&(l[d]||n.push(d));s(n,"updated");s(e,"deleted")}},25)}function s(a,b){a=[].concat(a||[]);var c,k,d,n;if("flushed"==b){a=[];for(c in m)m.hasOwnProperty(c)&&a.push(c);b="deleted"}c=0;for(d=a.length;c<d;c++){if(m[a[c]])for(k=0,n=m[a[c]].length;k<n;k++)m[a[c]][k](a[c],b);if(m["*"])for(k=0,n=m["*"].length;k<n;k++)m["*"][k](a[c],b)}}function v(){var a=(+new Date).toString();
if("localStorage"==f||"globalStorage"==f)try{h.jStorage_update=a}catch(b){f=!1}else"userDataBehavior"==f&&(g.setAttribute("jStorage_update",a),g.save("jStorage"));u()}function D(){if(h.jStorage)try{c=p.parse(String(h.jStorage))}catch(a){h.jStorage="{}"}else h.jStorage="{}";z=h.jStorage?String(h.jStorage).length:0;c.__jstorage_meta||(c.__jstorage_meta={});c.__jstorage_meta.CRC32||(c.__jstorage_meta.CRC32={})}function w(){if(c.__jstorage_meta.PubSub){for(var a=+new Date-2E3,b=0,l=c.__jstorage_meta.PubSub.length;b<
l;b++)if(c.__jstorage_meta.PubSub[b][0]<=a){c.__jstorage_meta.PubSub.splice(b,c.__jstorage_meta.PubSub.length-b);break}c.__jstorage_meta.PubSub.length||delete c.__jstorage_meta.PubSub}try{h.jStorage=p.stringify(c),g&&(g.setAttribute("jStorage",h.jStorage),g.save("jStorage")),z=h.jStorage?String(h.jStorage).length:0}catch(k){}}function q(a){if("string"!=typeof a&&"number"!=typeof a)throw new TypeError("Key name must be string or numeric");if("__jstorage_meta"==a)throw new TypeError("Reserved key name");
return!0}function x(){var a,b,l,k,d=Infinity,n=!1,e=[];clearTimeout(G);if(c.__jstorage_meta&&"object"==typeof c.__jstorage_meta.TTL){a=+new Date;l=c.__jstorage_meta.TTL;k=c.__jstorage_meta.CRC32;for(b in l)l.hasOwnProperty(b)&&(l[b]<=a?(delete l[b],delete k[b],delete c[b],n=!0,e.push(b)):l[b]<d&&(d=l[b]));Infinity!=d&&(G=setTimeout(x,Math.min(d-a,2147483647)));n&&(w(),v(),s(e,"deleted"))}}function E(){var a;if(c.__jstorage_meta.PubSub){var b,l=A,k=[];for(a=c.__jstorage_meta.PubSub.length-1;0<=a;a--)b=
c.__jstorage_meta.PubSub[a],b[0]>A&&(l=b[0],k.unshift(b));for(a=k.length-1;0<=a;a--){b=k[a][1];var d=k[a][2];if(t[b])for(var n=0,e=t[b].length;n<e;n++)try{t[b][n](b,p.parse(p.stringify(d)))}catch(g){}}A=l}}var y=window.jQuery||window.$||(window.$={}),p={parse:window.JSON&&(window.JSON.parse||window.JSON.decode)||String.prototype.evalJSON&&function(a){return String(a).evalJSON()}||y.parseJSON||y.evalJSON,stringify:Object.toJSON||window.JSON&&(window.JSON.stringify||window.JSON.encode)||y.toJSON};if("function"!==
typeof p.parse||"function"!==typeof p.stringify)throw Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");var c={__jstorage_meta:{CRC32:{}}},h={jStorage:"{}"},g=null,z=0,f=!1,m={},F=!1,r=0,t={},A=+new Date,G,B={isXML:function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?"HTML"!==a.nodeName:!1},encode:function(a){if(!this.isXML(a))return!1;try{return(new XMLSerializer).serializeToString(a)}catch(b){try{return a.xml}catch(c){}}return!1},
decode:function(a){var b="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(a){var b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(a);return b};if(!b)return!1;a=b.call("DOMParser"in window&&new DOMParser||window,a,"text/xml");return this.isXML(a)?a:!1}};y.jStorage={version:"0.4.13",set:function(a,b,l){q(a);l=l||{};if("undefined"==typeof b)return this.deleteKey(a),b;if(B.isXML(b))b={_is_xml:!0,xml:B.encode(b)};else{if("function"==typeof b)return;
b&&"object"==typeof b&&(b=p.parse(p.stringify(b)))}c[a]=b;for(var k=c.__jstorage_meta.CRC32,d=p.stringify(b),g=d.length,e=2538058380^g,h=0,f;4<=g;)f=d.charCodeAt(h)&255|(d.charCodeAt(++h)&255)<<8|(d.charCodeAt(++h)&255)<<16|(d.charCodeAt(++h)&255)<<24,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16),f^=f>>>24,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16),e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)^f,g-=4,++h;switch(g){case 3:e^=(d.charCodeAt(h+2)&255)<<16;case 2:e^=
(d.charCodeAt(h+1)&255)<<8;case 1:e^=d.charCodeAt(h)&255,e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)}e^=e>>>13;e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16);k[a]="2."+((e^e>>>15)>>>0);this.setTTL(a,l.TTL||0);s(a,"updated");return b},get:function(a,b){q(a);return a in c?c[a]&&"object"==typeof c[a]&&c[a]._is_xml?B.decode(c[a].xml):c[a]:"undefined"==typeof b?null:b},deleteKey:function(a){q(a);return a in c?(delete c[a],"object"==typeof c.__jstorage_meta.TTL&&a in c.__jstorage_meta.TTL&&
delete c.__jstorage_meta.TTL[a],delete c.__jstorage_meta.CRC32[a],w(),v(),s(a,"deleted"),!0):!1},setTTL:function(a,b){var l=+new Date;q(a);b=Number(b)||0;return a in c?(c.__jstorage_meta.TTL||(c.__jstorage_meta.TTL={}),0<b?c.__jstorage_meta.TTL[a]=l+b:delete c.__jstorage_meta.TTL[a],w(),x(),v(),!0):!1},getTTL:function(a){var b=+new Date;q(a);return a in c&&c.__jstorage_meta.TTL&&c.__jstorage_meta.TTL[a]?(a=c.__jstorage_meta.TTL[a]-b)||0:0},flush:function(){c={__jstorage_meta:{CRC32:{}}};w();v();s(null,
"flushed");return!0},storageObj:function(){function a(){}a.prototype=c;return new a},index:function(){var a=[],b;for(b in c)c.hasOwnProperty(b)&&"__jstorage_meta"!=b&&a.push(b);return a},storageSize:function(){return z},currentBackend:function(){return f},storageAvailable:function(){return!!f},listenKeyChange:function(a,b){q(a);m[a]||(m[a]=[]);m[a].push(b)},stopListening:function(a,b){q(a);if(m[a])if(b)for(var c=m[a].length-1;0<=c;c--)m[a][c]==b&&m[a].splice(c,1);else delete m[a]},subscribe:function(a,
b){a=(a||"").toString();if(!a)throw new TypeError("Channel not defined");t[a]||(t[a]=[]);t[a].push(b)},publish:function(a,b){a=(a||"").toString();if(!a)throw new TypeError("Channel not defined");c.__jstorage_meta||(c.__jstorage_meta={});c.__jstorage_meta.PubSub||(c.__jstorage_meta.PubSub=[]);c.__jstorage_meta.PubSub.unshift([+new Date,a,b]);w();v()},reInit:function(){C()},noConflict:function(a){delete window.$.jStorage;a&&(window.jStorage=this);return this}};(function(){var a=!1;if("localStorage"in
window)try{window.localStorage.setItem("_tmptest","tmpval"),a=!0,window.localStorage.removeItem("_tmptest")}catch(b){}if(a)try{window.localStorage&&(h=window.localStorage,f="localStorage",r=h.jStorage_update)}catch(c){}else if("globalStorage"in window)try{window.globalStorage&&(h="localhost"==window.location.hostname?window.globalStorage["localhost.localdomain"]:window.globalStorage[window.location.hostname],f="globalStorage",r=h.jStorage_update)}catch(k){}else if(g=document.createElement("link"),
g.addBehavior){g.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(g);try{g.load("jStorage")}catch(d){g.setAttribute("jStorage","{}"),g.save("jStorage"),g.load("jStorage")}a="{}";try{a=g.getAttribute("jStorage")}catch(m){}try{r=g.getAttribute("jStorage_update")}catch(e){}h.jStorage=a;f="userDataBehavior"}else{g=null;return}D();x();"localStorage"==f||"globalStorage"==f?"addEventListener"in window?window.addEventListener("storage",u,!1):document.attachEvent("onstorage",
u):"userDataBehavior"==f&&setInterval(u,1E3);E();"addEventListener"in window&&window.addEventListener("pageshow",function(a){a.persisted&&u()},!1)})()})();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,42 @@
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + s4() + s4() +
s4() + s4() + s4() + s4();
}
var gid=$.jStorage.get(codetype+"-cookie",null)
if(gid){
}else{
gid=guid();
$.jStorage.set(codetype+"-cookie", gid);
}
if(gid.indexOf("*")==-1){
gid=gid+"*"+unid;
$.jStorage.set(codetype+"-cookie", gid);
}
function ie_error(){
var ret=false;
if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE6.0")
{
ret=true;
}
else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE7.0")
{
ret=true;
}
else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE8.0")
{
ret=true;
}
else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion .split(";")[1].replace(/[ ]/g,"")=="MSIE9.0")
{
ret=true;
}
return ret;
}

View File

@ -1,25 +0,0 @@
/*样式重置*/
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

@ -1,238 +0,0 @@
/*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

@ -1,96 +0,0 @@
.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

@ -1,129 +0,0 @@
/**/
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.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -1,446 +0,0 @@
/*=================可编辑样式====================*/
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

@ -1,295 +0,0 @@
/************
* 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

@ -1,334 +0,0 @@
;(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

@ -1,576 +0,0 @@
/*
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

@ -1,379 +0,0 @@
/***********
* 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,105 @@
define("ace/theme/monokai",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-monokai";
exports.cssText = ".ace-monokai .ace_gutter {\
background: #2F3129;\
color: #8F908A\
}\
.ace-monokai .ace_print-margin {\
width: 1px;\
background: #555651\
}\
.ace-monokai {\
background-color: #272822;\
color: #F8F8F2\
}\
.ace-monokai .ace_cursor {\
color: #F8F8F0\
}\
.ace-monokai .ace_marker-layer .ace_selection {\
background: #49483E\
}\
.ace-monokai.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #272822;\
}\
.ace-monokai .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-monokai .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #49483E\
}\
.ace-monokai .ace_marker-layer .ace_active-line {\
background: #202020\
}\
.ace-monokai .ace_gutter-active-line {\
background-color: #272727\
}\
.ace-monokai .ace_marker-layer .ace_selected-word {\
border: 1px solid #49483E\
}\
.ace-monokai .ace_invisible {\
color: #52524d\
}\
.ace-monokai .ace_entity.ace_name.ace_tag,\
.ace-monokai .ace_keyword,\
.ace-monokai .ace_meta.ace_tag,\
.ace-monokai .ace_storage {\
color: #F92672\
}\
.ace-monokai .ace_punctuation,\
.ace-monokai .ace_punctuation.ace_tag {\
color: #fff\
}\
.ace-monokai .ace_constant.ace_character,\
.ace-monokai .ace_constant.ace_language,\
.ace-monokai .ace_constant.ace_numeric,\
.ace-monokai .ace_constant.ace_other {\
color: #AE81FF\
}\
.ace-monokai .ace_invalid {\
color: #F8F8F0;\
background-color: #F92672\
}\
.ace-monokai .ace_invalid.ace_deprecated {\
color: #F8F8F0;\
background-color: #AE81FF\
}\
.ace-monokai .ace_support.ace_constant,\
.ace-monokai .ace_support.ace_function {\
color: #66D9EF\
}\
.ace-monokai .ace_fold {\
background-color: #A6E22E;\
border-color: #F8F8F2\
}\
.ace-monokai .ace_storage.ace_type,\
.ace-monokai .ace_support.ace_class,\
.ace-monokai .ace_support.ace_type {\
font-style: italic;\
color: #66D9EF\
}\
.ace-monokai .ace_entity.ace_name.ace_function,\
.ace-monokai .ace_entity.ace_other,\
.ace-monokai .ace_entity.ace_other.ace_attribute-name,\
.ace-monokai .ace_variable {\
color: #A6E22E\
}\
.ace-monokai .ace_variable.ace_parameter {\
font-style: italic;\
color: #FD971F\
}\
.ace-monokai .ace_string {\
color: #E6DB74\
}\
.ace-monokai .ace_comment {\
color: #75715E\
}\
.ace-monokai .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});

View File

@ -203,6 +203,7 @@
enableSnippets: true, enableSnippets: true,
enableLiveAutocompletion: true enableLiveAutocompletion: true
}); });
editor.setTheme("ace/theme/monokai"); editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/php"); editor.getSession().setMode("ace/mode/php");
} }

View File

@ -1,4 +1,4 @@
<!doctype html> d<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<base href="/news/"> <base href="/news/">