Bài Mới Nhất | Gửi SMS miễn phí | Code ZB | Hỏi Đáp ZB | Chit Chat | Thủ Thuật Blog| Up Hình & TL | Giải Trí |
Welcome Guest [Log In] [Register]


Add Reply
Tổng hợp code zetaboards (code Zb); đây là code tổng hợp khá hay những đoạn code hay dùng trong 4rum
Topic Started: 25/02/2010 - 11:42 pm (18,016 Views)
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

code zb đầu tiên :
Hướng dẫn rút gọn code khi quá dài


Trước tiên các bạn hãy hình dung rằng mỗi code có cấu trúc như sau :
<script> Nội dung code </script>

Bước 1:

Các bạn cần copy nội dung code (không có <script> và </script>)vào Notepad sau đó lưu lại với một cái tên có đuôi là .js bằng cách sau:
File ---> Save
File name : tên code.js (tên code tốt nhất không nên ghi khoảng trắng)
Save as type : chọn All Files
Encoding : chọn UTF-8
Sau đó nhấn nút Save
Bước 2: Upload file Js vào 1 Host lưu trữ File nào đó rồi lấy link trực tiếp (Direct Link)
Một số địa chỉ cho đăng kí Host miễn phí :
http://1asphost.com
http://aquate.us
http://webs.com

Hoặc Up trực tiếp lên ZB thông qua file đính kèm hoặc trong ACP.
Bước 3: Bạn hãy chèn cái code thu gọn thay cho đoạn code đầy đủ là xong.
Ví dụ Code thu gọn :
Quote:
 
<script type="text/javascript" src="http://z3.ifrm.com/18/3/0/f195535/PostsToday.js"></script>


Edited by Hiếu Armstrong, 24/06/2010 - 11:33 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

Thu gọn SubMenu và thêm Danh sách Link
Code: HTML
 
<script>/*TopMenu Merge with Fixed Floating #top by Tim. */var url = "http://z3.ifrm.com/static/1/m_acp.png";var url2 = "http://z3.ifrm.com/static/1/m_acp.png";var wp = 1;var sm = 1;var wpid = new Array("testpages333","pagetest1");var wpname = new Array("TestPage","PageTest");$("#top").after("<br /><br />"); $("#top_bar").remove(); $("#top").css({position:"fixed"}); $("#top").css({"padding-right": "1px"});$(document).ready(function(){var htmlStr = $("#top_info").html();var htmlStr3 = $("#top_menu").html();if (htmlStr3 == null){htmlStr3 = "";}var htmlStr2 = $("#submenu").html();htmlStr2 = "<li id=\"menu_ucp\"><a><img src='" + url + "' alt='ACP' />Submenu</a><ul><li>" + htmlStr2 + "</li></ul></li>";if (wp == 1) {htmlStr4 = "<li id=\"menu_ucp\"><a><img src='" + url2 + "' alt='ACP' />Pages</a><ul><li>";for(i=0;i<wpid.length;i++){ htmlStr4 += "<a href=\"" + main_url + "pages/" + wpid +"\">" + wpname + "</a>"; }htmlStr4 += "</li></ul></li>";} else {var htmlStr4 = "";}if (sm == 1) { $("#submenu").remove(); } else { htmlStr2 = ""; }$("#top_bar").remove();;$("#submenu_bar").remove();$("#top").html("<div id=\"top\"><div id=\"top_info\">" + htmlStr + "</div><ul id=\"top_menu\" class=\"drop_menu\">" +htmlStr4 + htmlStr2 + htmlStr3 + "</ul></div>");});</script>
Edited by Hiếu Armstrong, 21/04/2010 - 06:34 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

HTML cho tiêu đề bài viết
Tác dụng : Cho hiệu lực HTML trong tiêu đề của bài viết.
Vị trí chèn code : Below the board / Above copyright


Code: HTML
 
