d23_hp.js
Code:
//----------------------------------------------------
// D23-Hover Prompt Javascript Library
// Copyright © 2007
//----------------------------------------------------
function d23_hoverprompt(id)
{
this.obj;
this.scroll_var;
this.obj_id = id;
this.screen_scroll = true;
this.enable_fade = false;
this.auto_hide = false;
this.show_timer = false;
this.suspend = false;
this.hide_time = 0;
this.langs = new Array();
this.obj = my_getbyid(this.obj_id);
return this;
}
d23_hoverprompt.prototype.display = function()
{
d = this._calc_data();
this.obj.style.position = 'absolute';
this.obj.style.display = '';
this.obj.style.zIndex = 1000;
this.obj.style.left = d['doc_width']/2-d['obj_width']/2+'px';
this.obj.style.top = d['scroll_top']+d['doc_height']/3-d['obj_height']/2+'px';
if (this.screen_scroll)
{
this.scroll_var = setInterval(this.obj_id+'.scroll_screen()', 15);
}
if (this.enable_fade)
{
this.start_fade_in();
}
else
{
this.initiate_countdown();
}
}
d23_hoverprompt.prototype.start_fade_in = function()
{
if (this.enable_fade)
{
this.opacity(0, 100, 1000);
setTimeout(this.obj_id+'.end_fade_in()', 100);
}
}
d23_hoverprompt.prototype.end_fade_in = function()
{
if (this.enable_fade && this.obj.style.opacity >= 1)
{
this.initiate_countdown();
}
else
{
setTimeout(this.obj_id+'.end_fade_in()', 100);
}
}
d23_hoverprompt.prototype.start_fade_out = function()
{
if (this.enable_fade)
{
this.opacity(100, 0, 1000);
setTimeout(this.obj_id+'.end_fade_out()', 100);
}
}
d23_hoverprompt.prototype.end_fade_out = function()
{
if (this.enable_fade && this.obj.style.opacity <= 0)
{
this.hide(true);
}
else
{
setTimeout(this.obj_id+'.end_fade_out()', 100);
}
}
d23_hoverprompt.prototype.scroll_screen = function()
{
d = this._calc_data();
this.obj.style.left = d['doc_width']/2-d['obj_width']/2+'px';
this.obj.style.top = d['scroll_top']+d['doc_height']/3-d['obj_height']/2+'px';
}
d23_hoverprompt.prototype.hide = function()
{
if (arguments[0] !== true && this.suspend)
{
return false;
}
if (this.enable_fade && arguments[0] !== true)
{
this.start_fade_out();
}
else
{
this.obj.style.display = 'none';
this.obj.style.top = '0px';
this.obj.style.left = '0px';
this._clear_vars();
}
return false;
}
d23_hoverprompt.prototype.register = function()
{
locationjump('act=reg');
}
d23_hoverprompt.prototype.focused = function()
{
this.suspend = true;
//my_getbyid(this.obj_id+'-close').style.display = '';
my_getbyid(this.obj_id+'-timer-row').style.display = 'none';
}
d23_hoverprompt.prototype.initiate_countdown = function()
{
if (this.auto_hide && this.hide_time > 0)
{
t = parseInt(this.hide_time)*1000;
setTimeout(this.obj_id+'.hide()', t);
if (this.show_timer)
{
setTimeout(this.obj_id+'.update_countdown('+(t-1000)+')', 1000);
}
}
}
d23_hoverprompt.prototype.update_countdown = function(t)
{
if (!this.show_timer || this.suspend)
{
return false;
}
var n = t/1000;
var o = my_getbyid(this.obj_id+'-timer');
if (o)
{
o.innerHTML = "<small><i>"+this.langs['timetxt']+" "+n+" "+((n == 1) ? this.langs['timesec'] : this.langs['timesecs'])+"</i></small>";
}
n = t-1000;
if (n > 0)
{
setTimeout(this.obj_id+'.update_countdown('+n+')', 1000);
}
}
d23_hoverprompt.prototype.add_langs = function(a)
{
for (var i in a)
{
this.langs[i] = a[i];
}
}
d23_hoverprompt.prototype._calc_data = function()
{
var a = new Array();
a['body'] = (document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
a['scroll_top'] = (is_ie) ? a['body'].scrollTop : window.pageYOffset;
a['doc_width'] = (is_ie) ? a['body'].clientWidth : window.innerWidth;
a['doc_height'] = (is_ie) ? a['body'].clientHeight : window.innerHeight;
a['obj_width'] = this.obj.offsetWidth;
a['obj_height'] = this.obj.offsetHeight;
return a;
}
d23_hoverprompt.prototype._clear_vars = function()
{
if (typeof(this.scroll_var) != 'undefined')
{
clearInterval(this.scroll_var);
}
if (typeof(this.display_var) != 'undefined')
{
clearInterval(this.display_var);
}
if (typeof(this.fade_var) != 'undefined')
{
clearInterval(this.fade_var);
}
}
d23_hoverprompt.prototype.opacity = function(s, e, m)
{
var a = Math.round(m/100);
var b = 0;
if (s > e)
{
for (var i=s; i>=e; i--)
{
setTimeout(this.obj_id+'.change_opacity('+i+')', (a*b));
b++;
}
}
else if (s < e)
{
for (var i=s; i<=e; i++)
{
setTimeout(this.obj_id+'.change_opacity('+i+')', (a*b));
b++;
}
}
}
d23_hoverprompt.prototype.change_opacity = function(o)
{
this.obj.style.opacity = o/100;
this.obj.MozOpacity = o/100;
this.obj.KhtmlOpacity = o/100;
this.obj.filter = 'alpha(opacity='+o+')';
}
d23_hp.php
Code:
<?php
if (!defined('IN_IPB'))
{
print 'Get out.';
exit();
}
class d23_hp
{
var $ipsclass;
function initiate()
{
if (!$this->ipsclass->vars['d23_hp_enable'])
{
return false;
}
$this->ipsclass->load_language('lang_d23_hp');
$this->ipsclass->load_template('skin_d23_hp');
$la = strtolower($this->ipsclass->input['_low_act']);
if (($la != 'reg' && $la != 'login') && intval($this->ipsclass->member['id']) <= 0)
{
$d = array
(
'autohide' => ($this->ipsclass->vars['d23_hp_autohide']) ? 'true' : 'false',
'showtimer' => ($this->ipsclass->vars['d23_hp_showtimer']) ? 'true' : 'false',
'enablefade' => ($this->ipsclass->vars['d23_hp_enablefade']) ? 'true' : 'false',
'showclose' => ($this->ipsclass->vars['d23_hp_showclose']) ? true : false,
'title' => $this->ipsclass->vars['d23_hp_title'],
'message' => $this->ipsclass->vars['d23_hp_message'],
'time' => intval($this->ipsclass->vars['d23_hp_timelength']),
'timetxt' => '',
);
if ($d['time'] > 0)
{
$d['timetxt'] = $d['time'];
if ($d['time'] == 1)
{
$d['timetxt'] .= ' '.$this->ipsclass->lang['d23_hp_timer_sec'];
}
else
{
$d['timetxt'] .= ' '.$this->ipsclass->lang['d23_hp_timer_secs'];
}
}
if (preg_match_all("#\{hp:url\|(.+?)\|(.+?)\}(.+?)\{\/hp:url\}#is", $d['message'], $_m))
{
if (is_array($_m[1]) && count($_m[1]) > 0)
{
foreach ($_m[1] as $mk => $mv)
{
$_k = trim($mv);
$_v = trim($_m[2][$mk]);
$d['message'] = preg_replace("#\{hp:url\|".$_k."\|".$_v."\}(.+?)\{\/hp:url\}#is", "<a href='{$this->ipsclass->base_url}{$_k}={$_v}'>\\1</a>", $d['message']);
}
}
}
$_a = array
(
'name' => $this->ipsclass->member['name'],
'board' => $this->ipsclass->vars['board_name'],
'buttons' => $this->prompt_buttons(),
);
$d['title'] = preg_replace("#\{hp:(.+?)\}#ise", "\$_a['\\1']", $d['title']);
$d['message'] = preg_replace("#\{hp:(.+?)\}#ise", "\$_a['\\1']", $d['message']);
if ($d['autohide'] == 'true' && $d['showtimer'] == 'true' && $d['time'] > 0)
{
$d['timetxt'] = "<small><i>{$this->ipsclass->lang['d23_hp_timer_text']} {$d['timetxt']}</i></small>";
}
return $this->ipsclass->compiled_templates['skin_d23_hp']->hover_prompt($d);
}
}
function prompt_buttons()
{
$d = array
(
'curl' => trim('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']),
);
return $this->ipsclass->compiled_templates['skin_d23_hp']->prompt_buttons($d);
}
}
?>
3 files are above is full of modification files. but ireally don't know what is the reason of not working with in Internet Explorer. ?
Bookmarks