Browse Source

Merge branch 'develop'

star7th 9 years ago
parent
commit
9ac09464d1

+ 2 - 2
Application/Common/Conf/config.php

@@ -18,8 +18,8 @@ return array(
     'URL_MODEL' => 3 ,//URL兼容模式
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
-        ':id\d'               => 'Home/Item/Show?item_id=:1',
-		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
+        ':id\d'               => 'Home/Item/show?item_id=:1',
+		':domain\s$'               => 'Home/Item/show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     'URL_CASE_INSENSITIVE'=>true,

+ 1 - 1
Application/Home/View/Common/footer.html

@@ -1,7 +1,7 @@
    
 	<script src="__PUBLIC__/js/common/jquery.min.js"></script>
     <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
-    <script src="__PUBLIC__/js/common/showdoc.js"></script>
+    <script src="__PUBLIC__/js/common/showdoc.js?v=1.1"></script>
     <div style="display:none">
     	{:C("STATS_CODE")}
     </div>

+ 1 - 1
Application/Home/View/Item/showbyuid.html

@@ -50,7 +50,7 @@
 
         <foreach name="items" item="item">
           <li class="span3 text-center">
-            <a class="thumbnail" href="{:U('Home/Item/Show',array('item_id'=>$item['item_id']))}" target="_blank" title="{$item.item_description}">
+            <a class="thumbnail" href="{:U('Home/Item/show',array('item_id'=>$item['item_id']))}" target="_blank" title="{$item.item_description}">
               <p class="my-item">{$item.item_name}</p>
             </a>
           </li>     

+ 2 - 2
Application/Home/View/Page/edit.html

@@ -53,7 +53,7 @@
         <button id="database-doc" tabindex="6" >{$Think.Lang.inser_database_doc_template}</button>
         <button id="more-templ" tabindex="7" >{$Think.Lang.more_templ}</button>
         <button id="jsons" tabindex="8" style="margin-left: 100px;">{$Think.Lang.json_to_table}</button>
-        <a href="http://runapi.showdoc.cc/" target="_blank" class="btn" tabindex="9" >{$Think.Lang.http_test_api}</a>
+        <a href="http://runapi.showdoc.cc/" target="_blank" class="btn" tabindex="9" id="runapi">{$Think.Lang.http_test_api}</a>
     </div>
     <div id="editormd">
         <textarea id="page_content" style="display:none;" tabindex="10" >{$page.page_content}</textarea>
@@ -116,7 +116,7 @@
 <script src="__PUBLIC__/editor.md/plugins/table-dialog/table-dialog.js"></script>
 <script src="__PUBLIC__/editor.md/plugins/reference-link-dialog/reference-link-dialog.js"></script>
 
-<script src="__PUBLIC__/js/page/edit.js?v=1.1.2thirdonmopqr"></script>
+<script src="__PUBLIC__/js/page/edit.js?v=1.1.2thirdonmopqrs"></script>
 <if condition="LANG_SET=='en-us'">
     <script src="__PUBLIC__/editor.md/languages/en.js"></script>
 </if>

+ 90 - 0
Public/js/common/showdoc.js

@@ -4,4 +4,94 @@ function isMobile(){
 return navigator.userAgent.match(/iPhone|iPad|iPod|Android|android|BlackBerry|IEMobile/i) ? true : false; 
 }
 
+//判断是否是在线ShowDoc
+function is_showdoc_online(){
+	var host = window.location.host;
+	if(host.indexOf("showdoc.cc") > -1 || host.indexOf("wu.com") > -1){
+		return true;
+	}else{
+		return false;
+	}
+}
+
+//给文字加上颜色
+function set_text_color( id , color){
+	var cookie_key = "is_"+id+"_click";
+
+	var is_click = getCookie(cookie_key);
+	if (!is_click) {
+		$("#"+id).css("color",color);
+	};
+
+	$("#"+id).click(function(){
+		var is_click = getCookie(cookie_key);
+		if (!is_click) {
+			$(this).css("color","");
+			setCookie(cookie_key , 1 , 900);
+		};
+	});
+}
+
+
+///设置cookie 
+function setCookie(NameOfCookie, value, expiredays) 
+{ 
+	//@参数:三个变量用来设置新的cookie: 
+	//cookie的名称,存储的Cookie值, 
+	// 以及Cookie过期的时间. 
+	// 这几行是把天数转换为合法的日期 
+
+	var ExpireDate = new Date (); 
+	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); 
+
+	// 下面这行是用来存储cookie的,只需简单的为"document.cookie"赋值即可. 
+	// 注意日期通过toGMTstring()函数被转换成了GMT时间。 
+
+	document.cookie = NameOfCookie + "=" + escape(value) + 
+	  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); 
+} 
+
+///获取cookie值 
+function getCookie(NameOfCookie) 
+{ 
+
+	// 首先我们检查下cookie是否存在. 
+	// 如果不存在则document.cookie的长度为0 
+
+	if (document.cookie.length > 0) 
+	{ 
+
+	// 接着我们检查下cookie的名字是否存在于document.cookie 
+
+	// 因为不止一个cookie值存储,所以即使document.cookie的长度不为0也不能保证我们想要的名字的cookie存在 
+	//所以我们需要这一步看看是否有我们想要的cookie 
+	//如果begin的变量值得到的是-1那么说明不存在 
+
+	begin = document.cookie.indexOf(NameOfCookie+"="); 
+	if (begin != -1)    
+	{ 
+
+	// 说明存在我们的cookie. 
+
+	begin += NameOfCookie.length+1;//cookie值的初始位置 
+	end = document.cookie.indexOf(";", begin);//结束位置 
+	if (end == -1) end = document.cookie.length;//没有;则end为字符串结束位置 
+	return unescape(document.cookie.substring(begin, end)); } 
+	} 
+
+	return null; 
+
+	// cookie不存在返回null 
+} 
+
+///删除cookie 
+function delCookie (NameOfCookie) 
+{ 
+	// 该函数检查下cookie是否设置,如果设置了则将过期时间调到过去的时间; 
+	//剩下就交给操作系统适当时间清理cookie啦 
 
+	if (getCookie(NameOfCookie)) { 
+	document.cookie = NameOfCookie + "=" + 
+	"; expires=Thu, 01-Jan-70 00:00:01 GMT"; 
+	} 
+}

