1/** 2 * jQuery toogleUpDown Plugin 1.0.1 3 * 4 * http://ÑиÑÑов-алекÑей.ÑÑ 5 * 6 * 7 * Copyright (c) 2011 ФиÑÑов ÐлекÑей 8 * 9 * ÐÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ñ Ð¦eb-ÐлÑÑеÑнаÑива: 10 * http://web-alt.tu/ 11 */ 12(function($){var b='';$.fn.toogleUpDown=function(a){a=$.extend({Defclass:'slid_index',class_name:'toogleUpDown',class_pref_up:'_up',speed:300,method:'slide'},a);function slide_uper(){$("."+a.Defclass+":not(."+a.class_name+a.class_pref_up+")").slideUp(a.speed);$("."+a.class_name+a.class_pref_up).slideToggle(a.speed)}function defalt_slide_uper(){$("."+a.Defclass+":not(."+a.class_name+a.class_pref_up+")").hide(a.speed);$("."+a.class_name+a.class_pref_up).toggle(a.speed)}function ClassMyToggl(){if($("."+a.Defclass).hasClass(a.class_name+a.class_pref_up))$("."+a.Defclass).removeClass(a.class_name+a.class_pref_up);b.addClass(a.class_name+a.class_pref_up)}function _init(j){b=j;ClassMyToggl();if(a.method=='slide')slide_uper();else if(a.method=='defalt')defalt_slide_uper()}return _init($(this))}})(jQuery); 13 14 15/** 16 * jQuery Validation Plugin 1.8.1 17 * 18 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ 19 * http://docs.jquery.com/Plugins/Validation 20 * 21 * Copyright (c) 2006 - 2011 Jörn Zaefferer 22 * 23 * Dual licensed under the MIT and GPL licenses: 24 * http://www.opensource.org/licenses/mit-license.php 25 * http://www.gnu.org/licenses/gpl.html 26 */ 27 28(function($) { 29 30$.extend($.fn, { 31 // http://docs.jquery.com/Plugins/Validation/validate 32 validate: function( options ) { 33 34 // if nothing is selected, return nothing; can't chain anyway 35 if (!this.length) { 36 options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); 37 return; 38 } 39 40 // check if a validator for this form was already created 41 var validator = $.data(this[0], 'validator'); 42 if ( validator ) { 43 return validator; 44 } 45 46 validator = new $.validator( options, this[0] ); 47 $.data(this[0], 'validator', validator); 48 49 if ( validator.settings.onsubmit ) { 50 51 // allow suppresing validation by adding a cancel class to the submit button 52 this.find("input, button").filter(".cancel").click(function() { 53 validator.cancelSubmit = true; 54 }); 55 56 // when a submitHandler is used, capture the submitting button 57 if (validator.settings.submitHandler) { 58 this.find("input, button").filter(":submit").click(function() { 59 validator.submitButton = this; 60 }); 61 } 62 63 // validate the form on submit 64 this.submit( function( event ) { 65 if ( validator.settings.debug ) 66 // prevent form submit to be able to see console output 67 event.preventDefault(); 68 69 function handle() { 70 if ( validator.settings.submitHandler ) { 71 if (validator.submitButton) { 72 // insert a hidden input as a replacement for the missing submit button 73 var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); 74 } 75 validator.settings.submitHandler.call( validator, validator.currentForm ); 76 if (validator.submitButton) { 77 // and clean up afterwards; thanks to no-block-scope, hidden can be referenced 78 hidden.remove(); 79 } 80 return false; 81 } 82 return true; 83 } 84 85 // prevent submit for invalid forms or custom submit handlers 86 if ( validator.cancelSubmit ) { 87 validator.cancelSubmit = false; 88 return handle(); 89 } 90 if ( validator.form() ) { 91 if ( validator.pendingRequest ) { 92 validator.formSubmitted = true; 93 return false; 94 } 95 return handle(); 96 } else { 97 validator.focusInvalid(); 98 return false; 99 } 100 }); 101 } 102 103 return validator; 104 }, 105 // http://docs.jquery.com/Plugins/Validation/valid 106 valid: function() { 107 if ( $(this[0]).is('form')) { 108 return this.validate().form(); 109 } else { 110 var valid = true; 111 var validator = $(this[0].form).validate(); 112 this.each(function() { 113 valid &= validator.element(this); 114 }); 115 return valid; 116 } 117 }, 118 // attributes: space seperated list of attributes to retrieve and remove 119 removeAttrs: function(attributes) { 120 var result = {}, 121 $element = this; 122 $.each(attributes.split(/\s/), function(index, value) { 123 result[value] = $element.attr(value); 124 $element.removeAttr(value); 125 }); 126 return result; 127 }, 128 // http://docs.jquery.com/Plugins/Validation/rules 129 rules: function(command, argument) { 130 var element = this[0]; 131 132 if (command) { 133 var settings = $.data(element.form, 'validator').settings; 134 var staticRules = settings.rules; 135 var existingRules = $.validator.staticRules(element); 136 switch(command) { 137 case "add": 138 $.extend(existingRules, $.validator.normalizeRule(argument)); 139 staticRules[element.name] = existingRules; 140 if (argument.messages) 141 settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); 142 break; 143 case "remove": 144 if (!argument) { 145 delete staticRules[element.name]; 146 return existingRules; 147 } 148 var filtered = {}; 149 $.each(argument.split(/\s/), function(index, method) { 150 filtered[method] = existingRules[method]; 151 delete existingRules[method]; 152 }); 153 return filtered; 154 } 155 } 156 157 var data = $.validator.normalizeRules( 158 $.extend( 159 {}, 160 $.validator.metadataRules(element), 161 $.validator.classRules(element), 162 $.validator.attributeRules(element), 163 $.validator.staticRules(element) 164 ), element); 165 166 // make sure required is at front 167 if (data.required) { 168 var param = data.required; 169 delete data.required; 170 data = $.extend({required: param}, data); 171 } 172 173 return data; 174 } 175}); 176 177// Custom selectors 178$.extend($.expr[":"], {
179 // http://docs.jquery.com/Plugins/Validation/blank 180 blank: function(a) {return !$.trim("" + a.value);}, 181 // http://docs.jquery.com/Plugins/Validation/filled 182 filled: function(a) {return !!$.trim("" + a.value);}, 183 // http://docs.jquery.com/Plugins/Validation/unchecked 184 unchecked: function(a) {return !a.checked;} 185}); 186 187// constructor for validator 188$.validator = function( options, form ) { 189 this.settings = $.extend( true, {}, $.validator.defaults, options ); 190 this.currentForm = form; 191 this.init(); 192}; 193 194$.validator.format = function(source, params) { 195 if ( arguments.length == 1 ) 196 return function() { 197 var args = $.makeArray(arguments); 198 args.unshift(source); 199 return $.validator.format.apply( this, args ); 200 }; 201 if ( arguments.length > 2 && params.constructor != Array ) { 202 params = $.makeArray(arguments).slice(1); 203 } 204 if ( params.constructor != Array ) { 205 params = [ params ]; 206 } 207 $.each(params, function(i, n) { 208 source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); 209 }); 210 return source; 211}; 212 213$.extend($.validator, { 214 215 defaults: { 216 messages: {}, 217 groups: {}, 218 rules: {}, 219 errorClass: "error_v", 220 validClass: "valid", 221 errorElement: "span", 222 focusInvalid: true, 223 errorContainer: $( [] ), 224 errorLabelContainer: $( [] ), 225 onsubmit: true, 226 ignore: [], 227 ignoreTitle: false, 228 onfocusin: function(element) { 229 this.lastActive = element; 230 231 // hide error label and remove error class on focus if enabled 232 if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { 233 this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); 234 this.addWrapper(this.errorsFor(element)).hide(); 235 } 236 }, 237 onfocusout: function(element) { 238 if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { 239 this.element(element); 240 } 241 }, 242 onkeyup: function(element) { 243 if ( element.name in this.submitted || element == this.lastElement ) { 244 this.element(element); 245 } 246 }, 247 onclick: function(element) { 248 // click on selects, radiobuttons and checkboxes 249 if ( element.name in this.submitted ) 250 this.element(element); 251 // or option elements, check parent select in that case 252 else if (element.parentNode.name in this.submitted) 253 this.element(element.parentNode); 254 }, 255 highlight: function(element, errorClass, validClass) { 256 if (element.type === 'radio') { 257 this.findByName(element.name).addClass(errorClass).removeClass(validClass); 258 } else { 259 $(element).addClass(errorClass).removeClass(validClass); 260 } 261 }, 262 unhighlight: function(element, errorClass, validClass) { 263 if (element.type === 'radio') { 264 this.findByName(element.name).removeClass(errorClass).addClass(validClass); 265 } else { 266 $(element).removeClass(errorClass).addClass(validClass); 267 } 268 } 269 }, 270 271 // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults 272 setDefaults: function(settings) { 273 $.extend( $.validator.defaults, settings ); 274 }, 275 276 messages: { 277 required: "ÐаполниÑе поле.", 278 remote: "ÐожалÑйÑÑа, иÑпÑавÑÑе ÑÑо поле.", 279 email: "ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ email.", 280 url: "ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ URL.", 281 date: "ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ date.", 282 dateISO: "ÐевеÑнÑй ÑоÑÐ¼Ð°Ñ (ISO).", 283 number: "Please enter a valid number.", 284 digits: "Please enter only digits.", 285 creditcard: "Please enter a valid credit card number.", 286 equalTo: "Please enter the same value again.", 287 accept: "Please enter a value with a valid extension.", 288 maxlength: $.validator.format("Please enter no more than {0} characters."), 289 minlength: $.validator.format("Please enter at least {0} characters."), 290 rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), 291 range: $.validator.format("Please enter a value between {0} and {1}."), 292 max: $.validator.format("Please enter a value less than or equal to {0}."), 293 min: $.validator.format("Please enter a value greater than or equal to {0}.") 294 }, 295 296 autoCreateRanges: false, 297 298 prototype: { 299 300 init: function() { 301 this.labelContainer = $(this.settings.errorLabelContainer); 302 this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); 303 this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); 304 this.submitted = {}; 305 this.valueCache = {}; 306 this.pendingRequest = 0; 307 this.pending = {}; 308 this.invalid = {}; 309 this.reset(); 310 311 var groups = (this.groups = {}); 312 $.each(this.settings.groups, function(key, value) { 313 $.each(value.split(/\s/), function(index, name) { 314 groups[name] = key; 315 }); 316 }); 317 var rules = this.settings.rules; 318 $.each(rules, function(key, value) { 319 rules[key] = $.validator.normalizeRule(value); 320 }); 321 322 function delegate(event) {
323 var validator = $.data(this[0].form, "validator"), 324 eventType = "on" + event.type.replace(/^validate/, ""); 325 validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] ); 326 } 327 $(this.currentForm) 328 .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate) 329 .validateDelegate(":radio, :checkbox, select, option", "click", delegate); 330 331 if (this.settings.invalidHandler) 332 $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); 333 }, 334 335 // http://docs.jquery.com/Plugins/Validation/Validator/form 336 form: function() { 337 this.checkForm(); 338 $.extend(this.submitted, this.errorMap); 339 this.invalid = $.extend({}, this.errorMap); 340 if (!this.valid()) 341 $(this.currentForm).triggerHandler("invalid-form", [this]); 342 this.showErrors(); 343 return this.valid(); 344 }, 345 346 checkForm: function() { 347 this.prepareForm(); 348 for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { 349 this.check( elements[i] ); 350 } 351 return this.valid(); 352 }, 353 354 // http://docs.jquery.com/Plugins/Validation/Validator/element 355 element: function( element ) { 356 element = this.clean( element ); 357 this.lastElement = element; 358 this.prepareElement( element ); 359 this.currentElements = $(element); 360 var result = this.check( element ); 361 if ( result ) { 362 delete this.invalid[element.name]; 363 } else { 364 this.invalid[element.name] = true; 365 } 366 if ( !this.numberOfInvalids() ) { 367 // Hide error containers on last error 368 this.toHide = this.toHide.add( this.containers ); 369 } 370 this.showErrors(); 371 return result; 372 }, 373 374 // http://docs.jquery.com/Plugins/Validation/Validator/showErrors 375 showErrors: function(errors) { 376 if(errors) { 377 // add items to error list and map 378 $.extend( this.errorMap, errors ); 379 this.errorList = []; 380 for ( var name in errors ) { 381 this.errorList.push({ 382 message: errors[name], 383 element: this.findByName(name)[0] 384 }); 385 } 386 // remove items from success list 387 this.successList = $.grep( this.successList, function(element) { 388 return !(element.name in errors); 389 }); 390 } 391 this.settings.showErrors 392 ? this.settings.showErrors.call( this, this.errorMap, this.errorList ) 393 : this.defaultShowErrors(); 394 }, 395 396 // http://docs.jquery.com/Plugins/Validation/Validator/resetForm 397 resetForm: function() { 398 if ( $.fn.resetForm ) 399 $( this.currentForm ).resetForm(); 400 this.submitted = {}; 401 this.prepareForm(); 402 this.hideErrors(); 403 this.elements().removeClass( this.settings.errorClass ); 404 }, 405 406 numberOfInvalids: function() { 407 return this.objectLength(this.invalid); 408 }, 409 410 objectLength: function( obj ) { 411 var count = 0; 412 for ( var i in obj ) 413 count++; 414 return count; 415 }, 416 417 hideErrors: function() { 418 this.addWrapper( this.toHide ).hide(); 419 }, 420 421 valid: function() { 422 return this.size() == 0; 423 }, 424 425 size: function() { 426 return this.errorList.length; 427 }, 428 429 focusInvalid: function() { 430 if( this.settings.focusInvalid ) { 431 try { 432 $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) 433 .filter(":visible") 434 .focus() 435 // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find 436 .trigger("focusin"); 437 } catch(e) { 438 // ignore IE throwing errors when focusing hidden elements 439 } 440 } 441 }, 442 443 findLastActive: function() { 444 var lastActive = this.lastActive; 445 return lastActive && $.grep(this.errorList, function(n) { 446 return n.element.name == lastActive.name; 447 }).length == 1 && lastActive; 448 }, 449 450 elements: function() { 451 var validator = this, 452 rulesCache = {}; 453 454 // select all valid inputs inside the form (no submit or reset buttons) 455 return $(this.currentForm) 456 .find("input, select, textarea") 457 .not(":submit, :reset, :image, [disabled]") 458 .not( this.settings.ignore ) 459 .filter(function() { 460 !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this); 461 462 // select only the first element for each name, and only those with rules specified 463 if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) 464 return false;
465 466 rulesCache[this.name] = true; 467 return true; 468 }); 469 }, 470 471 clean: function( selector ) { 472 return $( selector )[0]; 473 }, 474 475 errors: function() { 476 return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext ); 477 }, 478 479 reset: function() { 480 this.successList = []; 481 this.errorList = []; 482 this.errorMap = {}; 483 this.toShow = $([]); 484 this.toHide = $([]); 485 this.currentElements = $([]); 486 }, 487 488 prepareForm: function() { 489 this.reset(); 490 this.toHide = this.errors().add( this.containers ); 491 }, 492 493 prepareElement: function( element ) { 494 this.reset(); 495 this.toHide = this.errorsFor(element); 496 }, 497 498 check: function( element ) { 499 element = this.clean( element ); 500 501 // if radio/checkbox, validate first element in group instead 502 if (this.checkable(element)) { 503 element = this.findByName( element.name ).not(this.settings.ignore)[0]; 504 } 505 506 var rules = $(element).rules(); 507 var dependencyMismatch = false; 508 for (var method in rules ) { 509 var rule = { method: method, parameters: rules[method] }; 510 try { 511 var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters ); 512 513 // if a method indicates that the field is optional and therefore valid, 514 // don't mark it as valid when there are no other rules 515 if ( result == "dependency-mismatch" ) { 516 dependencyMismatch = true; 517 continue; 518 } 519 dependencyMismatch = false; 520 521 if ( result == "pending" ) { 522 this.toHide = this.toHide.not( this.errorsFor(element) ); 523 return; 524 } 525 526 if( !result ) { 527 this.formatAndAdd( element, rule ); 528 return false; 529 } 530 } catch(e) { 531 this.settings.debug && window.console && console.log("exception occured when checking element " + element.id 532 + ", check the '" + rule.method + "' method", e); 533 throw e; 534 } 535 } 536 if (dependencyMismatch) 537 return; 538 if ( this.objectLength(rules) ) 539 this.successList.push(element); 540 return true; 541 }, 542 543 // return the custom message for the given element and validation method 544 // specified in the element's "messages" metadata 545 customMetaMessage: function(element, method) { 546 if (!$.metadata) 547 return; 548 549 var meta = this.settings.meta 550 ? $(element).metadata()[this.settings.meta] 551 : $(element).metadata(); 552 553 return meta && meta.messages && meta.messages[method]; 554 }, 555 556 // return the custom message for the given element name and validation method 557 customMessage: function( name, method ) { 558 var m = this.settings.messages[name]; 559 return m && (m.constructor == String 560 ? m 561 : m[method]); 562 }, 563 564 // return the first defined argument, allowing empty strings 565 findDefined: function() { 566 for(var i = 0; i < arguments.length; i++) { 567 if (arguments[i] !== undefined) 568 return arguments[i]; 569 } 570 return undefined; 571 }, 572 573 defaultMessage: function( element, method) { 574 return this.findDefined( 575 this.customMessage( element.name, method ), 576 this.customMetaMessage( element, method ), 577 // title is never undefined, so handle empty string as undefined 578 !this.settings.ignoreTitle && element.title || undefined, 579 $.validator.messages[method], 580 "<strong>Warning: No message defined for " + element.name + "</strong>" 581 ); 582 }, 583 584 formatAndAdd: function( element, rule ) { 585 var message = this.defaultMessage( element, rule.method ), 586 theregex = /\$?\{(\d+)\}/g; 587 if ( typeof message == "function" ) { 588 message = message.call(this, rule.parameters, element); 589 } else if (theregex.test(message)) { 590 message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); 591 } 592 this.errorList.push({ 593 message: message, 594 element: element 595 }); 596 597 this.errorMap[element.name] = message; 598 this.submitted[element.name] = message; 599 }, 600 601 addWrapper: function(toToggle) { 602 if ( this.settings.wrapper ) 603 toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); 604 return toToggle; 605 }, 606 607 defaultShowErrors: function() { 608 for ( var i = 0; this.errorList[i]; i++ ) { 609 var error = this.errorList[i]; 610 this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.val
610idClass ); 611 this.showLabel( error.element, error.message ); 612 } 613 if( this.errorList.length ) { 614 this.toShow = this.toShow.add( this.containers ); 615 } 616 if (this.settings.success) { 617 for ( var i = 0; this.successList[i]; i++ ) { 618 this.showLabel( this.successList[i] ); 619 } 620 } 621 if (this.settings.unhighlight) { 622 for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) { 623 this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); 624 } 625 } 626 this.toHide = this.toHide.not( this.toShow ); 627 this.hideErrors(); 628 this.addWrapper( this.toShow ).show(); 629 }, 630 631 validElements: function() { 632 return this.currentElements.not(this.invalidElements()); 633 }, 634 635 invalidElements: function() { 636 return $(this.errorList).map(function() { 637 return this.element; 638 }); 639 }, 640 641 showLabel: function(element, message) { 642 var label = this.errorsFor( element ); 643 if ( label.length ) { 644 // refresh error/success class 645 label.removeClass().addClass( this.settings.errorClass ); 646 647 // check if we have a generated label, replace the message then 648 label.attr("generated") && label.html(message); 649 } else { 650 // create label 651 label = $("<" + this.settings.errorElement + "/>") 652 .attr({"for": this.idOrName(element), generated: true}) 653 .addClass(this.settings.errorClass) 654 .html(message || ""); 655 if ( this.settings.wrapper ) { 656 // make sure the element is visible, even in IE 657 // actually showing the wrapped element is handled elsewhere 658 label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); 659 } 660 if ( !this.labelContainer.append(label).length ) 661 this.settings.errorPlacement 662 ? this.settings.errorPlacement(label, $(element) ) 663 : label.insertAfter(element); 664 } 665 if ( !message && this.settings.success ) { 666 label.text(""); 667 typeof this.settings.success == "string" 668 ? label.addClass( this.settings.success ) 669 : this.settings.success( label ); 670 } 671 this.toShow = this.toShow.add(label); 672 }, 673 674 errorsFor: function(element) { 675 var name = this.idOrName(element); 676 return this.errors().filter(function() { 677 return $(this).attr('for') == name; 678 }); 679 }, 680 681 idOrName: function(element) { 682 return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); 683 }, 684 685 checkable: function( element ) { 686 return /radio|checkbox/i.test(element.type); 687 }, 688 689 findByName: function( name ) { 690 // select by name and filter by form for performance over form.find("[name=...]") 691 var form = this.currentForm; 692 return $(document.getElementsByName(name)).map(function(index, element) { 693 return element.form == form && element.name == name && element || null; 694 }); 695 }, 696 697 getLength: function(value, element) { 698 switch( element.nodeName.toLowerCase() ) { 699 case 'select': 700 return $("option:selected", element).length; 701 case 'input': 702 if( this.checkable( element) ) 703 return this.findByName(element.name).filter(':checked').length; 704 } 705 return value.length; 706 }, 707 708 depend: function(param, element) { 709 return this.dependTypes[typeof param] 710 ? this.dependTypes[typeof param](param, element) 711 : true; 712 }, 713 714 dependTypes: { 715 "boolean": function(param, element) { 716 return param; 717 }, 718 "string": function(param, element) { 719 return !!$(param, element.form).length; 720 }, 721 "function": function(param, element) { 722 return param(element); 723 } 724 }, 725 726 optional: function(element) { 727 return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch"; 728 }, 729 730 startRequest: function(element) { 731 if (!this.pending[element.name]) { 732 this.pendingRequest++; 733 this.pending[element.name] = true; 734 } 735 }, 736 737 stopRequest: function(element, valid) { 738 this.pendingRequest--; 739 // sometimes synchronization fails, make sure pendingRequest is never < 0 740 if (this.pendingRequest < 0) 741 this.pendingRequest = 0; 742 delete this.pending[element.name]; 743 if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) { 744 $(this.currentForm).submit(); 745 this.formSubmitted = false;
746 } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) { 747 $(this.currentForm).triggerHandler("invalid-form", [this]); 748 this.formSubmitted = false; 749 } 750 }, 751 752 previousValue: function(element) { 753 return $.data(element, "previousValue") || $.data(element, "previousValue", { 754 old: null, 755 valid: true, 756 message: this.defaultMessage( element, "remote" ) 757 }); 758 } 759 760 }, 761 762 classRuleSettings: { 763 required: {required: true}, 764 email: {email: true}, 765 url: {url: true}, 766 date: {date: true}, 767 dateISO: {dateISO: true}, 768 dateDE: {dateDE: true}, 769 number: {number: true}, 770 numberDE: {numberDE: true}, 771 digits: {digits: true}, 772 creditcard: {creditcard: true} 773 }, 774 775 addClassRules: function(className, rules) { 776 className.constructor == String ? 777 this.classRuleSettings[className] = rules : 778 $.extend(this.classRuleSettings, className); 779 }, 780 781 classRules: function(element) { 782 var rules = {}; 783 var classes = $(element).attr('class'); 784 classes && $.each(classes.split(' '), function() { 785 if (this in $.validator.classRuleSettings) { 786 $.extend(rules, $.validator.classRuleSettings[this]); 787 } 788 }); 789 return rules; 790 }, 791 792 attributeRules: function(element) { 793 var rules = {}; 794 var $element = $(element); 795 796 for (var method in $.validator.methods) { 797 var value = $element.attr(method); 798 if (value) { 799 rules[method] = value; 800 } 801 } 802 803 // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs 804 if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { 805 delete rules.maxlength; 806 } 807 808 return rules; 809 }, 810 811 metadataRules: function(element) { 812 if (!$.metadata) return {}; 813 814 var meta = $.data(element.form, 'validator').settings.meta; 815 return meta ? 816 $(element).metadata()[meta] : 817 $(element).metadata(); 818 }, 819 820 staticRules: function(element) { 821 var rules = {}; 822 var validator = $.data(element.form, 'validator'); 823 if (validator.settings.rules) { 824 rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; 825 } 826 return rules; 827 }, 828 829 normalizeRules: function(rules, element) { 830 // handle dependency check 831 $.each(rules, function(prop, val) { 832 // ignore rule when param is explicitly false, eg. required:false 833 if (val === false) { 834 delete rules[prop]; 835 return; 836 } 837 if (val.param || val.depends) { 838 var keepRule = true; 839 switch (typeof val.depends) { 840 case "string": 841 keepRule = !!$(val.depends, element.form).length; 842 break; 843 case "function": 844 keepRule = val.depends.call(element, element); 845 break; 846 } 847 if (keepRule) { 848 rules[prop] = val.param !== undefined ? val.param : true; 849 } else { 850 delete rules[prop]; 851 } 852 } 853 }); 854 855 // evaluate parameters 856 $.each(rules, function(rule, parameter) { 857 rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; 858 }); 859 860 // clean number parameters 861 $.each(['minlength', 'maxlength', 'min', 'max'], function() { 862 if (rules[this]) { 863 rules[this] = Number(rules[this]); 864 } 865 }); 866 $.each(['rangelength', 'range'], function() { 867 if (rules[this]) { 868 rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; 869 } 870 }); 871 872 if ($.validator.autoCreateRanges) { 873 // auto-create ranges 874 if (rules.min && rules.max) { 875 rules.range = [rules.min, rules.max]; 876 delete rules.min; 877 delete rules.max; 878 } 879 if (rules.minlength && rules.maxlength) { 880 rules.rangelength = [rules.minlength, rules.maxlength]; 881 delete rules.minlength; 882 delete rules.maxlength; 883 } 884 } 885 886 // To support custom messages in metadata ignore rule methods titled "messages" 887 if (rules.messages) { 888 delete rules.messages; 889 } 890 891 return rules; 892 }, 893 894 // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} 895 normalizeRule: function(data) { 896 if( typeof data == "string" ) { 897 var transformed = {}; 898 $.each(data.split(/\s/), function() { 899 transformed[this] = true; 900 }); 901 data = transformed; 902 } 903 return data; 904 }, 905 906 // http://docs.jquery.com/Plugins/Validation/Validator/addMethod 907 addMethod: function(name, method, message) { 908 $.validator.methods[name] = method; 909 $.validator.messages[name] = message != undefined ? message : $.validator.messages[name]; 910 if (method.length < 3) { 911 $.validator.addClassRules(name, $.validator.normalizeRule(name)); 912 } 913 }, 914 915 methods: { 916 917 // http://docs.jquery.com/Plugins/Validation/Methods/required 918 required: function(value, element, param) { 919 // check if dependency is met 920 if ( !this.depend(param, element) ) 921 return "dependency-mismatch"; 922 switch( element.nodeName.toLowerCase() ) { 923 case 'select': 924 // could be an array for select-multiple or a string, both are fine this way 925 var val = $(element).val(); 926 return val && val.length > 0; 927 case 'input': 928 if ( this.checkable(element) ) 929 return this.getLength(value, element) > 0; 930 default: 931 return $.trim(value).length > 0; 932 } 933 }, 934 935 // http://docs.jquery.com/Plugins/Validation/Methods/remote 936 remote: function(value, element, param) { 937 if ( this.optional(element) ) 938 return "dependency-mismatch"; 939 940 var previous = this.previousValue(element); 941 if (!this.settings.messages[element.name] ) 942 this.settings.messages[element.name] = {}; 943 previous.originalMessage = this.settings.messages[element.name].remote; 944 this.settings.messages[element.name].remote = previous.message; 945 946 param = typeof param == "string" && {url:param} || param; 947 948 if ( this.pending[element.name] ) { 949 return "pending"; 950 } 951 if ( previous.old === value ) { 952 return previous.valid; 953 } 954 955 previous.old = value;
956 var validator = this; 957 this.startRequest(element); 958 var data = {}; 959 data[element.name] = value; 960 $.ajax($.extend(true, { 961 url: param, 962 mode: "abort", 963 port: "validate" + element.name, 964 dataType: "json", 965 data: data, 966 success: function(response) { 967 validator.settings.messages[element.name].remote = previous.originalMessage; 968 var valid = response === true; 969 if ( valid ) { 970 var submitted = validator.formSubmitted; 971 validator.prepareElement(element); 972 validator.formSubmitted = submitted; 973 validator.successList.push(element); 974 validator.showErrors(); 975 } else { 976 var errors = {}; 977 var message = response || validator.defaultMessage( element, "remote" ); 978 errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; 979 validator.showErrors(errors); 980 } 981 previous.valid = valid; 982 validator.stopRequest(element, valid); 983 } 984 }, param)); 985 return "pending"; 986 }, 987 988 // http://docs.jquery.com/Plugins/Validation/Methods/minlength 989 minlength: function(value, element, param) { 990 return this.optional(element) || this.getLength($.trim(value), element) >= param; 991 }, 992 993 // http://docs.jquery.com/Plugins/Validation/Methods/maxlength 994 maxlength: function(value, element, param) { 995 return this.optional(element) || this.getLength($.trim(value), element) <= param; 996 }, 997 998 // http://docs.jquery.com/Plugins/Validation/Methods/rangelength 999 rangelength: function(value, element, param) { 1000 var length = this.getLength($.trim(value), element); 1001 return this.optional(element) || ( length >= param[0] && length <= param[1] ); 1002 }, 1003 1004 // http://docs.jquery.com/Plugins/Validation/Methods/min 1005 min: function( value, element, param ) { 1006 return this.optional(element) || value >= param; 1007 }, 1008 1009 // http://docs.jquery.com/Plugins/Validation/Methods/max 1010 max: function( value, element, param ) { 1011 return this.optional(element) || value <= param; 1012 }, 1013 1014 // http://docs.jquery.com/Plugins/Validation/Methods/range 1015 range: function( value, element, param ) { 1016 return this.optional(element) || ( value >= param[0] && value <= param[1] ); 1017 }, 1018 1019 // http://docs.jquery.com/Plugins/Validation/Methods/email 1020 email: function(value, element) { 1021 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ 1022 return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); 1023 }, 1024 1025 // http://docs.jquery.com/Plugins/Validation/Methods/url 1026 url: function(value, element) { 1027 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ 1028 return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); 1029 }, 1030 1031 // http://docs.jquery.com/Plugins/Validation/Methods/date 1032 date: function(value, element) { 1033 return this.optional(element) || !/Invalid|NaN/.test(new Date(value)); 1034 }, 1035 1036 // http://docs.jquery.com/Plugins/Validation/Methods/dateISO 1037 dateISO: function(value, element) { 1038 return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); 1039 }, 1040 1041 // http://docs.jquery.com/Plugins/Validation/Methods/number 1042 number: function(value, element) { 1043 return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); 1044 }, 1045 1046 // http://docs.jquery.com/Plugins/Validation/Methods/digits 1047 digits: function(value, element) { 1048 return this.optional(element) || /^\d+$/.test(value); 1049 }, 1050 1051 // http://docs.jquery.com/Plugins/Validation/Methods/creditcard 1052 // based on http://en.wikipedia.org/wiki/Luhn 1053 creditcard: function(value, element) { 1054 if ( this.optional(element) ) 1055 return "dependency-mismatch"; 1056 // accept only digits and dashes 1057 if (/[^0-9-]+/.test(value)) 1058 return false;
1059 var nCheck = 0, 1060 nDigit = 0, 1061 bEven = false; 1062 1063 value = value.replace(/\D/g, ""); 1064 1065 for (var n = value.length - 1; n >= 0; n--) { 1066 var cDigit = value.charAt(n); 1067 var nDigit = parseInt(cDigit, 10); 1068 if (bEven) { 1069 if ((nDigit *= 2) > 9) 1070 nDigit -= 9; 1071 } 1072 nCheck += nDigit; 1073 bEven = !bEven; 1074 } 1075 1076 return (nCheck % 10) == 0; 1077 }, 1078 1079 // http://docs.jquery.com/Plugins/Validation/Methods/accept 1080 accept: function(value, element, param) { 1081 param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif"; 1082 return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); 1083 }, 1084 1085 // http://docs.jquery.com/Plugins/Validation/Methods/equalTo 1086 equalTo: function(value, element, param) { 1087 // bind to the blur event of the target in order to revalidate whenever the target field is updated 1088 // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead 1089 var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { 1090 $(element).valid(); 1091 }); 1092 return value == target.val(); 1093 } 1094 1095 } 1096 1097}); 1098 1099// deprecated, use $.validator.format instead 1100$.format = $.validator.format; 1101 1102})(jQuery); 1103 1104// ajax mode: abort 1105// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); 1106// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 1107;(function($) { 1108 var pendingRequests = {}; 1109 // Use a prefilter if available (1.5+) 1110 if ( $.ajaxPrefilter ) { 1111 $.ajaxPrefilter(function(settings, _, xhr) { 1112 var port = settings.port; 1113 if (settings.mode == "abort") { 1114 if ( pendingRequests[port] ) { 1115 pendingRequests[port].abort(); 1116 } 1117 pendingRequests[port] = xhr; 1118 } 1119 }); 1120 } else { 1121 // Proxy ajax 1122 var ajax = $.ajax; 1123 $.ajax = function(settings) { 1124 var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, 1125 port = ( "port" in settings ? settings : $.ajaxSettings ).port; 1126 if (mode == "abort") { 1127 if ( pendingRequests[port] ) { 1128 pendingRequests[port].abort(); 1129 } 1130 return (pendingRequests[port] = ajax.apply(this, arguments)); 1131 } 1132 return ajax.apply(this, arguments); 1133 }; 1134 } 1135})(jQuery); 1136 1137// provides cross-browser focusin and focusout events 1138// IE has native support, in other browsers, use event caputuring (neither bubbles) 1139 1140// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation 1141// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 1142;(function($) { 1143 // only implement if not provided by jQuery core (since 1.4) 1144 // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs 1145 if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { 1146 $.each({ 1147 focus: 'focusin', 1148 blur: 'focusout' 1149 }, function( original, fix ){ 1150 $.event.special[fix] = { 1151 setup:function() { 1152 this.addEventListener( original, handler, true ); 1153 }, 1154 teardown:function() { 1155 this.removeEventListener( original, handler, true ); 1156 }, 1157 handler: function(e) { 1158 arguments[0] = $.event.fix(e); 1159 arguments[0].type = fix; 1160 return $.event.handle.apply(this, arguments); 1161 } 1162 }; 1163 function handler(e) { 1164 e = $.event.fix(e); 1165 e.type = fix; 1166 return $.event.handle.call(this, e); 1167 } 1168 }); 1169 }; 1170 $.extend($.fn, { 1171 validateDelegate: function(delegate, type, handler) { 1172 return this.bind(type, function(event) { 1173 var target = $(event.target); 1174 if (target.is(delegate)) { 1175 return handler.apply(target, arguments); 1176 } 1177 }); 1178 } 1179 }); 1180})(jQuery); 1181 1182 1183 1184 1185// СобÑÑие - нажаÑие клавиÑи. 1186document.onkeydown = DoKeyDown; 1187 1188// ÐолÑзоваÑелÑÑкий обÑабоÑÑик ÑобÑÑÐ¸Ñ Ð½Ð°Ð¶Ð°ÑÐ¸Ñ ÐºÐ»Ð°Ð²Ð¸Ñ, 1189// Ð´Ð»Ñ Ð¾Ð±ÑабоÑки Ctrl + ÑÑÑелка. 1190function DoKeyDown(event) 1191{ 1192 if (!document.getElementById) 1193 { 1194 return; 1195 } 1196 1197 if (window.event) 1198 { 1199 event = window.event; 1200 } 1201 1202 if (event.ctrlKey) 1203 { 1204 var Element = null; 1205 1206 switch (event.keyCode ? event.keyCode : event.which ? event.which : null) 1207 { 1208 case 0x25: // Ðазад 1209 Element = document.getElementById ('id_prev'); 1210 break; 1211 1212 case 0x27: // ÐпеÑед 1213 Element = document.getElementById ('id_next'); 1214 break; 1215 } 1216 1217 if (Element && Element.href) 1218 { 1219 // РедиÑÐµÐºÑ Ð½Ð° нÑжнÑÑ ÑÑÑаниÑÑ. 1220 document.location = Element.href; 1221 } 1222 } 1223} 1224 1225/** 1226 * jQuery lightBox plugin 1227 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) 1228 * and adapted to me for use like a plugin from jQuery. 1229 * @name jquery-lightbox-0.5.js 1230 * @author Leandro Vieira Pinho - http://leandrovieira.com 1231 * @version 0.5 1232 * @date April 11, 2008 1233 * @category jQuery plugin 1234 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) 1235 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US 1236 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin 1237 */ 1238 1239// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias 1240(function($) { 1241 /** 1242 * $ is an alias to jQuery object 1243 * 1244 */ 1245 $.fn.lightBox = function(settings) { 1246 // Settings to configure the jQuery lightBox plugin how you like 1247 settings = jQuery.extend({ 1248 // Configuration related to overlay
1249 overlayBgColor: '#000', // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color. 1250 overlayOpacity: 0.8, // (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9 1251 // Configuration related to navigation 1252 fixedNavigation: false, // (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface. 1253 // Configuration related to images 1254 imageLoading: '/hostcmsfiles/jquery/lightbox/images/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon 1255 imageBtnPrev: '/hostcmsfiles/jquery/lightbox/images/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image 1256 imageBtnNext: '/hostcmsfiles/jquery/lightbox/images/lightbox-btn-next.gif', // (string) Path and the name of the next button image 1257 imageBtnClose: '/hostcmsfiles/jquery/lightbox/images/lightbox-btn-close.gif', // (string) Path and the name of the close btn 1258 imageBlank: '/hostcmsfiles/jquery/lightbox/images/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel) 1259 // Configuration related to container image box 1260 containerBorderSize: 10, // (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value 1261 containerResizeSpeed: 400, // (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default. 1262 // Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts. 1263 txtImage: 'ÐзобÑажение', // (string) Specify text "Image" 1264 txtOf: 'из', // (string) Specify text "of" 1265 // Configuration related to keyboard navigation 1266 keyToClose: 'c', // (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to. 1267 keyToPrev: 'p', // (string) (p = previous) Letter to show the previous image 1268 keyToNext: 'n', // (string) (n = next) Letter to show the next image. 1269 // DonÒt alter these variables in any way 1270 imageArray: [], 1271 activeImage: 0 1272 },settings); 1273 // Caching the jQuery object with all elements matched 1274 var jQueryMatchedObj = this; // This, in this context, refer to jQuery object 1275 /** 1276 * Initializing the plugin calling the start function 1277 * 1278 * @return boolean false 1279 */ 1280 function _initialize() { 1281 _start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked 1282 return false; // Avoid the browser following the link 1283 } 1284 /** 1285 * Start the jQuery lightBox plugin 1286 * 1287 * @param object objClicked The object (link) whick the user have clicked 1288 * @param object jQueryMatchedObj The jQuery object with all elements matched 1289 */ 1290 function _start(objClicked,jQueryMatchedObj) { 1291 // Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay. 1292 $('embed, object, select').css({ 'visibility' : 'hidden' }); 1293 // Call the function to create the markup structure; style some elements; assign events in some elements. 1294 _set_interface(); 1295 // Unset total images in imageArray 1296 settings.imageArray.length = 0; 1297 // Unset image active information 1298 settings.activeImage = 0; 1299 // We have an image set? Or just an image? LetÒs see it. 1300 if ( jQueryMatchedObj.length == 1 ) { 1301 settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title'))); 1302 } else { 1303 // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references 1304 for ( var i = 0; i < jQueryMatchedObj.length; i++ ) { 1305 settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'))); 1306 } 1307 } 1308 while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) { 1309 settings.activeImage++; 1310 } 1311 // Call the function that prepares image exibition 1312 _set_image_to_view(); 1313 } 1314 /** 1315 * Create the jQuery lightBox plugin interface 1316 * 1317 * The HTML markup will be like that: 1318 <div id="jquery-overlay"></div> 1319 <div id="jquery-lightbox"> 1320 <div id="lightbox-container-image-box"> 1321 <div id="lightbox-container-image"> 1322 <img src="../fotos/XX.jpg" id="lightbox-image"> 1323 <div id="lightbox-nav"> 1324 <a href="#" id="lightbox-nav-btnPrev"></a> 1325 <a href="#" id="lightbox-nav-btnNext"></a> 1326 </div> 1327 <div id="lightbox-loading"> 1328 <a href="#" id="lightbox-loading-link"> 1329 <img src="../images/lightbox-ico-loading.gif"> 1330 </a> 1331 </div> 1332 </div>
1333 </div> 1334 <div id="lightbox-container-image-data-box"> 1335 <div id="lightbox-container-image-data"> 1336 <div id="lightbox-image-details"> 1337 <span id="lightbox-image-details-caption"></span> 1338 <span id="lightbox-image-details-currentNumber"></span> 1339 </div> 1340 <div id="lightbox-secNav"> 1341 <a href="#" id="lightbox-secNav-btnClose"> 1342 <img src="../images/lightbox-btn-close.gif"> 1343 </a> 1344 </div> 1345 </div> 1346 </div> 1347 </div> 1348 * 1349 */ 1350 function _set_interface() { 1351 // Apply the HTML markup into body tag 1352 $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="" target="_blanck" id="light_img">СкаÑаÑÑ</a><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>'); 1353 // Get page sizes 1354 var arrPageSizes = ___getPageSize(); 1355 // Style overlay and show it 1356 $('#jquery-overlay').css({ 1357 backgroundColor: settings.overlayBgColor, 1358 opacity: settings.overlayOpacity, 1359 width: arrPageSizes[0], 1360 height: arrPageSizes[1] 1361 }).fadeIn(); 1362 // Get page scroll 1363 var arrPageScroll = ___getPageScroll(); 1364 // Calculate top and left offset for the jquery-lightbox div object and show it 1365 $('#jquery-lightbox').css({ 1366 top: arrPageScroll[1] + (arrPageSizes[3] / 10), 1367 left: arrPageScroll[0] 1368 }).show(); 1369 // Assigning click events in elements to close overlay 1370 $('#jquery-overlay,#jquery-lightbox').click(function() { 1371 _finish(); 1372 }); 1373 // Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects 1374 $('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() { 1375 _finish(); 1376 return false; 1377 }); 1378 // If window was resized, calculate the new overlay dimensions 1379 $(window).resize(function() { 1380 // Get page sizes 1381 var arrPageSizes = ___getPageSize(); 1382 // Style overlay and show it 1383 $('#jquery-overlay').css({ 1384 width: arrPageSizes[0], 1385 height: arrPageSizes[1] 1386 }); 1387 // Get page scroll 1388 var arrPageScroll = ___getPageScroll(); 1389 // Calculate top and left offset for the jquery-lightbox div object and show it 1390 $('#jquery-lightbox').css({ 1391 top: arrPageScroll[1] + (arrPageSizes[3] / 10), 1392 left: arrPageScroll[0] 1393 }); 1394 }); 1395 } 1396 /** 1397 * Prepares image exibition; doing a imageÒs preloader to calculate itÒs size 1398 * 1399 */ 1400 function _set_image_to_view() { // show the loading 1401 // Show the loading 1402 $('#lightbox-loading').show(); 1403 if ( settings.fixedNavigation ) { 1404 $('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); 1405 } else { 1406 // Hide some elements 1407 $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); 1408 } 1409 // Image preload process 1410 var objImagePreloader = new Image(); 1411 objImagePreloader.onload = function() { 1412 $('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]); 1413 $('#light_img').attr('href', settings.imageArray[settings.activeImage][0]); 1414 // Perfomance an effect in the image container resizing it 1415 _resize_container_image_box(objImagePreloader.width,objImagePreloader.height); 1416 // clear onLoad, IE behaves irratically with animated gifs otherwise 1417 objImagePreloader.onload=function(){}; 1418 }; 1419 objImagePreloader.src = settings.imageArray[settings.activeImage][0]; 1420 }; 1421 /** 1422 * Perfomance an effect in the image container resizing it 1423 * 1424 * @param integer intImageWidth The imageÒs width that will be showed 1425 * @param integer intImageHeight The imageÒs height that will be showed 1426 */ 1427 function _resize_container_image_box(intImageWidth,intImageHeight) { 1428 // Get current width and height 1429 var intCurrentWidth = $('#lightbox-container-image-box').width(); 1430 var intCurrentHeight = $('#lightbox-container-image-box').height(); 1431 // Get the width and height of the selected image plus the padding 1432 var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the imageÒs width and the left and right padding value 1433 var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the imageÒs height and the left and right padding value 1434 // Diferences 1435 var intDiffW = intCurrentWidth - intWidth; 1436 var intDiffH = intCurrentHeight - intHeight; 1437 // Perfomance the effect
1438 $('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); }); 1439 if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) { 1440 if ( $.browser.msie ) { 1441 ___pause(250); 1442 } else { 1443 ___pause(100); 1444 } 1445 } 1446 $('#lightbox-container-image-data-box').css({ width: intImageWidth }); 1447 $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) }); 1448 }; 1449 /** 1450 * Show the prepared image 1451 * 1452 */ 1453 function _show_image() { 1454 $('#lightbox-loading').hide(); 1455 $('#lightbox-image').fadeIn(function() { 1456 _show_image_data(); 1457 _set_navigation(); 1458 }); 1459 _preload_neighbor_images(); 1460 }; 1461 /** 1462 * Show the image information 1463 * 1464 */ 1465 function _show_image_data() { 1466 $('#lightbox-container-image-data-box').slideDown('fast'); 1467 $('#lightbox-image-details-caption').hide(); 1468 if ( settings.imageArray[settings.activeImage][1] ) { 1469 $('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show(); 1470 } 1471 // If we have a image set, display 'Image X of X' 1472 if ( settings.imageArray.length > 1 ) { 1473 $('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show(); 1474 } 1475 } 1476 /** 1477 * Display the button navigations 1478 * 1479 */ 1480 function _set_navigation() { 1481 $('#lightbox-nav').show(); 1482 1483 // Instead to define this configuration in CSS file, we define here. And itÒs need to IE. Just. 1484 $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); 1485 1486 // Show the prev button, if not the first image in set 1487 if ( settings.activeImage != 0 ) { 1488 if ( settings.fixedNavigation ) { 1489 $('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }) 1490 .unbind() 1491 .bind('click',function() { 1492 settings.activeImage = settings.activeImage - 1; 1493 _set_image_to_view(); 1494 return false; 1495 }); 1496 } else { 1497 // Show the images button for Next buttons 1498 $('#lightbox-nav-btnPrev').unbind().hover(function() { 1499 $(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }); 1500 },function() { 1501 $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); 1502 }).show().bind('click',function() { 1503 settings.activeImage = settings.activeImage - 1; 1504 _set_image_to_view(); 1505 return false; 1506 }); 1507 } 1508 } 1509 1510 // Show the next button, if not the last image in set 1511 if ( settings.activeImage != ( settings.imageArray.length -1 ) ) { 1512 if ( settings.fixedNavigation ) { 1513 $('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }) 1514 .unbind() 1515 .bind('click',function() { 1516 settings.activeImage = settings.activeImage + 1; 1517 _set_image_to_view(); 1518 return false; 1519 }); 1520 } else { 1521 // Show the images button for Next buttons 1522 $('#lightbox-nav-btnNext').unbind().hover(function() { 1523 $(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }); 1524 },function() { 1525 $(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' }); 1526 }).show().bind('click',function() { 1527 settings.activeImage = settings.activeImage + 1; 1528 _set_image_to_view(); 1529 return false; 1530 }); 1531 } 1532 } 1533 // Enable keyboard navigation 1534 _enable_keyboard_navigation(); 1535 } 1536 /** 1537 * Enable a support to keyboard navigation 1538 * 1539 */ 1540 function _enable_keyboard_navigation() { 1541 $(document).keydown(function(objEvent) { 1542 _keyboard_action(objEvent); 1543 }); 1544 } 1545 /** 1546 * Disable the support to keyboard navigation 1547 * 1548 */ 1549 function _disable_keyboard_navigation() { 1550 $(document).unbind(); 1551 } 1552 /** 1553 * Perform the keyboard actions 1554 * 1555 */ 1556 function _keyboard_action(objEvent) { 1557 // To ie 1558 if ( objEvent == null ) { 1559 keycode = event.keyCode; 1560 escapeKey = 27; 1561 // To Mozilla 1562 } else { 1563 keycode = objEvent.keyCode; 1564 escapeKey = objEvent.DOM_VK_ESCAPE; 1565 } 1566 // Get the key in lower case form 1567 key = String.fromCharCode(keycode).toLowerCase(); 1568 // Verify the keys to close the ligthBox 1569 if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) { 1570 _finish(); 1571 }
1572 // Verify the key to show the previous image 1573 if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) { 1574 // If weÒre not showing the first image, call the previous 1575 if ( settings.activeImage != 0 ) { 1576 settings.activeImage = settings.activeImage - 1; 1577 _set_image_to_view(); 1578 _disable_keyboard_navigation(); 1579 } 1580 } 1581 // Verify the key to show the next image 1582 if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) { 1583 // If weÒre not showing the last image, call the next 1584 if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) { 1585 settings.activeImage = settings.activeImage + 1; 1586 _set_image_to_view(); 1587 _disable_keyboard_navigation(); 1588 } 1589 } 1590 } 1591 /** 1592 * Preload prev and next images being showed 1593 * 1594 */ 1595 function _preload_neighbor_images() { 1596 if ( (settings.imageArray.length -1) > settings.activeImage ) { 1597 objNext = new Image(); 1598 objNext.src = settings.imageArray[settings.activeImage + 1][0]; 1599 //$('#light_img').attr('href', './?img='+settings.imageArray[settings.activeImage + 1][0]); 1600 } 1601 if ( settings.activeImage > 0 ) { 1602 objPrev = new Image(); 1603 objPrev.src = settings.imageArray[settings.activeImage -1][0]; 1604 //$('#light_img').attr('href', './?img='+settings.imageArray[settings.activeImage - 1][0]); 1605 } 1606 } 1607 /** 1608 * Remove jQuery lightBox plugin HTML markup 1609 * 1610 */ 1611 function _finish() { 1612 $('#jquery-lightbox').remove(); 1613 $('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); }); 1614 // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay. 1615 $('embed, object, select').css({ 'visibility' : 'visible' }); 1616 } 1617 /** 1618 / THIRD FUNCTION 1619 * getPageSize() by quirksmode.com 1620 * 1621 * @return Array Return an array with page width, height and window width, height 1622 */ 1623 function ___getPageSize() { 1624 var xScroll, yScroll; 1625 if (window.innerHeight && window.scrollMaxY) { 1626 xScroll = window.innerWidth + window.scrollMaxX; 1627 yScroll = window.innerHeight + window.scrollMaxY; 1628 } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 1629 xScroll = document.body.scrollWidth; 1630 yScroll = document.body.scrollHeight; 1631 } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 1632 xScroll = document.body.offsetWidth; 1633 yScroll = document.body.offsetHeight; 1634 } 1635 var windowWidth, windowHeight; 1636 if (self.innerHeight) { // all except Explorer 1637 if(document.documentElement.clientWidth){ 1638 windowWidth = document.documentElement.clientWidth; 1639 } else { 1640 windowWidth = self.innerWidth; 1641 } 1642 windowHeight = self.innerHeight; 1643 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 1644 windowWidth = document.documentElement.clientWidth; 1645 windowHeight = document.documentElement.clientHeight; 1646 } else if (document.body) { // other Explorers 1647 windowWidth = document.body.clientWidth; 1648 windowHeight = document.body.clientHeight; 1649 } 1650 // for small pages with total height less then height of the viewport 1651 if(yScroll < windowHeight){ 1652 pageHeight = windowHeight; 1653 } else { 1654 pageHeight = yScroll; 1655 } 1656 // for small pages with total width less then width of the viewport 1657 if(xScroll < windowWidth){ 1658 pageWidth = xScroll; 1659 } else { 1660 pageWidth = windowWidth; 1661 } 1662 arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight); 1663 return arrayPageSize; 1664 }; 1665 /** 1666 / THIRD FUNCTION 1667 * getPageScroll() by quirksmode.com 1668 * 1669 * @return Array Return an array with x,y page scroll values. 1670 */ 1671 function ___getPageScroll() { 1672 var xScroll, yScroll; 1673 if (self.pageYOffset) { 1674 yScroll = self.pageYOffset; 1675 xScroll = self.pageXOffset; 1676 } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict 1677 yScroll = document.documentElement.scrollTop; 1678 xScroll = document.documentElement.scrollLeft; 1679 } else if (document.body) {// all other Explorers 1680 yScroll = document.body.scrollTop; 1681 xScroll = document.body.scrollLeft; 1682 } 1683 arrayPageScroll = new Array(xScroll,yScroll); 1684 return arrayPageScroll; 1685 }; 1686 /** 1687 * Stop the code execution from a escified time in milisecond 1688 * 1689 */ 1690 function ___pause(ms) { 1691 var date = new Date(); 1692 curDate = null; 1693 do { var curDate = new Date(); } 1694 while ( curDate - date < ms); 1695 }; 1696 // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once 1697 return this.unbind('click').click(_initialize); 1698 }; 1699})(jQuery); // Call and execute the function immediately passing the jQuery object 1700 1701 1702 1703 1704 1705 1706/** 1707 * Ðбновление каÑÑинки CAPTCHA Ð´Ð»Ñ ÐºÐ°ÑÑинки по ее ID
1708 * captchaKey - иденÑиÑикаÑÐ¾Ñ CAPTCHA 1709 * captchaHeight - вÑÑоÑа каÑÑинки Ñ CAPTCHA 1710 */ 1711function ReNewCaptchaById(imageId, captchaKey, captchaHeight) 1712{ 1713 // ÐÑÑаемÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ ÑкÑÑÑÑй обÑÐµÐºÑ Ð´Ð»Ñ input-а 1714 var captchaObject = document.getElementById(imageId); 1715 1716 // ÐлеменÑа неÑ, добавим его 1717 if (null != captchaObject && undefined !== captchaObject) 1718 { 1719 var antiCache = Math.floor(Math.random()*100000); 1720 captchaObject.src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache; 1721 } 1722} 1723 1724function act_radio(){ 1725 var id = $('.opros_act').attr('id'); 1726 id = id.replace('opros_step_',''); 1727 $('#steps').val(id); 1728} 1729 1730 1731function strs(count, act){ 1732 str = ''; 1733 for(i = 1; i < count+1; ++i){ 1734 if(i == act) 1735 str += '<span>'+i+'</span>'; 1736 else 1737 str += '<a href="#" onclick="return my_slides('+count+','+i+', false)">'+i+'</a>'; 1738 } 1739 $('.str_slide').html(str); 1740} 1741 1742function my_slides(count, act, ret){ 1743 1744 strs(count, act); 1745 if(ret){ 1746 if(act == count) newact = 1; 1747 else newact = act + 1; 1748 }else{ 1749 newact = act; 1750 } 1751 $('.myslide').fadeOut(100); 1752 $('#slide_'+newact).fadeIn(1000); 1753 return ret; 1754} 1755 1756 1757function cr_t(id){ 1758 $('#cr_t').remove(); 1759 $('#comment_id').val(0); 1760 $('#id_comment_subject').val('') 1761 var form_top = $('#comment'+id).offset().top; 1762 $("html").animate({ scrollTop: form_top-10}, 1100 ); 1763 return false; 1764} 1765 1766function cr(id, name, subj){ 1767 var form_top = $('.comment form').offset().top; 1768 $("html").animate({ scrollTop: form_top}, 1100 ); 1769 $('.comment form input:first').focus(); 1770 $('#comment_id').val(id); 1771 $('#id_comment_subject').val('RE: '+subj); 1772 if($('#cr_t').size() > 0) $('#cr_t').remove(); 1773 $('.comment form').before('<a id="cr_t" href="#" onclick="return cr_t('+id+');">ÐÑмениÑÑ Ð¾ÑÐ²ÐµÑ Ð½Ð° коменÑаÑий <strong>'+name+'</strong></a>'); 1774 return false; 1775} 1776 1777 1778 1779var ajax_loder_blue = '<img src="/tem/images/ajax-loader_blue.gif" alt="" />'; 1780function poll(id, pblc){ 1781 1782 $('.btn').fadeOut(200); 1783 $('#steps').before('<div style="text-align: center;" id="ddddd">'+ajax_loder_blue+'</div>'); 1784 $.post('/pool/', {action:'vote', polls_id:$('#polls_id').val(), poll_reply_id:$('#steps').val()}, function(data){ 1785 1786 if(data == 0){ 1787 $('#ddddd').remove(); 1788 if($('.d_polls').size() > 0) $('.d_polls').remove(); 1789 $('.btn').before('<p class="d_polls">ÐÑ Ñже голоÑовали.</p>'); 1790 $('.btn').fadeIn(200); 1791 }else{ 1792 $('.opros').html(data); 1793 1794 } 1795 }); 1796 return false; 1797} 1798 1799 1800 1801function delet_img(delet_img, rem, id_group, type){ 1802 $.post('./',{action:'delet_img', delet_img:delet_img, id_group:id_group, type:type}, function(data){ 1803 $('#'+rem).remove(); 1804 });//*/ 1805 return false; 1806} 1807 1808 1809 1810function delet_img_img(delet_img, rem, id_group, type){ 1811 $.post('./',{action:'delet_img_img', delet_img:delet_img, information_item_id:id_group, type:type}, function(data){ 1812 $('#'+rem).remove(); 1813 });//*/ 1814 return false; 1815} 1816 1817 1818 1819 1820 1821$(function(){ 1822 1823 $('#top_menu ul li').hover(function(){ 1824 $(this).children('ul').slideDown(300); 1825 },function(){ 1826 $(this).children('ul').slideUp(100); 1827 }); 1828 $('#top_menu>ul>li:last>ul').css({"right":"-7px","left":'auto'}); 1829 $('#top_menu>ul>li:eq(5)>ul').css({"right":"0px","left":'auto'}); 1830 1831 1832 if($('.img_border_content').size() > 0){ 1833 $('.img_border_content').each(function(){ 1834 $(this).removeAttr('class').removeAttr('style'); 1835 var item_img = '<div class="img_b_c" style="width:'+($(this).width())+'px;"><img src="'+$(this).attr('src')+'" alt="'+$(this).attr('alt')+'" /><p>'+$(this).attr('alt')+'</p></div>'; 1836 $(this).before(item_img); 1837 $(this).remove(); 1838 }); 1839 } 1840 1841 1842 1843 $('#group_order').click(function(){ 1844 var data_form = ''; 1845 $('.class_groups_order').each(function(){ 1846 var id = $(this).attr('id').replace(/id_groups_order_/, ''); 1847 var val = $(this).val(); 1848 data_form += id+'='+val+'&'; 1849 }); 1850 data_form += 'action=group_order'; 1851 $('#tb').after('<div id="ol_load"><br /><img src="/tem/images/ajax-loader_blue.gif" /></div>') 1852 $.get('./', data_form, function(data){ 1853 $('#ol_load').remove(); 1854 }); 1855 return false; 1856 }); 1857 1858 1859
1860 $('#img_order').click(function(){ 1861 var data_form = ''; 1862 $('.class_img_order').each(function(){ 1863 var id = $(this).attr('id').replace(/id_img_order_/, ''); 1864 var val = $(this).val(); 1865 data_form += id+'='+val+'&'; 1866 }); 1867 data_form += 'action=img_order'; 1868 $('#tb').after('<div id="ol_load"><br /><img src="/tem/images/ajax-loader_blue.gif" /></div>') 1869 $.get('./', data_form, function(data){ 1870 $('#ol_load').remove(); 1871 }); 1872 return false; 1873 }); 1874 1875 1876 $('#all_teg').click(function(){ 1877 var myreturn = $(this).html(); 1878 $(this).html(ajax_loder_blue); 1879 $.get('./', {action:'tag'}, function(data){ 1880 $('.claood').slideUp(300); 1881 setTimeout(function(){ 1882 $('.claood').html(data); 1883 $('#all_teg').remove(); 1884 $('#tag_count').remove() 1885 $('.claood').slideDown(300); 1886 },300); 1887 }); 1888 return false; 1889 }); 1890 1891 1892 $('#feedback').submit(function(){ 1893 $('.submit').fadeOut(200); 1894 var act = $(this).serialize(); 1895 act += '&action=feedback'; 1896 $.post('/feedback/', act, function(data){ 1897 if(data == 1){ 1898 $('#feedback').fadeOut(200); 1899 $('#footer .blockHelp').append('<p>СпаÑибо Ð²Ð°Ñ Ð²Ð¾Ð¿ÑÐ¾Ñ Ð¿ÑинÑÑ.</p>'); 1900 } 1901 }); 1902 $('.submit').fadeIn(200); 1903 return false; 1904 }); 1905 1906 1907 if($('.myslide').size() > 0){ 1908 count = $('.myslide').size(); 1909 act = 1; 1910 strs(count, act) 1911 setInterval(function(){ 1912 my_slides(count, act, true); 1913 if(act == count) act = 1; 1914 else act++; 1915 }, 5000); 1916 1917 } 1918 1919 1920 /*$('#left_menu li ul a').click(function(){ 1921 if($(this).parent().children('ul').size() > 0){ 1922 $(this).parent().children('ul').slideToggle(300); 1923 return false; 1924 } 1925 })//*/ 1926 1927 if($("#steps").size() > 0){ 1928 act_radio(); 1929 $('.opros_i').click(function(){ 1930 $('.opros_i').removeClass('opros_act'); 1931 $(this).addClass('opros_act'); 1932 act_radio(); 1933 return false; 1934 }); 1935 } 1936 1937 $('#tb>tbody>tr').hover(function(){ 1938 $(this).addClass('act'); 1939 },function(){ 1940 $(this).removeClass('act'); 1941 }) 1942 1943 1944 $('.textarea textarea').keyup(function(event){ 1945 //92 ÑÑÑока 1946 var val = $(this).val(); 1947 mas = val.split(/\n/); 1948 var i = 0; 1949 $.each(mas, function(g,v){ 1950 if(v.length > 92) i = i + Math.floor(v.length / 92); 1951 ++i; 1952 }); 1953 if(i > 5) $(this).attr('rows', i); else $(this).attr('rows', 5); 1954 }); 1955 1956 1957 $('.pri').click(function(){ 1958 $('.blog_index>h2').removeClass('a_blog'); 1959 $(this).parent().addClass('a_blog'); 1960 $('.blog_index>h2:not(.a_blog)').next().slideUp(300); 1961 $(this).parent().next().slideToggle(300); 1962 return false; 1963 }); 1964 1965 1966 $(".pd_b").click(function(){ 1967 $(this).parents('.blog_index').children('.description_b_c').slideToggle(300); 1968 $(this).parents('.blog_index').children('.description_b').slideToggle(300); 1969 return false; 1970 }); 1971 1972 1973 1974 /* if($('.video').size() > 0 && $('.video_left').size() > 0){ 1975 var $video = $('.video'); 1976 var $video_left = $('.video_left'); 1977 var text_left = ""; 1978 var text_right = ""; 1979 var text = ""; 1980 text_left += "<div style='"+$video.attr('style')+"'>"; 1981 text_right += "<div style='"+$video_left.attr('style')+"'>"; 1982 text_left += $video.html(); 1983 text_right += $video_left.html(); 1984 text_left += "</div>"; 1985 text_right += "</div>"; 1986 text = text_left + text_right + "<br clear='all' />"; 1987 $('.code').val(text); 1988 } */ 1989 1990 1991 //EditAddInformationGroup 1992 1993 $("#EditAddInformationGroup").submit(function(){ 1994 $(this).fadeOut(200); 1995 }); 1996 1997 1998 $('.slide a').click(function(){ 1999 $(this).parent().children("ul").slideToggle(300); 2000 }) 2001 2002 $('.open_slid_index').click(function(){ 2003 if($(this).parent().children('.slid_index').size() > 0) $(this).parent().children('.slid_index').toogleUpDown(); 2004 return false; 2005 }); 2006 2007 $('.validate').validate(); 2008 2009 2010 2011 $("a[href$='.jpg'], a[href$='.png'], a[href$='.gif'], a[href$='.jpeg']").lightBox(); 2012 2013}); 2014 2015 2016/* ========================================================= 2017 2018// jquery.innerfade.js 2019 2020// Datum: 2008-02-14 2021// Firma: Medienfreunde Hofmann & Baldes GbR 2022// Author: Torsten Baldes 2023// Mail: [email protected] 2024// Web: http://medienfreunde.com 2025 2026// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/ 2027// and Ralf S. Engelschall http://trainofthoughts.org/ 2028 2029 * 2030 * <ul id="news"> 2031 * <li>content 1</li> 2032 * <li>content 2</li> 2033 * <li>content 3</li> 2034 * </ul> 2035 * 2036 * $('#news').innerfade({ 2037 * animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 2038 * speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 2039 * timeout: Time between the fades in milliseconds (Default: '2000'), 2040 * type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: '
2040sequence'), 2041 * containerheight: Height of the containing element in any css-height-value (Default: 'auto'), 2042 * runningclass: CSS-Class which the container getâs applied (Default: 'innerfade'), 2043 * children: optional children selector (Default: null) 2044 * }); 2045 * 2046 2047// ========================================================= */ 2048 2049 2050(function($) { 2051 2052 $.fn.innerfade = function(options) { 2053 return this.each(function() { 2054 $.innerfade(this, options); 2055 }); 2056 }; 2057 2058 $.innerfade = function(container, options) { 2059 var settings = { 2060 'animationtype': 'fade', 2061 'speed': 'normal', 2062 'type': 'sequence', 2063 'timeout': 3000, 2064 'containerheight': 'auto', 2065 'runningclass': 'innerfade', 2066 'children': null 2067 }; 2068 if (options) 2069 $.extend(settings, options); 2070 if (settings.children === null) 2071 var elements = $(container).children(); 2072 else 2073 var elements = $(container).children(settings.children); 2074 if (elements.length > 1) { 2075 $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass); 2076 for (var i = 0; i < elements.length; i++) { 2077 $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide(); 2078 }; 2079 if (settings.type == "sequence") { 2080 setTimeout(function() { 2081 $.innerfade.next(elements, settings, 1, 0); 2082 }, settings.timeout); 2083 $(elements[0]).show(); 2084 } else if (settings.type == "random") { 2085 var last = Math.floor ( Math.random () * ( elements.length ) ); 2086 setTimeout(function() { 2087 do { 2088 current = Math.floor ( Math.random ( ) * ( elements.length ) ); 2089 } while (last == current ); 2090 $.innerfade.next(elements, settings, current, last); 2091 }, settings.timeout); 2092 $(elements[last]).show(); 2093 } else if ( settings.type == 'random_start' ) { 2094 settings.type = 'sequence'; 2095 var current = Math.floor ( Math.random () * ( elements.length ) ); 2096 setTimeout(function(){ 2097 $.innerfade.next(elements, settings, (current + 1) % elements.length, current); 2098 }, settings.timeout); 2099 $(elements[current]).show(); 2100 } else { 2101 alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\''); 2102 } 2103 } 2104 }; 2105 2106 $.innerfade.next = function(elements, settings, current, last) { 2107 if (!document.webkitHidden) { 2108 if (settings.animationtype == 'slide') { 2109 $(elements[last]).slideUp(settings.speed); 2110 $(elements[current]).slideDown(settings.speed); 2111 } else if (settings.animationtype == 'fade') { 2112 $(elements[last]).fadeOut(settings.speed); 2113 $(elements[current]).fadeIn(settings.speed, function() { 2114 removeFilter($(this)[0]); 2115 }); 2116 } else 2117 alert('Innerfade-animationtype must either be \'slide\' or \'fade\''); 2118 if (settings.type == "sequence") { 2119 if ((current + 1) < elements.length) { 2120 current = current + 1; 2121 last = current - 1; 2122 } else { 2123 current = 0; 2124 last = elements.length - 1; 2125 } 2126 } else if (settings.type == "random") { 2127 last = current; 2128 while (current == last) 2129 current = Math.floor(Math.random() * elements.length); 2130 } else 2131 alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\''); 2132 } 2133 setTimeout((function() { 2134 $.innerfade.next(elements, settings, current, last); 2135 }), settings.timeout, 0); 2136 }; 2137 2138})(jQuery); 2139 2140// **** remove Opacity-Filter in ie **** 2141function removeFilter(element) { 2142 if(element.style.removeAttribute){ 2143 element.style.removeAttribute('filter'); 2144 } 2145} 2146 2147 2148//--------------------- menu ---------- 2149 2150function expand(node){ 2151$ul=document.getElementById(node); 2152if(!$ul) return; 2153 2154if($ul.style.display == "none") 2155{ 2156 $ul.style.display = "block"; 2157 return false;
2158} 2159 if($ul.style.display != "none") 2160{ 2161 $ul.style.display = "none"; 2162 return false; 2163} 2164} 2165 2166/* ------------------------------------------------------------------------ 2167 s3Slider 2168 2169 Developped By: Boban Karišik -> http://www.serie3.info/ 2170 CSS Help: Mészáros Róbert -> http://www.perspectived.com/ 2171 Version: 1.0 2172 2173 Copyright: Feel free to redistribute the script/modify it, as 2174 long as you leave my infos at the top. 2175------------------------------------------------------------------------- */ 2176 2177 2178(function($){ 2179 2180 $.fn.s3Slider = function(vars) { 2181 2182 var element = this; 2183 var timeOut = (vars.timeOut != undefined) ? vars.timeOut : 4000; 2184 var current = null; 2185 var timeOutFn = null; 2186 var faderStat = true; 2187 var mOver = false; 2188 var items = $("#" + element[0].id + "Content ." + element[0].id + "Image"); 2189 var itemsSpan = $("#" + element[0].id + "Content ." + element[0].id + "Image span"); 2190 2191 items.each(function(i) { 2192 2193 $(items[i]).mouseover(function() { 2194 mOver = true; 2195 }); 2196 2197 $(items[i]).mouseout(function() { 2198 mOver = false; 2199 fadeElement(true); 2200 }); 2201 2202 }); 2203 2204 var fadeElement = function(isMouseOut) { 2205 var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut; 2206 thisTimeOut = (faderStat) ? 10 : thisTimeOut; 2207 if(items.length > 0) { 2208 timeOutFn = setTimeout(makeSlider, thisTimeOut); 2209 } else { 2210 console.log("Poof.."); 2211 } 2212 } 2213 2214 var makeSlider = function() { 2215 current = (current != null) ? current : items[(items.length-1)]; 2216 var currNo = jQuery.inArray(current, items) + 1 2217 currNo = (currNo == items.length) ? 0 : (currNo - 1); 2218 var newMargin = $(element).width() * currNo; 2219 if(faderStat == true) { 2220 if(!mOver) { 2221 $(items[currNo]).fadeIn((timeOut/6), function() { 2222 if($(itemsSpan[currNo]).css('bottom') == 0) { 2223 $(itemsSpan[currNo]).slideUp((timeOut/6), function() { 2224 faderStat = false; 2225 current = items[currNo]; 2226 if(!mOver) { 2227 fadeElement(false); 2228 } 2229 }); 2230 } else { 2231 $(itemsSpan[currNo]).slideDown((timeOut/6), function() { 2232 faderStat = false; 2233 current = items[currNo]; 2234 if(!mOver) { 2235 fadeElement(false); 2236 } 2237 }); 2238 } 2239 }); 2240 } 2241 } else { 2242 if(!mOver) { 2243 if($(itemsSpan[currNo]).css('bottom') == 0) { 2244 $(itemsSpan[currNo]).slideDown((timeOut/6), function() { 2245 $(items[currNo]).fadeOut((timeOut/6), function() { 2246 faderStat = true; 2247 current = items[(currNo+1)]; 2248 if(!mOver) { 2249 fadeElement(false); 2250 } 2251 }); 2252 }); 2253 } else { 2254 $(itemsSpan[currNo]).slideUp((timeOut/6), function() { 2255 $(items[currNo]).fadeOut((timeOut/6), function() { 2256 faderStat = true; 2257 current = items[(currNo+1)]; 2258 if(!mOver) { 2259 fadeElement(false); 2260 } 2261 }); 2262 }); 2263 } 2264 } 2265 } 2266 } 2267 2268 makeSlider(); 2269 2270 }; 2271 2272})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.