//author: boroo_c@yahoo.com
<header id="desktopHeader">
<section id="desktopNav" class="desktopNav">
<div id="nav-panel">
<ul class="topnav">
<li><a class="navlink" href="<?php echo admin_url(); ?>"><?php echo 'H<sub>2</sub>O ( ' . $this->web->host() . ' )'; ?></a></li>
<li class="parnav">
<a href="#">Бүтэц<span></span></a>
<ul class="subul">
<li><a class="navlink" href="<?php echo admin_url('menu'); ?>">Цэс ...</a></li>
<li class="sepline"><a class="navlink" href="<?php echo admin_url('category/create'); ?>">Хэсэг үүсгэх</a></li>
<li><a class="navlink" href="<?php echo admin_url('category'); ?>">Хэсгүүд ...</a></li>
</ul>
</li>
<li class="parnav">
<a href="#">Бүрэлдэхүүн<span></span></a>
<ul class="subul">
<li><a class="navlink" href="<?php echo admin_url('article'); ?>">Агуулга ...</a></li>
<li><a class="navlink" href="<?php echo admin_url('article/create'); ?>">Агуулга Үүсгэх</a></li>
<li><a class="navlink" href="<?php echo admin_url('articletype'); ?>">Агуулгын Төрлүүд ...</a></li>
<li class="sepline"><a class="navlink" href="<?php echo admin_url('media'); ?>">Медиа ...</a></li>
<li class="sepline"><a class="navlink" href="<?php echo admin_url('tag'); ?>">Түлхүүр үгс ...</a></li>
<li class="sepline"><a class="navlink" href="<?php echo admin_url('extendfield'); ?>">Нэмэлт мэдээлэл ...</a></li>
</ul>
</li>
<li class="parnav">
<a href="#">Тохиргоо<span></span></a>
<ul class="subul">
<li class="subnav">
<a href="#">Лавлах мэдээлэл<span></span></a>
<ul class="subul">
<li><a class="navlink" href="<?php echo admin_url('country'); ?>">- Улс -</a></li>
<li><a class="navlink" href="<?php echo admin_url('language'); ?>">- Хэл -</a></li>
<li><a class="navlink" href="<?php echo admin_url('currency'); ?>">- Валют -</a></li>
</ul>
</li>
<li><a class="navlink" href="<?php echo admin_url('setting'); ?>">Тохируулгууд ...</a></li>
<li class="sepline"><a class="navlink" href="<?php echo admin_url('user'); ?>">Хэрэглэгч ба эрх ...</a></li>
</ul>
</li>
<li><a href="#">Тусламж</a></li>
</ul>
<ul class="rightnav">
<li>
<div>Хэрэглэгч : <?php echo $this->context->user(); ?> (<?php echo $this->context->role(); ?>)</div>
</li>
<li><div><a href="<?php echo site_url(); ?>" target="_blank">Веб</a></div></li>
<li><div><a href="<?php echo admin_url('auth/logout'); ?>">Гарах</a></div></li>
<li>
<div class="time">
<?php echo '<i>MGL: '.local_datetime().'</i>'; ?>
<?php echo '<i>UTC: '.utc_datetime().'</i>'; ?>
<!-- <a href="<?php echo admin_url(); ?>">
<img src="<?php echo theme_url('images/world_flags/flag_mn.gif'); ?>" alt="en">
</a>-->
</div>
</li>
<li>
<div id="test0">
...
</div>
</li>
</ul>
</div>
</section>
</header>
<script>
$(function() {
$('#nav-panel ul.topnav li > a').hover(function() {
var a = $(this).addClass('hover');
var li = $(a).parent();
var ul = $(a).next().show();
if ($(li).hasClass('subnav')) {
$(ul).css('top', '0').css('left', $(li).width());
}
$(li).hover(function() {
}, function() {
$(a).removeClass('hover');
$(ul).hide();
//When the mouse hovers out of the subnav, move it back up
});
});
});
</script>
CSS
#nav-panel {
display: block;
position: relative;
width: 100%;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
}
#nav-panel ul.rightnav{
position: fixed;
list-style: none;
padding: 0 10px;
top: 0;
right: 0;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.rightnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.rightnav li div{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.rightnav li div a:hover{
text-decoration: underline;
}
ul.rightnav li div.time {
position: relative;
line-height: 11px;
width: 140px;
padding: 6px 2px;
text-align: right;
font-size: 11px;
}
ul.rightnav li div.time i {
position: relative;
font-style: normal;
white-space: nowrap;
top: -2px;
}
ul.rightnav li div#test {
padding: 0;
margin: 0;
}
#nav-panel ul.topnav {
list-style: none;
padding: 0 10px;
margin: 0;
float: left;
display: block;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.topnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
cursor: pointer;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.topnav li a{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.topnav li a.hover{
background: url(images/bg-noise.jpg) repeat-x scroll 0 0 #1B1B1B;
}
ul.topnav li.parnav a{
padding-right: 30px;
}
ul.topnav li.parnav a span { /*--Drop down trigger styles--*/
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/subnav10.gif) no-repeat center top;
}
ul.topnav li.subnav a{
padding-right: 30px;
}
ul.topnav li.subnav a span {
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/dropdo10.gif) no-repeat center center;
}
ul.topnav li ul.subul {
list-style: none;
position: absolute;
left: -2px; top: 32px;
margin: 0; padding: 0;
display: none;
float: left;
border: 1px solid #111;
border-top: none;
background: url(images/bg-noise.jpg) repeat scroll 0 0 #1B1B1B;
z-index: 10000;
}
ul.topnav li.subnav ul.subul {
border: 1px solid #111;
}
ul.topnav li ul.subul li{
margin: 0; padding: 0;
color: #E6E6E6;
display: block;
float: none;
clear: both;
}
ul.topnav li ul.subul li a {
white-space: nowrap;
padding-left: 15px;
}
ul.topnav li ul.subul li a:hover {
background: #111;
}
ul.topnav li ul.subul li.sepline{
border-top: 1px solid #444;
}
Thursday, October 31, 2013
Tuesday, October 29, 2013
mysql group_concat,concat with join
select
a.id,
a.name,
group_concat(b.id) ids,
group_concat(b.title) titles,
group_concat(concat("<a href='index.php?id=", b.id, "'>", b.title, "</a>")) titlelist
from participants a
inner join
posts b on b.parentid = a.id
group by a.id,a.name
sample
id Name Value
1 A 4
1 A 5
1 B 8
2 C 9
result
id Column
1 A:4,5,B:8
2 C:9
select id, group_concat(`Name` separator ',') as `Column`
from
(
select id, concat(`Name`, ':',
group_concat(`Value` separator ',')) as `Name`
from mytbl
group by id, `Name`
) tbl
group by id;
jquery my extended panel splitter version
(function($, undefined) {
var splitter_count = 0;
var splitter_id = null;
var splitters = [];
var current_splitter = null;
$.fn.split = function(options) {
var data = this.data('splitter');
if (data) {
return data;
}
var panel_1;
var panel_2;
var settings = $.extend({
rightIsFixed: false, //BOROO added this line
limit: 100,
orientation: 'horizontal',
position: '25%',
onDragStart: $.noop,
onDragEnd: $.noop,
onDrag: $.noop,
onRefresh: $.noop,
onShowing: $.noop,
onHidding: $.noop
}, options || {});
var cls;
var children = this.children();
if (settings.orientation == 'vertical') {
panel_1 = children.first().addClass('left_panel');
panel_2 = panel_1.next().addClass('right_panel');
cls = 'vsplitter';
} else if (settings.orientation == 'horizontal') {
panel_1 = children.first().addClass('top_panel')
panel_2 = panel_1.next().addClass('bottom_panel');
cls = 'hsplitter';
}
var width = this.width();
var height = this.height();
var id = splitter_count;
splitter_count++;
this.addClass('splitter_panel');
var splitter = $('<div/>').addClass(cls).data('splitter-id', id).mouseenter(function() {
splitter_id = $(this).data('splitter-id');
}).mouseleave(function() {
splitter_id = null;
}).insertAfter(panel_1);
var position;
function get_position(position) {
if (typeof position === 'number') {
return position;
} else if (typeof position === 'string') {
var match = position.match(/^([0-9]+)(px|%)$/);
if (match) {
if (match[2] == 'px') {
return +match[1];
} else {
if (settings.orientation == 'vertical') {
return (width * +match[1]) / 100;
} else if (settings.orientation == 'horizontal') {
return (height * +match[1]) / 100;
}
}
} else {
//throw position + ' is invalid value';
}
} else {
//throw 'position have invalid type';
}
}
var self = $.extend(this, {
splitControl: splitter,
onRefresh: settings.onRefresh,
onShowing: settings.onShowing,
onHidding: settings.onHidding
});
self = $.extend(self, {
refresh: function() {
var new_width = this.width();
var new_height = this.height();
if (width != new_width || height != new_height) {
width = this.width();
height = this.height();
self.position(position);
} else {
//BOROO added this code [start]
var p1_none = $(splitter).prev().css('display') === 'none';
if (p1_none) {
splitter.css('cursor', 'pointer');
} else {
var n1_none = $(splitter).next().css('display') === 'none';
if (n1_none) {
splitter.css('cursor', 'pointer');
} else {
splitter.css('cursor', 'col-resize');
}
}
self.position(position);
//BOROO added this code [end]
}
//BOROO added this code [start]
self.find('.splitter_panel').trigger('splitter.refresh');
//BOROO added this code [end]
},
position: (function() {
if (settings.orientation == 'vertical') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.width() / 2;
//BOROO edited this code [start]
var p1_none = $(splitter).prev().css('display') === 'none';
if (p1_none) {
self.find('.splitter_panel').trigger('splitter.hidding');
splitter.css('left', 0);
panel_2.width(self.width() - splitter.width());
} else {
var n1_none = $(splitter).next().css('display') === 'none';
if (n1_none) {
self.find('.splitter_panel').trigger('splitter.hidding');
splitter.css('left', self.width() - splitter.width());
panel_1.width(self.width() - splitter.width());
} else {
splitter.css('left', position - sw);
panel_1.width(position - sw);
panel_2.width(self.width() - position - sw);
}
}
//BOROO edited this code [end]
}
if (!silent) {
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else if (settings.orientation == 'horizontal') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.height() / 2;
splitter.css('top', position - sw);
panel_1.height(position - sw);
panel_2.height(self.height() - position - sw);
}
if (!silent) {
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else {
return $.noop;
}
})(),
orientation: settings.orientation,
limit: settings.limit,
rightIsFixed: settings.rightIsFixed, //BOROO added this line
isActive: function() {
return splitter_id === id;
},
destroy: function() {
self.removeClass('splitter_panel');
splitter.unbind('mouseenter');
splitter.unbind('mouseleave');
if (settings.orientation == 'vertical') {
panel_1.removeClass('left_panel');
panel_2.removeClass('right_panel');
} else if (settings.orientation == 'horizontal') {
panel_1.removeClass('top_panel');
panel_2.removeClass('bottom_panel');
}
self.unbind('splitter.resize');
self.find('.splitter_panel').trigger('splitter.resize');
splitters[id] = null;
splitter.remove();
var not_null = false;
for (var i = splitters.length; i--; ) {
if (splitters[i] !== null) {
not_null = true;
break;
}
}
//remove document events when no splitters
if (!not_null) {
$(document.documentElement).unbind('.splitter');
$(window).unbind('resize.splitter');
splitters = [];
}
//BOROO added this code [start]
var data = self.data('splitter');
if (data) {
self.removeData('splitter');
}
return self;
//BOROO added this code [end]
}
});
self.bind('splitter.refresh', function() {
//call refresh method
self.onRefresh();
});
self.bind('splitter.showing', function() {
//call refresh method
self.onShowing();
});
self.bind('splitter.hidding', function() {
//call refresh method
self.onHidding();
});
self.bind('splitter.resize', function(e) {
var pos = self.position();
//BOROO added this code [start]
if (self.orientation === 'vertical') {
if (self.rightIsFixed) {
var oldw = self.data('old-width');
if (typeof oldw !== 'undefined' && oldw !== self.width()) {
pos = pos + (self.width() - oldw);
//self.width() - panel_2.width() - sw;
}
}
}
//BOROO added this code [end]
if (self.orientation == 'vertical' && pos > self.width()) {
pos = self.width() - self.limit - 1;
} else if (self.orientation == 'horizontal' && pos > self.height()) {
pos = self.height() - self.limit - 1;
}
if (pos < self.limit) {
pos = self.limit + 1;
}
self.data('old-width', self.width());
self.position(pos, true);
});
//inital position of splitter
var pos;
if (settings.orientation == 'vertical') {
if (pos > width - settings.limit) {
pos = width - settings.limit;
} else {
pos = get_position(settings.position);
}
} else if (settings.orientation == 'horizontal') {
//position = height/2;
if (pos > height - settings.limit) {
pos = height - settings.limit;
} else {
pos = get_position(settings.position);
}
}
if (pos < settings.limit) {
pos = settings.limit;
}
self.position(pos, true);
if (splitters.length == 0) { // first time bind events to document
$(window).bind('resize.splitter', function() {
$.each(splitters, function(i, splitter) {
splitter.refresh();
});
});
$(document.documentElement).bind('mousedown.splitter', function(e) {
if (splitter_id !== null) {
current_splitter = splitters[splitter_id];
//BOROO added this code [start]
if ($(current_splitter.splitControl).attr('class') === 'vsplitter') {
var p1_none = $(current_splitter.splitControl).prev().css('display') === 'none';
if (p1_none) {
$(current_splitter.splitControl)
.css('cursor', 'col-resize')
.prev().show();
$(current_splitter).trigger('splitter.showing');
current_splitter.refresh();
} else {
var n1_none = $(current_splitter.splitControl).next().css('display') === 'none';
if (n1_none) {
$(current_splitter.splitControl)
.css('cursor', 'col-resize')
.next().show();
$(current_splitter).trigger('splitter.showing');
current_splitter.refresh();
}
}
}
//BOROO added this code [end]
$('<div class="splitterMask"></div>').insertAfter(current_splitter);
if (current_splitter.orientation == 'horizontal') {
$('body').css('cursor', 'row-resize');
} else if (current_splitter.orientation == 'vertical') {
$('body').css('cursor', 'col-resize');
}
settings.onDragStart(e);
return false;
}
}).bind('mouseup.splitter', function(e) {
$('.splitterMask').remove();
current_splitter = null;
$('body').css('cursor', 'auto');
settings.onDragEnd(e);
}).bind('mousemove.splitter', function(e) {
if (current_splitter !== null) {
var limit = current_splitter.limit;
var offset = current_splitter.offset();
if (current_splitter.orientation == 'vertical') {
var x = e.pageX - offset.left;
if (x <= current_splitter.limit) {
x = current_splitter.limit + 1;
}
else if (x >= current_splitter.width() - limit) {
x = current_splitter.width() - limit - 1;
}
if (x > current_splitter.limit &&
x < current_splitter.width() - limit) {
current_splitter.position(x, true);
current_splitter.find('.splitter_panel').trigger('splitter.resize');
return false;
}
} else if (current_splitter.orientation == 'horizontal') {
var y = e.pageY - offset.top;
if (y <= current_splitter.limit) {
y = current_splitter.limit + 1;
}
else if (y >= current_splitter.height() - limit) {
y = current_splitter.height() - limit - 1;
}
if (y > current_splitter.limit &&
y < current_splitter.height() - limit) {
current_splitter.position(y, true);
current_splitter.trigger('splitter.resize');
return false;
}
}
settings.onDrag(e);
}
});
}
splitters.push(self);
self.data('splitter', self);
return self;
};
})(jQuery);
CSS
#nav-panel {
display: block;
position: relative;
width: 100%;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
}
#nav-panel ul.rightnav{
position: fixed;
list-style: none;
padding: 0 10px;
top: 0;
right: 0;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.rightnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.rightnav li div{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.rightnav li div a:hover{
text-decoration: underline;
}
ul.rightnav li div.time {
position: relative;
line-height: 11px;
width: 140px;
padding: 6px 2px;
text-align: right;
font-size: 11px;
}
ul.rightnav li div.time i {
position: relative;
font-style: normal;
white-space: nowrap;
top: -2px;
}
ul.rightnav li div#test {
padding: 0;
margin: 0;
}
#nav-panel ul.topnav {
list-style: none;
padding: 0 10px;
margin: 0;
float: left;
display: block;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.topnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
cursor: pointer;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.topnav li a{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.topnav li a.hover{
background: url(images/bg-noise.jpg) repeat-x scroll 0 0 #1B1B1B;
}
ul.topnav li.parnav a{
padding-right: 30px;
}
ul.topnav li.parnav a span { /*--Drop down trigger styles--*/
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/subnav10.gif) no-repeat center top;
}
ul.topnav li.subnav a{
padding-right: 30px;
}
ul.topnav li.subnav a span {
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/dropdo10.gif) no-repeat center center;
}
ul.topnav li ul.subul {
list-style: none;
position: absolute;
left: -2px; top: 32px;
margin: 0; padding: 0;
display: none;
float: left;
border: 1px solid #111;
border-top: none;
background: url(images/bg-noise.jpg) repeat scroll 0 0 #1B1B1B;
z-index: 10000;
}
ul.topnav li.subnav ul.subul {
border: 1px solid #111;
}
ul.topnav li ul.subul li{
margin: 0; padding: 0;
color: #E6E6E6;
display: block;
float: none;
clear: both;
}
ul.topnav li ul.subul li a {
white-space: nowrap;
padding-left: 15px;
}
ul.topnav li ul.subul li a:hover {
background: #111;
}
ul.topnav li ul.subul li.sepline{
border-top: 1px solid #444;
}
var splitter_count = 0;
var splitter_id = null;
var splitters = [];
var current_splitter = null;
$.fn.split = function(options) {
var data = this.data('splitter');
if (data) {
return data;
}
var panel_1;
var panel_2;
var settings = $.extend({
rightIsFixed: false, //BOROO added this line
limit: 100,
orientation: 'horizontal',
position: '25%',
onDragStart: $.noop,
onDragEnd: $.noop,
onDrag: $.noop,
onRefresh: $.noop,
onShowing: $.noop,
onHidding: $.noop
}, options || {});
var cls;
var children = this.children();
if (settings.orientation == 'vertical') {
panel_1 = children.first().addClass('left_panel');
panel_2 = panel_1.next().addClass('right_panel');
cls = 'vsplitter';
} else if (settings.orientation == 'horizontal') {
panel_1 = children.first().addClass('top_panel')
panel_2 = panel_1.next().addClass('bottom_panel');
cls = 'hsplitter';
}
var width = this.width();
var height = this.height();
var id = splitter_count;
splitter_count++;
this.addClass('splitter_panel');
var splitter = $('<div/>').addClass(cls).data('splitter-id', id).mouseenter(function() {
splitter_id = $(this).data('splitter-id');
}).mouseleave(function() {
splitter_id = null;
}).insertAfter(panel_1);
var position;
function get_position(position) {
if (typeof position === 'number') {
return position;
} else if (typeof position === 'string') {
var match = position.match(/^([0-9]+)(px|%)$/);
if (match) {
if (match[2] == 'px') {
return +match[1];
} else {
if (settings.orientation == 'vertical') {
return (width * +match[1]) / 100;
} else if (settings.orientation == 'horizontal') {
return (height * +match[1]) / 100;
}
}
} else {
//throw position + ' is invalid value';
}
} else {
//throw 'position have invalid type';
}
}
var self = $.extend(this, {
splitControl: splitter,
onRefresh: settings.onRefresh,
onShowing: settings.onShowing,
onHidding: settings.onHidding
});
self = $.extend(self, {
refresh: function() {
var new_width = this.width();
var new_height = this.height();
if (width != new_width || height != new_height) {
width = this.width();
height = this.height();
self.position(position);
} else {
//BOROO added this code [start]
var p1_none = $(splitter).prev().css('display') === 'none';
if (p1_none) {
splitter.css('cursor', 'pointer');
} else {
var n1_none = $(splitter).next().css('display') === 'none';
if (n1_none) {
splitter.css('cursor', 'pointer');
} else {
splitter.css('cursor', 'col-resize');
}
}
self.position(position);
//BOROO added this code [end]
}
//BOROO added this code [start]
self.find('.splitter_panel').trigger('splitter.refresh');
//BOROO added this code [end]
},
position: (function() {
if (settings.orientation == 'vertical') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.width() / 2;
//BOROO edited this code [start]
var p1_none = $(splitter).prev().css('display') === 'none';
if (p1_none) {
self.find('.splitter_panel').trigger('splitter.hidding');
splitter.css('left', 0);
panel_2.width(self.width() - splitter.width());
} else {
var n1_none = $(splitter).next().css('display') === 'none';
if (n1_none) {
self.find('.splitter_panel').trigger('splitter.hidding');
splitter.css('left', self.width() - splitter.width());
panel_1.width(self.width() - splitter.width());
} else {
splitter.css('left', position - sw);
panel_1.width(position - sw);
panel_2.width(self.width() - position - sw);
}
}
//BOROO edited this code [end]
}
if (!silent) {
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else if (settings.orientation == 'horizontal') {
return function(n, silent) {
if (n === undefined) {
return position;
} else {
position = get_position(n);
var sw = splitter.height() / 2;
splitter.css('top', position - sw);
panel_1.height(position - sw);
panel_2.height(self.height() - position - sw);
}
if (!silent) {
self.find('.splitter_panel').trigger('splitter.resize');
}
return self;
};
} else {
return $.noop;
}
})(),
orientation: settings.orientation,
limit: settings.limit,
rightIsFixed: settings.rightIsFixed, //BOROO added this line
isActive: function() {
return splitter_id === id;
},
destroy: function() {
self.removeClass('splitter_panel');
splitter.unbind('mouseenter');
splitter.unbind('mouseleave');
if (settings.orientation == 'vertical') {
panel_1.removeClass('left_panel');
panel_2.removeClass('right_panel');
} else if (settings.orientation == 'horizontal') {
panel_1.removeClass('top_panel');
panel_2.removeClass('bottom_panel');
}
self.unbind('splitter.resize');
self.find('.splitter_panel').trigger('splitter.resize');
splitters[id] = null;
splitter.remove();
var not_null = false;
for (var i = splitters.length; i--; ) {
if (splitters[i] !== null) {
not_null = true;
break;
}
}
//remove document events when no splitters
if (!not_null) {
$(document.documentElement).unbind('.splitter');
$(window).unbind('resize.splitter');
splitters = [];
}
//BOROO added this code [start]
var data = self.data('splitter');
if (data) {
self.removeData('splitter');
}
return self;
//BOROO added this code [end]
}
});
self.bind('splitter.refresh', function() {
//call refresh method
self.onRefresh();
});
self.bind('splitter.showing', function() {
//call refresh method
self.onShowing();
});
self.bind('splitter.hidding', function() {
//call refresh method
self.onHidding();
});
self.bind('splitter.resize', function(e) {
var pos = self.position();
//BOROO added this code [start]
if (self.orientation === 'vertical') {
if (self.rightIsFixed) {
var oldw = self.data('old-width');
if (typeof oldw !== 'undefined' && oldw !== self.width()) {
pos = pos + (self.width() - oldw);
//self.width() - panel_2.width() - sw;
}
}
}
//BOROO added this code [end]
if (self.orientation == 'vertical' && pos > self.width()) {
pos = self.width() - self.limit - 1;
} else if (self.orientation == 'horizontal' && pos > self.height()) {
pos = self.height() - self.limit - 1;
}
if (pos < self.limit) {
pos = self.limit + 1;
}
self.data('old-width', self.width());
self.position(pos, true);
});
//inital position of splitter
var pos;
if (settings.orientation == 'vertical') {
if (pos > width - settings.limit) {
pos = width - settings.limit;
} else {
pos = get_position(settings.position);
}
} else if (settings.orientation == 'horizontal') {
//position = height/2;
if (pos > height - settings.limit) {
pos = height - settings.limit;
} else {
pos = get_position(settings.position);
}
}
if (pos < settings.limit) {
pos = settings.limit;
}
self.position(pos, true);
if (splitters.length == 0) { // first time bind events to document
$(window).bind('resize.splitter', function() {
$.each(splitters, function(i, splitter) {
splitter.refresh();
});
});
$(document.documentElement).bind('mousedown.splitter', function(e) {
if (splitter_id !== null) {
current_splitter = splitters[splitter_id];
//BOROO added this code [start]
if ($(current_splitter.splitControl).attr('class') === 'vsplitter') {
var p1_none = $(current_splitter.splitControl).prev().css('display') === 'none';
if (p1_none) {
$(current_splitter.splitControl)
.css('cursor', 'col-resize')
.prev().show();
$(current_splitter).trigger('splitter.showing');
current_splitter.refresh();
} else {
var n1_none = $(current_splitter.splitControl).next().css('display') === 'none';
if (n1_none) {
$(current_splitter.splitControl)
.css('cursor', 'col-resize')
.next().show();
$(current_splitter).trigger('splitter.showing');
current_splitter.refresh();
}
}
}
//BOROO added this code [end]
$('<div class="splitterMask"></div>').insertAfter(current_splitter);
if (current_splitter.orientation == 'horizontal') {
$('body').css('cursor', 'row-resize');
} else if (current_splitter.orientation == 'vertical') {
$('body').css('cursor', 'col-resize');
}
settings.onDragStart(e);
return false;
}
}).bind('mouseup.splitter', function(e) {
$('.splitterMask').remove();
current_splitter = null;
$('body').css('cursor', 'auto');
settings.onDragEnd(e);
}).bind('mousemove.splitter', function(e) {
if (current_splitter !== null) {
var limit = current_splitter.limit;
var offset = current_splitter.offset();
if (current_splitter.orientation == 'vertical') {
var x = e.pageX - offset.left;
if (x <= current_splitter.limit) {
x = current_splitter.limit + 1;
}
else if (x >= current_splitter.width() - limit) {
x = current_splitter.width() - limit - 1;
}
if (x > current_splitter.limit &&
x < current_splitter.width() - limit) {
current_splitter.position(x, true);
current_splitter.find('.splitter_panel').trigger('splitter.resize');
return false;
}
} else if (current_splitter.orientation == 'horizontal') {
var y = e.pageY - offset.top;
if (y <= current_splitter.limit) {
y = current_splitter.limit + 1;
}
else if (y >= current_splitter.height() - limit) {
y = current_splitter.height() - limit - 1;
}
if (y > current_splitter.limit &&
y < current_splitter.height() - limit) {
current_splitter.position(y, true);
current_splitter.trigger('splitter.resize');
return false;
}
}
settings.onDrag(e);
}
});
}
splitters.push(self);
self.data('splitter', self);
return self;
};
})(jQuery);
CSS
#nav-panel {
display: block;
position: relative;
width: 100%;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
}
#nav-panel ul.rightnav{
position: fixed;
list-style: none;
padding: 0 10px;
top: 0;
right: 0;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.rightnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.rightnav li div{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.rightnav li div a:hover{
text-decoration: underline;
}
ul.rightnav li div.time {
position: relative;
line-height: 11px;
width: 140px;
padding: 6px 2px;
text-align: right;
font-size: 11px;
}
ul.rightnav li div.time i {
position: relative;
font-style: normal;
white-space: nowrap;
top: -2px;
}
ul.rightnav li div#test {
padding: 0;
margin: 0;
}
#nav-panel ul.topnav {
list-style: none;
padding: 0 10px;
margin: 0;
float: left;
display: block;
height: 34px;
background: url(images/bg-nav.png) repeat-x scroll 0 bottom #1B1B1B;
font-size: 1.2em;
}
ul.topnav li {
border-left: 1px solid #444;
border-right: 1px solid #333;
cursor: pointer;
display: inline-block;
float: left;
font: bold 13px/17px "Helvetica Neue",Helvetica,Arial,Geneva,sans-serif;
position: relative;
text-shadow: 0 0 2px #000000;
}
ul.topnav li a{
color: #E6E6E6;
display: block;
font-style: normal;
font-weight: normal;
padding: 8px 12px;
vertical-align: middle;
text-decoration: none;
}
ul.topnav li a.hover{
background: url(images/bg-noise.jpg) repeat-x scroll 0 0 #1B1B1B;
}
ul.topnav li.parnav a{
padding-right: 30px;
}
ul.topnav li.parnav a span { /*--Drop down trigger styles--*/
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/subnav10.gif) no-repeat center top;
}
ul.topnav li.subnav a{
padding-right: 30px;
}
ul.topnav li.subnav a span {
position: absolute;
right: 10px;
top: 0;
width: 10px;
height: 34px;
background: url(images/dropdo10.gif) no-repeat center center;
}
ul.topnav li ul.subul {
list-style: none;
position: absolute;
left: -2px; top: 32px;
margin: 0; padding: 0;
display: none;
float: left;
border: 1px solid #111;
border-top: none;
background: url(images/bg-noise.jpg) repeat scroll 0 0 #1B1B1B;
z-index: 10000;
}
ul.topnav li.subnav ul.subul {
border: 1px solid #111;
}
ul.topnav li ul.subul li{
margin: 0; padding: 0;
color: #E6E6E6;
display: block;
float: none;
clear: both;
}
ul.topnav li ul.subul li a {
white-space: nowrap;
padding-left: 15px;
}
ul.topnav li ul.subul li a:hover {
background: #111;
}
ul.topnav li ul.subul li.sepline{
border-top: 1px solid #444;
}
javascript prototype extends attempt, 2009
/////////////////////////////////prototype extends///////////////////////////////////
//prototype
Date.prototype.formatedString = function () {
var Y = "" + this.getFullYear();
var mm = "" + (this.getMonth() + 1);
var d = "" + this.getDate();
var h = "" + this.getHours();
var m = "" + this.getMinutes();
var s = "" + this.getSeconds();
return Y + "." + (mm.length == 1 ? "0" + mm : mm) + "." + (d.length == 1 ? "0" + d : d)
+ " " + (h.length == 1 ? "0" + h : h) + ":" + (m.length == 1 ? "0" + m : m) + ":" + (s.length == 1 ? "0" + s : s);
}
Date.prototype.isBetween = function (start, end) {
return (start <= this && this <= end);
}
String.prototype.isBool = function () {
return (/^true$/i).test(this) || (/^false$/i).test(this);
};
String.prototype.isInt = function () {
return (/^[0-9]+$/).test(this);
};
String.prototype.isDouble = function () {
return (/^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$/).test(this);
};
String.prototype.isMoney = function () {
return (/^\$?\d+(\.(\d{2}))?$/).test(this);
};
String.prototype.isTrue = function () {
return (/^true$/i).test(this);
};
//StringBuilder
StringBuilder = function (value) {
this.strings = new Array("");
this.append(value);
}
StringBuilder.prototype.append = function (value, unshift) {
if (unshift) {
this.strings.unshift(value);
} else {
this.strings.push(value);
}
}
StringBuilder.prototype.clear = function () {
this.strings.length = 1;
}
StringBuilder.prototype.toString = function () {
return this.strings.join("");
}
//convert methods
__ToTimeStr = function (n) {
var v = n + '';
return (v.length == 1 ? '0' + v : v);
}
__ToNumeric = function (s) {
var i = 0;
var v = s + '';
do {
var c = v.charAt(i);
if (c == '0') i++; else break;
} while (i < v.length);
if (i == v.length) return 0;
return parseInt(i == 0 ? v : v.substr(i, v.length - i));
}
__DateStrToArray = function (value) {
var values = new Array();
values["year"] = __ToNumeric(value.substr(0, 4));
values["month"] = __ToNumeric(value.substr(5, 2));
values["day"] = __ToNumeric(value.substr(8, 2));
values["hour"] = __ToNumeric(value.substr(11, 2));
values["minute"] = __ToNumeric(value.substr(14, 2));
values["second"] = __ToNumeric(value.substr(17, 2));
return values;
}
//string utility
__has = function (text) {
return !(text == null || _trim(text) == '');
};
__trim = function (text) {
return text.replace(/^\s+|\s+$/g, "");
}
__date = function (value) {
var arr = __DateStrToArray(value);
var d = new Date();
d.setFullYear(arr["year"], arr["month"] - 1, arr["day"]);
d.setHours(arr["hour"], arr["minute"], arr["second"], 0);
return d;
}
//browser data utility
__cookie = function (name, value, exp_date) {
if (name && !value && !exp_date) {
//get
var results = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
if (results)
return (unescape(results[2]));
else
return null;
}
if (name && value == false) {
//delete
var cookie_date = new Date(); // current date & time
cookie_date.setTime(cookie_date.getTime() - 1);
document.cookie = name + "=; expires=" + cookie_date.toGMTString();
} else {
var cookie_string = name + "=" + escape(value);
if (exp_date) {
if (typeof exp_date != 'string')
cookie_string += "; expires=" + exp_date.toGMTString();
else
cookie_string += "; expires=" + exp_date;
}
if (path)
cookie_string += "; path=" + escape(path);
if (domain)
cookie_string += "; domain=" + escape(domain);
if (secure)
cookie_string += "; secure";
document.cookie = cookie_string;
}
}
__cookieForever = function (name, value) {
if (value != null) {
value = value.toString();
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth() + 12);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expireDate.toGMTString();
return document.cookie;
} else {
if (document.cookie != "") {
var arr = document.cookie.split(";");
for (var i = 0; i < arr.length; i++) {
var val2 = arr[i].split("=");
if (val2[0].replace(' ', '') == name)
return decodeURIComponent(val2[1]);
}
}
return null;
}
}
//if use this method path=/
__cookieWide = function (name, value) {
if (value != null) {
value = value.toString();
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth() + 12);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expireDate.toGMTString() + ";path=/";
return document.cookie;
} else {
if (document.cookie != "") {
var arr = document.cookie.split(";");
for (var i = 0; i < arr.length; i++) {
var val2 = arr[i].split("=");
if (val2[0].replace(' ', '') == name)
return decodeURIComponent(val2[1]);
}
}
return null;
}
}
__postdata = function () {
var r20 = /%20/g;
//('name','value')
if (arguments.length == 2) {
if (typeof arguments[2] !== 'function') {
var key = arguments[0];
var value = arguments[1];
return encodeURIComponent(key) + "=" + encodeURIComponent(value).replace(r20, "+");
}
} else {
var s = [], add = function (key, value) {
// If value is a function, invoke it and return its value
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value).replace(r20, "+");
}, arr = arguments[0];
//any string
if (typeof arr == 'string') {
return encodeURIComponent(arr).replace(r20, "+");
} else {
//[{name:'name'},{value:'value'}]
for (i = 0; i < arr.length; i++) {
add(arr[i].name, arr[i].value);
}
return s.join("&").replace(r20, "+");
}
}
}
__homepage = function (url) {
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(url);
}
else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e) {
alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', url);
}
}
__copy = function (id) {
if (window.clipboardData && window.clipboardData.setData) // Internet Explorer
{
window.clipboardData.setData("text", text);
}
else {
unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
clipboardHelper.copyString(text);
}
}
//event methods
__RemoveSelection = function () {
if (window.getSelection) {
var selection = window.getSelection();
selection.removeAllRanges();
} else if (document.selection.createRange) {
var range = document.selection.createRange();
document.selection.empty();
}
}
__NumericKeyDown = function (e) {
var obj = e.srcElement ? e.srcElement : e.target;
var key = e.keyCode ? e.keyCode : e.which;
if (key == 8 || key == '8' || key == 9 || key == '9' || key == 46 || key == '46') return true;
if (key == 37 || key == '37' || key == 39 || key == '39') return true;
if (key == 189 || key == '189' || key == 109 || key == '109') {
if (obj.value.indexOf('-') > -1 || obj.value.indexOf('-') > -1) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
else {
return true;
}
}
if (key == 190 || key == '190' || key == 110 || key == '110') {
if (obj.value.indexOf('.') > -1 || obj.value.indexOf('.') > -1) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
else {
return true;
}
}
if (!(48 <= key && key <= 57 || 96 <= key && key <= 105)) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
return true;
}
__FormattedKeyDown = function (evt, format) {
try {
var obj;
if (evt.srcElement) obj = evt.srcElement; else obj = evt.target;
if (evt.keyCode == '8' || evt.witch == '8' || evt.keyCode == '46' || evt.witch == '46') {
if (document.execCommand) document.execCommand('undo', false, null);
return false;
}
var locs = format;
var cpos = __doGetCaretPosition(obj) - 1;
if (cpos < 0) cpos = 0;
var chr = __doGetCaretChar(obj, cpos);
/*String.fromCharCode(evt.keyCode);*/
if (evt.keyCode == '36' || evt.witch == '36') {
__doSetCaretPosition(obj, 0);
return true;
}
if (evt.keyCode == '37' || evt.witch == '37' || evt.keyCode == '38' || evt.witch == '38') {
__doSetCaretPosition(obj, cpos);
return true;
}
if (evt.keyCode == '39' || evt.witch == '39' || evt.keyCode == '35' || evt.witch == '35') {
if (evt.srcElement) {
if (cpos >= locs.length - 1) cpos = obj.value.length - 1; else cpos++;
__doSetCaretPosition(obj, cpos);
return true;
} else {
__doSetCaretPosition(obj, cpos);
return true;
}
}
var loc = locs.charAt(cpos);
__doSetCaretPosition(obj, cpos);
if (chr.length > 0) {
if (loc == '#') {
if ("0123456789".indexOf(chr.charAt(0)) == -1) __doSetCaretChar(obj, cpos, "0");
}
else if (loc != '*') __doSetCaretChar(obj, cpos, loc);
__doSetCaretPosition(obj, cpos + 1);
}
return true;
} catch (e) {
alert(e);
return false;
}
}
__doGetCaretChar = function (oField, iCaretPos) {
return oField.value.substr(iCaretPos);
}
__doSetCaretChar = function (oField, iCaretPos, oText) {
if (oField.value.length <= 0 || oField.value.length < iCaretPos) return;
oField.value = oField.value.substr(0, iCaretPos) + oText + oField.value.substr(iCaretPos + 1);
}
__doGetCaretPosition = function (oField) {
var iCaretPos = 0;
if (document.selection) {
oField.focus();
var oSel = document.selection.createRange();
oSel.moveStart('character', -oField.value.length);
iCaretPos = oSel.text.length;
} else if (oField.selectionStart) iCaretPos = oField.selectionStart;
return iCaretPos;
}
__doSetCaretPosition = function (oField, iCaretPos) {
if (document.selection) {
__RemoveSelection();
var oSel = document.selection.createRange();
oSel.moveStart('character', iCaretPos);
oSel.moveEnd('character', 1);
oSel.select();
} else {
oField.selectionStart = iCaretPos;
oField.selectionEnd = iCaretPos + 1;
oField.focus();
}
}
//prototype
Date.prototype.formatedString = function () {
var Y = "" + this.getFullYear();
var mm = "" + (this.getMonth() + 1);
var d = "" + this.getDate();
var h = "" + this.getHours();
var m = "" + this.getMinutes();
var s = "" + this.getSeconds();
return Y + "." + (mm.length == 1 ? "0" + mm : mm) + "." + (d.length == 1 ? "0" + d : d)
+ " " + (h.length == 1 ? "0" + h : h) + ":" + (m.length == 1 ? "0" + m : m) + ":" + (s.length == 1 ? "0" + s : s);
}
Date.prototype.isBetween = function (start, end) {
return (start <= this && this <= end);
}
String.prototype.isBool = function () {
return (/^true$/i).test(this) || (/^false$/i).test(this);
};
String.prototype.isInt = function () {
return (/^[0-9]+$/).test(this);
};
String.prototype.isDouble = function () {
return (/^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$/).test(this);
};
String.prototype.isMoney = function () {
return (/^\$?\d+(\.(\d{2}))?$/).test(this);
};
String.prototype.isTrue = function () {
return (/^true$/i).test(this);
};
//StringBuilder
StringBuilder = function (value) {
this.strings = new Array("");
this.append(value);
}
StringBuilder.prototype.append = function (value, unshift) {
if (unshift) {
this.strings.unshift(value);
} else {
this.strings.push(value);
}
}
StringBuilder.prototype.clear = function () {
this.strings.length = 1;
}
StringBuilder.prototype.toString = function () {
return this.strings.join("");
}
//convert methods
__ToTimeStr = function (n) {
var v = n + '';
return (v.length == 1 ? '0' + v : v);
}
__ToNumeric = function (s) {
var i = 0;
var v = s + '';
do {
var c = v.charAt(i);
if (c == '0') i++; else break;
} while (i < v.length);
if (i == v.length) return 0;
return parseInt(i == 0 ? v : v.substr(i, v.length - i));
}
__DateStrToArray = function (value) {
var values = new Array();
values["year"] = __ToNumeric(value.substr(0, 4));
values["month"] = __ToNumeric(value.substr(5, 2));
values["day"] = __ToNumeric(value.substr(8, 2));
values["hour"] = __ToNumeric(value.substr(11, 2));
values["minute"] = __ToNumeric(value.substr(14, 2));
values["second"] = __ToNumeric(value.substr(17, 2));
return values;
}
//string utility
__has = function (text) {
return !(text == null || _trim(text) == '');
};
__trim = function (text) {
return text.replace(/^\s+|\s+$/g, "");
}
__date = function (value) {
var arr = __DateStrToArray(value);
var d = new Date();
d.setFullYear(arr["year"], arr["month"] - 1, arr["day"]);
d.setHours(arr["hour"], arr["minute"], arr["second"], 0);
return d;
}
//browser data utility
__cookie = function (name, value, exp_date) {
if (name && !value && !exp_date) {
//get
var results = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
if (results)
return (unescape(results[2]));
else
return null;
}
if (name && value == false) {
//delete
var cookie_date = new Date(); // current date & time
cookie_date.setTime(cookie_date.getTime() - 1);
document.cookie = name + "=; expires=" + cookie_date.toGMTString();
} else {
var cookie_string = name + "=" + escape(value);
if (exp_date) {
if (typeof exp_date != 'string')
cookie_string += "; expires=" + exp_date.toGMTString();
else
cookie_string += "; expires=" + exp_date;
}
if (path)
cookie_string += "; path=" + escape(path);
if (domain)
cookie_string += "; domain=" + escape(domain);
if (secure)
cookie_string += "; secure";
document.cookie = cookie_string;
}
}
__cookieForever = function (name, value) {
if (value != null) {
value = value.toString();
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth() + 12);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expireDate.toGMTString();
return document.cookie;
} else {
if (document.cookie != "") {
var arr = document.cookie.split(";");
for (var i = 0; i < arr.length; i++) {
var val2 = arr[i].split("=");
if (val2[0].replace(' ', '') == name)
return decodeURIComponent(val2[1]);
}
}
return null;
}
}
//if use this method path=/
__cookieWide = function (name, value) {
if (value != null) {
value = value.toString();
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth() + 12);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + expireDate.toGMTString() + ";path=/";
return document.cookie;
} else {
if (document.cookie != "") {
var arr = document.cookie.split(";");
for (var i = 0; i < arr.length; i++) {
var val2 = arr[i].split("=");
if (val2[0].replace(' ', '') == name)
return decodeURIComponent(val2[1]);
}
}
return null;
}
}
__postdata = function () {
var r20 = /%20/g;
//('name','value')
if (arguments.length == 2) {
if (typeof arguments[2] !== 'function') {
var key = arguments[0];
var value = arguments[1];
return encodeURIComponent(key) + "=" + encodeURIComponent(value).replace(r20, "+");
}
} else {
var s = [], add = function (key, value) {
// If value is a function, invoke it and return its value
s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value).replace(r20, "+");
}, arr = arguments[0];
//any string
if (typeof arr == 'string') {
return encodeURIComponent(arr).replace(r20, "+");
} else {
//[{name:'name'},{value:'value'}]
for (i = 0; i < arr.length; i++) {
add(arr[i].name, arr[i].value);
}
return s.join("&").replace(r20, "+");
}
}
}
__homepage = function (url) {
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage(url);
}
else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch (e) {
alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', url);
}
}
__copy = function (id) {
if (window.clipboardData && window.clipboardData.setData) // Internet Explorer
{
window.clipboardData.setData("text", text);
}
else {
unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
clipboardHelper.copyString(text);
}
}
//event methods
__RemoveSelection = function () {
if (window.getSelection) {
var selection = window.getSelection();
selection.removeAllRanges();
} else if (document.selection.createRange) {
var range = document.selection.createRange();
document.selection.empty();
}
}
__NumericKeyDown = function (e) {
var obj = e.srcElement ? e.srcElement : e.target;
var key = e.keyCode ? e.keyCode : e.which;
if (key == 8 || key == '8' || key == 9 || key == '9' || key == 46 || key == '46') return true;
if (key == 37 || key == '37' || key == 39 || key == '39') return true;
if (key == 189 || key == '189' || key == 109 || key == '109') {
if (obj.value.indexOf('-') > -1 || obj.value.indexOf('-') > -1) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
else {
return true;
}
}
if (key == 190 || key == '190' || key == 110 || key == '110') {
if (obj.value.indexOf('.') > -1 || obj.value.indexOf('.') > -1) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
else {
return true;
}
}
if (!(48 <= key && key <= 57 || 96 <= key && key <= 105)) {
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
return false;
}
return true;
}
__FormattedKeyDown = function (evt, format) {
try {
var obj;
if (evt.srcElement) obj = evt.srcElement; else obj = evt.target;
if (evt.keyCode == '8' || evt.witch == '8' || evt.keyCode == '46' || evt.witch == '46') {
if (document.execCommand) document.execCommand('undo', false, null);
return false;
}
var locs = format;
var cpos = __doGetCaretPosition(obj) - 1;
if (cpos < 0) cpos = 0;
var chr = __doGetCaretChar(obj, cpos);
/*String.fromCharCode(evt.keyCode);*/
if (evt.keyCode == '36' || evt.witch == '36') {
__doSetCaretPosition(obj, 0);
return true;
}
if (evt.keyCode == '37' || evt.witch == '37' || evt.keyCode == '38' || evt.witch == '38') {
__doSetCaretPosition(obj, cpos);
return true;
}
if (evt.keyCode == '39' || evt.witch == '39' || evt.keyCode == '35' || evt.witch == '35') {
if (evt.srcElement) {
if (cpos >= locs.length - 1) cpos = obj.value.length - 1; else cpos++;
__doSetCaretPosition(obj, cpos);
return true;
} else {
__doSetCaretPosition(obj, cpos);
return true;
}
}
var loc = locs.charAt(cpos);
__doSetCaretPosition(obj, cpos);
if (chr.length > 0) {
if (loc == '#') {
if ("0123456789".indexOf(chr.charAt(0)) == -1) __doSetCaretChar(obj, cpos, "0");
}
else if (loc != '*') __doSetCaretChar(obj, cpos, loc);
__doSetCaretPosition(obj, cpos + 1);
}
return true;
} catch (e) {
alert(e);
return false;
}
}
__doGetCaretChar = function (oField, iCaretPos) {
return oField.value.substr(iCaretPos);
}
__doSetCaretChar = function (oField, iCaretPos, oText) {
if (oField.value.length <= 0 || oField.value.length < iCaretPos) return;
oField.value = oField.value.substr(0, iCaretPos) + oText + oField.value.substr(iCaretPos + 1);
}
__doGetCaretPosition = function (oField) {
var iCaretPos = 0;
if (document.selection) {
oField.focus();
var oSel = document.selection.createRange();
oSel.moveStart('character', -oField.value.length);
iCaretPos = oSel.text.length;
} else if (oField.selectionStart) iCaretPos = oField.selectionStart;
return iCaretPos;
}
__doSetCaretPosition = function (oField, iCaretPos) {
if (document.selection) {
__RemoveSelection();
var oSel = document.selection.createRange();
oSel.moveStart('character', iCaretPos);
oSel.moveEnd('character', 1);
oSel.select();
} else {
oField.selectionStart = iCaretPos;
oField.selectionEnd = iCaretPos + 1;
oField.focus();
}
}
jquery extends attempt, 2009
var _objects = {
interface0: {
data: new Array(),
getString: function () { return JSON.stringify(this); },
extend: function (args) {
var obj = (typeof args == 'string') ? eval('(' + args + ')') : args;
$.extend(this, obj, true);
return this;
},
parse: function (args) {
var i = args.toString().indexOf('{');
if (i == -1) i = args.toString().indexOf('}');
if (i == -1) { return { data: args.toString() }; }
return (typeof args == 'string') ? eval('(' + args + ')') : args;
}
},
create: function () {
var o = {};
if (arguments.length == 1) {
try {
//Long l = Long.parseLong(arguments[0]);
o = $.extend({}, { id: arguments[0] }, true);
} catch (ex) {
o = $.extend({}, { id: 0 }, true);
var obj = (typeof arguments[0] == 'string') ? eval('(' + arguments[0] + ')') : arguments[0];
o = $.extend({}, obj, true);
}
} else if (arguments.length == 2) {
var obj = (typeof arguments[1] == 'string') ? eval('(' + arguments[1] + ')') : arguments[1];
o = $.extend({}, obj, true);
o = $.extend(o, { id: arguments[0] }, true);
} else
o = $.extend({}, { id: 0 }, true);
o = $.extend(o, this.interface0, true);
o.data = new Array();
//usage::
//var n = new MyEntity(10);
//n.hi = "hi boroo";
//n.extend({name:"boroo"});
//var obj = new MyEntity(20, n.getString());
//var n = new MyEntity(10, "{name:'baatar'}");
//n.data["a"]="b";
//alert( n.data["a"] );
return o;
}
//var a = _objects.create(22);
//var b = _objects.create(33);
//b.hi = "welcome, boroo";
//b.id="1";
//a.extend(b.getString());
//alert(a.data.length);
};
(function ($) {
$._Calendar = new Date();
$.extend($._Calendar, {
month: function() { return $._Calendar.getMonth() + 1; },
months: function() { return ("" + ($._Calendar.getMonth() + 1)).length == 1 ? "0" + ($._Calendar.getMonth() + 1) : "" + ($._Calendar.getMonth() + 1); },
year: function() { return $._Calendar.getFullYear(); },
dow: function() { return $._Calendar.getDay(); },
dom: function() { return $._Calendar.getDate() },
doms: function() { return ("" + $._Calendar.getDate()).length == 1 ? "0" + $._Calendar.getDate() : "" + $._Calendar.getDate(); }
}, true);
$.extend($._Calendar, {
dateValue: function () { return $._Calendar.year() + "." + $._Calendar.months() + "." + $._Calendar.doms(); },
nowString: function () {
var d = new Date();
return d.toGMTString();
},
dateString: function () {
var d = new Date();
return d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();
},
timeString: function () {
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
}
}, true);
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
//(elem.textContent || elem.innerText || '')
var val = $(elem).html().toLowerCase();
var str = (match[3] || "").toLowerCase();
return (val.indexOf(str) >= 0);
}
});
$.centerPopup = function() {
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popupContent").height();
var popupWidth = $("#popupContent").width();
//centering
$("#popupContent").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6
$("#backgroundPopup").css({
"height": windowHeight
});
};
$.filterTable = function(text, dataTableSelector, targetTableSelector) {
if (typeof $(dataTableSelector).data("Table-Tr-Data") == 'undefined' || $(dataTableSelector).data("Table-Tr-Data") == null) {
$(dataTableSelector).data("Table-Tr-Data", $(dataTableSelector).find("> tbody > tr"));
}
var plus = (text.indexOf('+') > -1);
var trs = $(dataTableSelector).data("Table-Tr-Data");
var target = $(targetTableSelector).find(">tbody");
$(target).children().remove();
if (plus) {
var txts = text.split('+');
for (var i = 0; i < txts.length; i++) {
var txt = txts[i];
trs = $(trs).filter(":containsi('" + txt + "')");
}
$(target).append(trs);
} else {
var txts = text.split(' ');
for (var i = 0; i < txts.length; i++) {
var txt = txts[i];
var trs0 = $(trs).filter(":containsi('" + txt + "')");
$(target).append(trs0);
}
}
return trs;
};
$.fn.makeDatePicker = function (method, format) {
var calendarButtonGif = "/Scripts/jquery/images/calendar.gif";
var target = $(this).datepicker({
showOn: "both",
buttonImage: calendarButtonGif,
buttonImageOnly: true,
showOtherMonths: true,
selectOtherMonths: true,
changeMonth: true,
changeYear: true,
onSelect: method,
dateFormat: ((format == null || !format || typeof format == 'undefined') ? $.datepicker.ATOM : format),
yearRange: 'c-100:c+20'
//constrainInput: false
}).change(method);
var inst = $.datepicker._getInst(target[0]);
var dateFormat = $.datepicker._get(inst, 'dateFormat');
var settings = $.datepicker._getFormatConfig(inst);
if(target.val())
{
//alert($.datepicker.parseDate(dateFormat, new Date(target.val()), settings));
$.datepicker._selectDate("#" + target.attr("id"), $.datepicker._formatDate(inst, new Date(target.val())));
}
return target;
};
$.fn.createDropDownMenu = function (options) {
var a, closetimerHandle = 0, settings = jQuery.extend({
timeout: 100,
item: "li",
query: "> li > a",
subQuery: "ul",
hoverClass: "hoverClass"
}, options),
closeMethod = function () { // close
$(a).removeClass(settings.hoverClass).parent(settings.item).find(settings.subQuery)
.css("visibility", "hidden");
},
closetimer = function () { // go close timer
cancelclosetimer();
closetimerHandle = window.setTimeout(closeMethod, settings.timeout);
},
cancelclosetimer = function () { // cancel close timer
if (closetimerHandle) {
window.clearTimeout(closetimerHandle);
closetimerHandle = null;
}
},
aopen = function () {
cancelclosetimer();
closeMethod();
$(this).addClass(settings.hoverClass).parent(settings.item).find(settings.subQuery)
.mouseover(cancelclosetimer)
.mouseout(closetimer)
.css("visibility", "visible");
};
a = $(this).find(settings.query);
$(a).mouseover(aopen).mouseout(closetimer);
return this;
};
$.fn.ajaxQuery = function (url, callback, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
params, off = url.indexOf("?"), setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 12,
loadingImageHeight: 12
}, options);
if (off >= 0) {
params = url.slice(off + 1, url.length);
url = url.slice(0, off);
}
var type = "GET";
var self = this;
// Request the remote document
$.ajax({
url: url,
type: type,
dataType: "html",
data: params,
beforeSend: function () {
self.html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
alert(data.toLowerCase() == "true" ? "Амжилттай" : (data.toLowerCase() == "false" ? "Амжилтгүй !!!" : data));
}
});
return this;
};
$.fn.ajaxGet = function (url, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
params, off = url.indexOf("?"), setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 36,
loadingImageHeight: 36
}, options);
if (off >= 0) {
params = url.slice(off + 1, url.length);
url = url.slice(0, off);
}
var self = this;
// Request the remote document
$.ajax({
url: url,
type: "GET",
dataType: "html",
data: params,
beforeSend: function () {
self.html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
self.html(data);
}
});
return this;
};
$.fn.ajaxPost = function (formIndex, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 36,
loadingImageHeight: 36
}, options);
var self = this;
var form = $($(self).find("form").get(formIndex));
// Request the remote document
$.ajax({
url: $(form).attr("action"),
type: "POST",
dataType: "html",
data: $(form).serialize(),
beforeSend: function () {
$(self).html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
self.html(data);
// responseText = jqXHR.responseText;
// if (jqXHR.isResolved()) {
// jqXHR.done(function (r) {
// responseText = r;
// });
// self.html(responseText);
// }
// if (callback) {
// self.each(callback, [responseText, status, jqXHR]);
// }
}
});
return this;
};
})( jQuery );
interface0: {
data: new Array(),
getString: function () { return JSON.stringify(this); },
extend: function (args) {
var obj = (typeof args == 'string') ? eval('(' + args + ')') : args;
$.extend(this, obj, true);
return this;
},
parse: function (args) {
var i = args.toString().indexOf('{');
if (i == -1) i = args.toString().indexOf('}');
if (i == -1) { return { data: args.toString() }; }
return (typeof args == 'string') ? eval('(' + args + ')') : args;
}
},
create: function () {
var o = {};
if (arguments.length == 1) {
try {
//Long l = Long.parseLong(arguments[0]);
o = $.extend({}, { id: arguments[0] }, true);
} catch (ex) {
o = $.extend({}, { id: 0 }, true);
var obj = (typeof arguments[0] == 'string') ? eval('(' + arguments[0] + ')') : arguments[0];
o = $.extend({}, obj, true);
}
} else if (arguments.length == 2) {
var obj = (typeof arguments[1] == 'string') ? eval('(' + arguments[1] + ')') : arguments[1];
o = $.extend({}, obj, true);
o = $.extend(o, { id: arguments[0] }, true);
} else
o = $.extend({}, { id: 0 }, true);
o = $.extend(o, this.interface0, true);
o.data = new Array();
//usage::
//var n = new MyEntity(10);
//n.hi = "hi boroo";
//n.extend({name:"boroo"});
//var obj = new MyEntity(20, n.getString());
//var n = new MyEntity(10, "{name:'baatar'}");
//n.data["a"]="b";
//alert( n.data["a"] );
return o;
}
//var a = _objects.create(22);
//var b = _objects.create(33);
//b.hi = "welcome, boroo";
//b.id="1";
//a.extend(b.getString());
//alert(a.data.length);
};
(function ($) {
$._Calendar = new Date();
$.extend($._Calendar, {
month: function() { return $._Calendar.getMonth() + 1; },
months: function() { return ("" + ($._Calendar.getMonth() + 1)).length == 1 ? "0" + ($._Calendar.getMonth() + 1) : "" + ($._Calendar.getMonth() + 1); },
year: function() { return $._Calendar.getFullYear(); },
dow: function() { return $._Calendar.getDay(); },
dom: function() { return $._Calendar.getDate() },
doms: function() { return ("" + $._Calendar.getDate()).length == 1 ? "0" + $._Calendar.getDate() : "" + $._Calendar.getDate(); }
}, true);
$.extend($._Calendar, {
dateValue: function () { return $._Calendar.year() + "." + $._Calendar.months() + "." + $._Calendar.doms(); },
nowString: function () {
var d = new Date();
return d.toGMTString();
},
dateString: function () {
var d = new Date();
return d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();
},
timeString: function () {
var d = new Date();
return d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
}
}, true);
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
//(elem.textContent || elem.innerText || '')
var val = $(elem).html().toLowerCase();
var str = (match[3] || "").toLowerCase();
return (val.indexOf(str) >= 0);
}
});
$.centerPopup = function() {
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#popupContent").height();
var popupWidth = $("#popupContent").width();
//centering
$("#popupContent").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6
$("#backgroundPopup").css({
"height": windowHeight
});
};
$.filterTable = function(text, dataTableSelector, targetTableSelector) {
if (typeof $(dataTableSelector).data("Table-Tr-Data") == 'undefined' || $(dataTableSelector).data("Table-Tr-Data") == null) {
$(dataTableSelector).data("Table-Tr-Data", $(dataTableSelector).find("> tbody > tr"));
}
var plus = (text.indexOf('+') > -1);
var trs = $(dataTableSelector).data("Table-Tr-Data");
var target = $(targetTableSelector).find(">tbody");
$(target).children().remove();
if (plus) {
var txts = text.split('+');
for (var i = 0; i < txts.length; i++) {
var txt = txts[i];
trs = $(trs).filter(":containsi('" + txt + "')");
}
$(target).append(trs);
} else {
var txts = text.split(' ');
for (var i = 0; i < txts.length; i++) {
var txt = txts[i];
var trs0 = $(trs).filter(":containsi('" + txt + "')");
$(target).append(trs0);
}
}
return trs;
};
$.fn.makeDatePicker = function (method, format) {
var calendarButtonGif = "/Scripts/jquery/images/calendar.gif";
var target = $(this).datepicker({
showOn: "both",
buttonImage: calendarButtonGif,
buttonImageOnly: true,
showOtherMonths: true,
selectOtherMonths: true,
changeMonth: true,
changeYear: true,
onSelect: method,
dateFormat: ((format == null || !format || typeof format == 'undefined') ? $.datepicker.ATOM : format),
yearRange: 'c-100:c+20'
//constrainInput: false
}).change(method);
var inst = $.datepicker._getInst(target[0]);
var dateFormat = $.datepicker._get(inst, 'dateFormat');
var settings = $.datepicker._getFormatConfig(inst);
if(target.val())
{
//alert($.datepicker.parseDate(dateFormat, new Date(target.val()), settings));
$.datepicker._selectDate("#" + target.attr("id"), $.datepicker._formatDate(inst, new Date(target.val())));
}
return target;
};
$.fn.createDropDownMenu = function (options) {
var a, closetimerHandle = 0, settings = jQuery.extend({
timeout: 100,
item: "li",
query: "> li > a",
subQuery: "ul",
hoverClass: "hoverClass"
}, options),
closeMethod = function () { // close
$(a).removeClass(settings.hoverClass).parent(settings.item).find(settings.subQuery)
.css("visibility", "hidden");
},
closetimer = function () { // go close timer
cancelclosetimer();
closetimerHandle = window.setTimeout(closeMethod, settings.timeout);
},
cancelclosetimer = function () { // cancel close timer
if (closetimerHandle) {
window.clearTimeout(closetimerHandle);
closetimerHandle = null;
}
},
aopen = function () {
cancelclosetimer();
closeMethod();
$(this).addClass(settings.hoverClass).parent(settings.item).find(settings.subQuery)
.mouseover(cancelclosetimer)
.mouseout(closetimer)
.css("visibility", "visible");
};
a = $(this).find(settings.query);
$(a).mouseover(aopen).mouseout(closetimer);
return this;
};
$.fn.ajaxQuery = function (url, callback, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
params, off = url.indexOf("?"), setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 12,
loadingImageHeight: 12
}, options);
if (off >= 0) {
params = url.slice(off + 1, url.length);
url = url.slice(0, off);
}
var type = "GET";
var self = this;
// Request the remote document
$.ajax({
url: url,
type: type,
dataType: "html",
data: params,
beforeSend: function () {
self.html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
alert(data.toLowerCase() == "true" ? "Амжилттай" : (data.toLowerCase() == "false" ? "Амжилтгүй !!!" : data));
}
});
return this;
};
$.fn.ajaxGet = function (url, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
params, off = url.indexOf("?"), setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 36,
loadingImageHeight: 36
}, options);
if (off >= 0) {
params = url.slice(off + 1, url.length);
url = url.slice(0, off);
}
var self = this;
// Request the remote document
$.ajax({
url: url,
type: "GET",
dataType: "html",
data: params,
beforeSend: function () {
self.html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
self.html(data);
}
});
return this;
};
$.fn.ajaxPost = function (formIndex, options) {
var loadingImageGif = "/Content/admin/images/loading.gif",
setting = $.extend({
loadingImage: loadingImageGif,
loadingImageWidth: 36,
loadingImageHeight: 36
}, options);
var self = this;
var form = $($(self).find("form").get(formIndex));
// Request the remote document
$.ajax({
url: $(form).attr("action"),
type: "POST",
dataType: "html",
data: $(form).serialize(),
beforeSend: function () {
$(self).html($("<img width='" + setting.loadingImageWidth + "' height='" + setting.loadingImageHeight + "'>")
.attr("src", setting.loadingImage)
.css("border", "none"));
},
success: function (data) {
self.html(data);
// responseText = jqXHR.responseText;
// if (jqXHR.isResolved()) {
// jqXHR.done(function (r) {
// responseText = r;
// });
// self.html(responseText);
// }
// if (callback) {
// self.each(callback, [responseText, status, jqXHR]);
// }
}
});
return this;
};
})( jQuery );
Subscribe to:
Posts (Atom)