by _Twisted_Mods_ Tue Dec 30, 2014 4:19 am
i also did one
goto acp>display>pictures&colors>colors>css
add
- Code:
body.chatbox { display:none }
save/submit
goto
acp>modules>html page management
create a new html page
Title:tchatbox < must be the title
Do you wish to use your forum header and footer ? YES
Homepage: No
save/submit ... no html is needed
goto acp>modules>JavaScript management
Enable JavaScript code management :Yes
save
if its not already on
then
create a new JavaScript
Title: up to you
Placement: all pages
code
- Code:
$(function(){
var hmanydold = "10" -1; // how many days old the account must be to run the scrit
var dayppost = "5"; // how many days before required to make post again
var hmpth = "2" -1 ;// how many post per dayppost
var names = "3 876 232 1221 9764"; // safe list user# serperated by space
var htlink = "/h1_tchatbox"; // url to your html page
// this would set it to require 1 post every 5 days if the joindate was longer then 10 days ago
$('a[href*="chatbox"]').attr('href', htlink);
if(location.href.match('tchatbox')){
$('head').append(' <style>body\{margin-top:0px!important;\} #fa_toolbar\{display:none!important;\} </style>');
$('body').empty();
$('body').append(' <div id="chatbox_top" style="margin: 0px !important;position: absolute;top: 0px;bottom: 0px;left: 0px;right: 0px;"><object style="display: block;" data="/chatbox/index.forum?page=front&" id="frame_chatbox" scrolling="yes" type="text/html" height="100%" width="100%"></object></div> ');
$('link[href="http://chat.avacweb.net/avacweb_chat_2.css"]').remove();
};
//----safe list-----------
var names2 = names.split(" ");
for (var i = 0; i < names2.length; i++){ if (_userdata.user_id == names2[i]) return; }
//-----end of safe list-----
//-------------cookie -save-get-----------
function setCookie(cname,cvalue,exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname+"="+cvalue+"; "+expires;
}
function getCookie(cname) {
var name = cname + "=";
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);
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
//------------end of cookies
var usejdate = parseInt(getCookie("usejdate"));
if (usejdate > hmanydold){
var curpcount = parseInt(getCookie("curpcount"));
if (isNaN(curpcount)){
curpcount = _userdata.user_posts;
setCookie("curpcount", curpcount, dayppost);
}
if(_userdata.user_posts > curpcount + hmpth){
$('#avacweb_chat_button').css('display', 'block');
$('#frame_chatbox').css('display', 'block');
$('#cchatmsg').remove();
}else{
$('#avacweb_chat_button').css('display', 'none') ;
var numb1 = parseInt(hmpth);
numb2 = numb1+1;
$('#frame_chatbox').before(' <div id="cchatmsg"> Chat Is Unavalible Till You Make '+ numb2 +' Post. Once Post Are Made Chat Will Be Unlocked For '+ dayppost +' Days');
$('#avacweb_chat_button').before(' <div id="cchatmsg"> Chat Is Unavalible Till You Make '+ numb2 +' Post. Once Post Are Made Chat Will Be Unlocked For '+ dayppost +' Days');
}
}else{
$('body').append(' <div id="conthholder" style="display:none;"></div> ');
var userid = _userdata.user_id;
$('#conthholder').load('/u'+userid+' #profile-advanced-left', function() {
jdate = $(this).find('#field_id-4 .field_uneditable').text();
jdate2 = jdate.split("-");
jdate2 = jdate2[1] + ", " + jdate2[2] + ", " + jdate2[0];
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var cdate = (month<10 ? '0' : '') + month + ', ' +
(day<10 ? '0' : '') + day + ', ' +d.getFullYear();
var date1 = new Date(cdate);
var date2 = new Date(jdate2);
diff = date1 - date2;
var days = diff / 1000 / 60 / 60 / 24;
days = Math.round(days);
if (days > 4){
setCookie("usejdate", days, 99999);
}else{
setCookie("usejdate", days, 1);
}
});
};
});
save/submit
Things you can change
var hmanydold = "10" < how many days old the account must be to run the script.. this is to avoid running off new members by forcing them to post
var dayppost = "5"; < how many days before required to make post again
var hmpth = "2" -1; <how many post per days set above
var names = "3 876 232 1221 9764"; < safe list user# serperated by space if you add the user# the script will not effect that person
var htlink = "/h1_tchatbox"; <this changes all urls other then the chatbox title to the new fullscreen html page
so these settings above would set it to require 2 post every 5 days if the joindate was longer then 10 days ago .. also user 3,876,232,1221,9764 will not be effected by this script
thankx to ange for testing
this code was tested on phpbb2,phpbb3 if you have another version and it dont work please let me know so i can post the code for your version