<script>
// HTML in Topic Titles by Viral of "viral's board url here"...
function e_h(str){var ta=document.createElement("textarea");
ta.innerHTML=str.replace(/</g,"<").replace(/>/g,">");return ta.value;}badtags="iframe,script,body,html,style"
;badtags=badtags.split(",");$("a.c_last-
title,td.c_cat-title a,table.topic tr th,div.portal_box h4 strong a,
div#main table thead tr th a").each(function(){som=$(this);so=$(som).html();
for(c=0;c<badtags.length;c++){so=so.
split(badtags[c]).join("");}$(som).html(e_h(so));});document.title=
document.title.split(">")[1].split("<")[0];
</script>
Edited by Hiếu Armstrong, 21/04/2010 - 06:51 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

Yêu cầu khách đăng nhập; mới xem được bài viết
Quote:
 
<script type='text/javascript' src='http://z3.ifrm.com/28002/175/0/f567094/yeucaudangnhap.js'></script>
Edited by danlak, 03/05/2010 - 07:51 am.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

[ZB mod]Trao thưởng; Award Mod in Post Details
Đặt code tại Footer

Quote:
 
<script text="text/javascript">
/* Award Modification by Eureka (Ken) @ TCZ [http://thecodingzone.com] */
/*Tránlated by TroChuyen.Info.Tm*/
function MOTM(name, image, award){$(function(){$(".c_username").contains(name).parent().find(".c_postinfo .left").append("<br /><br /><b><u>" + award + "</u></b> <img src='" + image + "' />");});}

MOTM("Nick nhận giải" , "Link hình cup" , "Tên giải");
</script>
Rank In User Info - Xếp hạng thành viên
Tác dụng : Thêm 1 dòng xếp hạng bên cột thông tin thành viên.
Demo :

<script type="text/javascript">
/*Vitality-ZBCode*/
if(location.href.match("topic/||profile/")){
var homeurl=main_url+"home/";
$.get(homeurl,function(d) {
var nextRank=$("td.c_desc:contains('Your next rank')",d).html().split("in ")[1].split(" posts.")[0];
$("dl.user_info:contains('Joined:')").append("<dt>Rank:</dt><dd>"+nextRank+"</dd>");
});}
</script>

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

code search rất pro:
chèn vào Above the copyright:
Code:
 
<!--Custom Search Created By Protego-->
<link href="http://z3.ifrm.com/28087/139/0/f585711/customsearch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://z3.ifrm.com/28087/139/0/f585713/customsearch.js"></script>
Edited by Hiếu Armstrong, 24/06/2010 - 11:27 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

đổi tên cho Shoutbox
chèn vào ATC
Code:
 
<script type="text/javascript">$("#front_shoutbox h2").html($("#front_shoutbox h2").html().replace("Shoutbox","khung Chat"));</script>
Edited by Hiếu Armstrong, 24/06/2010 - 11:29 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

Code thu gọn forum trên 1 hàng:

Code:
 
<script type="text/javascript">
/*
Created by Agent Moose
-zbcode.com
-revolutionx.smfforfree3.com
You may not redistribute or edit without permission
*/
if(location.href == main_url + "index/"){
var Tabs = "";
var Forumz = "";
var FirstView = $("div.category:first").find("h2 a").parent().parent().parent().parent().parent().next().html();
$("div.category[id!='Tabby']").find("h2 a").each(function(){
var startID = this.href.split("/forum/")[1];
var forumID = startID.split("/")[0];
Tabs += "<a id='tab_" + forumID + "' href='javascript:void(0);' onclick='ShowCat(" + forumID + ");' class='tabBorder'>" + this.innerHTML + "</a>";
});
if(readCookie("ShowForum")){
var CurrentCookie = $("div.category").find("h2 a[href*='forum/" + readCookie("ShowForum") + "/']").parent().parent().parent().parent().parent().next().html();
$("div#main div.category:first").before("<div class='category' id='Tabby'><table class='cat_head'><tr><td><h2><span style='float: right;'><a href='javascript:void(0);' onclick='ShowAll(this);' id='ShoeMe'>(Show all Forums)</a></span>Tabs: " + Tabs + "<span class='tabBorder'> </span></h2></td></tr></table><table id='TheTable'>" + CurrentCookie + "</table></div>");
}else{
$("div#main div.category:first").before("<div class='category' id='Tabby'><table class='cat_head'><tr><td><h2><span style='float: right;'><a href='javascript:void(0);' onclick='ShowAll(this);' id='ShoeMe'>(Show all Forums)</a></span>Tabs: " + Tabs + "<span class='tabBorder'> </span></h2></td></tr></table><table id='TheTable'>" + FirstView + "</table></div>");
};
$("div.category[id*='cat-']").hide();
};
function ShowCat(forum){
$("div.category").find("h2 a").each(function(){
if(this.href.match("/forum/" + forum + "/")){
createCookie("ShowForum",forum,365);
Forumz = $(this).parent().parent().parent().parent().parent().next().html();
$("#TheTable").html(Forumz);
};});
};
function ShowAll(){
$("#Tabby").slideToggle();
$("div.category[id*='cat-']").show("normal");
};
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}
</script>
Edited by Hiếu Armstrong, 24/06/2010 - 11:31 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

