Page MenuHomeIn-Portal Phabricator

jquery.scripts.js
No OneTemporary

File Metadata

Created
Fri, Jun 13, 2:58 PM

jquery.scripts.js

function jq($selector) {
return $selector.replace(/(\[|\]|\.)/g, '\\$1');
}
function DBlocks() {
var $me = this;
this.selectors = ['#lang', '#currency', '#login', '#login-alt', '#profile'];
$(document).ready(
function () {
$me.init();
}
);
}
DBlocks.prototype.init = function () {
var $manager = this;
$( this.selectors.join(', ') ).click(
function($e, $now) {
var $me = $(this),
$parent = $me.parent();
if ( $parent.is('.plashka-sel') ) {
$parent.removeClass('plashka-sel');
if ( $now === undefined || $now === false ) {
$('#' + $me.attr('id') + '-sel').fadeOut();
}
else {
$('#' + $me.attr('id') + '-sel').hide();
}
}
else {
$manager.hideOthers($me);
$parent.addClass('plashka-sel');
$('#' + $me.attr('id') + '-sel').fadeIn();
}
return false;
}
);
$('.icon-close').click(
function() {
$('#login,#login-alt').parent().removeClass('plashka-sel');
$('#login-sel, #login-alt-sel').fadeOut();
return false;
}
);
}
DBlocks.prototype.hideOthers = function ($current) {
$( this.selectors.join(', ') ).not($current).each(
function () {
var $me = $(this),
$parent = $me.parent();
if ( $parent.is('.plashka-sel') ) {
$me.trigger('click', [true]);
}
}
);
}
function RatingManager ($url) {
this.Url = $url;
}
RatingManager.prototype.makeVote = function ($vote, $prefix, $id, $size) {
var $url = this.Url.replace('#PREFIX#', $prefix).replace('#VOTE#', $vote).replace('#ID#', $id).replace('#SIZE#', $size);
$.get(
$url,
function ($response) {
if ($response.substring(0, 5) == '@err:') {
alert( $response.substring(5) );
return ;
}
document.getElementById('page_rating_' + $id).innerHTML = $response;
}
)
}
$(document).ready(function()
{
$('#change-password').click(
function($e) {
$('#password-show').hide();
$('#password-block').fadeIn();
return false;
}
);
});
new DBlocks();

Event Timeline