+ 6 - 0
Public/js/page/edit.js

@@ -4,6 +4,12 @@ var json_table_data='|'+lang["params"]+'|'+lang["type"]+'|'+lang["description"]+
 		'|:-------|:-------|:-------|\n';
 
 $(function() {
+
+  //给按钮文字加上颜色,点击后则去掉颜色
+  if (is_showdoc_online()) {
+    set_text_color( "runapi" , "red");
+  };
+
   /*加载目录*/
   secondCatList();
 

+ 5 - 5
install/ajax.php

@@ -6,7 +6,7 @@ ini_set("display_errors", "Off");
 error_reporting(E_ALL | E_STRICT);
 header("Content-type: text/html; charset=utf-8"); 
 include("common.php");
-if($f = file_get_contents("./install.lock")){
+if(file_exists('./install.lock') && $f = file_get_contents("./install.lock")){
 	ajax_out(L("lock"),10099);
 }
 
@@ -70,8 +70,8 @@ return array(
     'URL_MODEL' => 3 ,//URL兼容模式
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
-        ':id\d'               => 'Home/Item/Show?item_id=:1',
-		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
+        ':id\d'               => 'Home/Item/show?item_id=:1',
+		':domain\s$'               => 'Home/Item/show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     'URL_CASE_INSENSITIVE'=>true,
@@ -155,8 +155,8 @@ return array(
     'URL_MODEL' => 3 ,//URL兼容模式
     'URL_ROUTER_ON'   => true, 
     'URL_ROUTE_RULES'=>array(
-        ':id\d'               => 'Home/Item/Show?item_id=:1',
-		':domain\s$'               => 'Home/Item/Show?item_domain=:1',//item的个性域名
+        ':id\d'               => 'Home/Item/show?item_id=:1',
+		':domain\s$'               => 'Home/Item/show?item_domain=:1',//item的个性域名
         'uid/:id\d'               => 'Home/Item/showByUid?uid=:1',
     ),
     'URL_CASE_INSENSITIVE'=>true,