[Mr.P]
New member
Preview:
Tác giả: slayer766
Test code và Việt hóa: Mr.P
Miêu tả: Giới hạn các bạn phải comment đúng 3 từ có nghĩa với khoảng trắng, tùy theo cài đặt của admin
Đặt code tại Below the boards
Cài đặt:
- Áp dụng cho chuyên mục nào: The_Forums = [ID forum];
-> nếu cho nhiều forrum thì cái đặt như sau: The_Forums = [ID forum,ID forum 2,ID forum 3,...];
- Thông báo hiện thị: "Xin vui lòng nhập hơn 3 từ có nghĩa"
- Cài đặt giới hạn từ: var Limit = 3 (Tăng giảm số 3 tùy thích các bạn)
-------------
Lưu source: WordLimit.txt
Tác giả: slayer766
Test code và Việt hóa: Mr.P
Miêu tả: Giới hạn các bạn phải comment đúng 3 từ có nghĩa với khoảng trắng, tùy theo cài đặt của admin
Đặt code tại Below the boards
Mã:
<script type="text/javascript">
//Add as many forums you want
var The_Forums = [ID forum];
//Message
var message = "Xin vui lòng nhập hơn 3 từ có nghĩa";
//Word Limit
var Limit = 3;
</script><script type='text/javascript' src='http://z3.ifrm.com/86/75/0/p31028/WordLimit.txt'></script>
- Áp dụng cho chuyên mục nào: The_Forums = [ID forum];
-> nếu cho nhiều forrum thì cái đặt như sau: The_Forums = [ID forum,ID forum 2,ID forum 3,...];
- Thông báo hiện thị: "Xin vui lòng nhập hơn 3 từ có nghĩa"
- Cài đặt giới hạn từ: var Limit = 3 (Tăng giảm số 3 tùy thích các bạn)
-------------
Lưu source: WordLimit.txt
Mã:
//Word limit in Post
//Written by slayer766 of thecodingzone.com
function countWords(heyslay){
heyslay=heyslay.split("\n").join(" ");
chocolate=heyslay.split(" ");
heyslay=0;
for(da=0;da<chocolate.length;da++){
if(chocolate[da].length>0){
heyslay++;
}
}
return heyslay;
}
$("button.btn_default").click(function(){
Locate = "";
if(document.forms['posting']){
Locate = countWords(document.forms['posting'].post.value);
}
if(document.getElementsByTagName("textarea")[0]){
Locate = countWords(document.getElementsByTagName("textarea")[0].value);
}
for(c in The_Forums){
if(location.href.match("&f="+The_Forums[c]) || location.href.match(/\/topic\//i)){
if(Locate < Limit){
alert(message+"\n"+Math.floor(Limit - Locate)+" more words needed!");
return false;
}
}
}
});