Auto Resize Images - Tự động thu nhỏ kích thước hình ảnh
Tác dụng : Thu nhỏ những hình ảnh có kích thước lớn để xem phù hợp với Forum.

Vị trí chèn code : Below the Board

Code:
 
[font=Times New Roman]<script type="text/javascript">
//<![CDATA[
window.onload=(function() {
$("td.c_post img[alt='Posted Image']").each(function() {
if (this.width >= 500) {
$(this).wrap("<a href='" + this.src + "'></a>");
$(this).after("<br /><small><a href='" + this.src + "' class='view_full'>Kích thước thật của Ảnh trên</a></small>");
}
});
});
//]]>
</script>
<style type="text/CSS">
td.c_post img {
max-width: 500px;
}</style>

Và thêm Code sau vào cuối cùng của CSS :
Quote:

.c_post img,#topic_review img {
max-width:60%;
}

a.view_full {
insert CSS styling here;
}
[/font]

[/big]
Edited by Hiếu Armstrong, 21/04/2010 - 06:35 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
Posted ImageHiếu Armstrong
Member Avatar
Armstrong

Tạo 3 BẢng Trong 1
Đặt tại "Above the Board" (Board Template)

Code: HTML
 
<div class="category" id="collay">
<table class="cat_head">
<tr><td><h2>HeHe forum</h2></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="4" width="100%">
<tr>
<th width="20%">Chào các bạn</th>
<th width="60%">Thông báo từ BQT HeHe</th>
<th width="20%">Quảng cáo</th>
</tr>
<tr>
<td class="c_view"><div class="overflow"><marquee direction="up" onmouseover="style.scrollamount('0')" scrollamount="5">Chào mừng các bạn đến với Forum HeHe , hy vọng bạn có những giấy phút thật vui vẻ ![/marquee]</td>
<td class="c_subforum" width="60%"><div class="overflow"><marquee direction="up" scrollamount="5">Thông báo: blah blah[/marquee]</div></td>
<td class="c_view" width="20%"><div class="overflow"> ⊃ <a href="http://">Link 1</a><br />
⊃ <a href="http://">Link 1</a><br />
⊃ <a href="http://">Link 1</a><br />
⊃ <a href="http://">Link 1</a><br />⊃ <a href="http://">Link 1</a><br />
</div></td>
</tr>
</table>
</div>

Edited by Hiếu Armstrong, 21/04/2010 - 06:38 pm.

== bạn sẽ là những gì bạn nghĩ ==
:r2:


Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Tphượt cẩm nang · Next Topic »
Add Reply




Xem tốt nhất trên các trình duyệt FireFox hoặc Google Chrome ở độ phân giải 1024 x 768 pixels.
Diễn đàn là một hệ thống mở, chúng tôi sẽ không chịu trách nhiệm về nội dung đăng tải do người dùng đưa lên.