1function FJ() { 2} 3 4FJ.prototype.is_scrool_top = 15; 5FJ.prototype.translate = {}; 6FJ.prototype.now = null; 7FJ.prototype.now_date = null; 8 9/** autocompletui **/ 10FJ.prototype.accentMap = { 11 'áº': 'a', 12 'Ã': 'a', 13 'á': 'a', 14 'Ã': 'a', 15 'à ': 'a', 16 'Ä': 'a', 17 'Ä': 'a', 18 'Ắ': 'a', 19 'ắ': 'a', 20 'Ằ': 'a', 21 'ằ': 'a', 22 'Ẵ': 'a', 23 'ẵ': 'a', 24 'Ẳ': 'a', 25 'ẳ': 'a', 26 'Ã': 'a', 27 'â': 'a', 28 'Ấ': 'a', 29 'ấ': 'a', 30 'Ầ': 'a', 31 'ầ': 'a', 32 'Ẫ': 'a', 33 'ẫ': 'a', 34 'Ẩ': 'a', 35 'ẩ': 'a', 36 'Ç': 'a', 37 'Ç': 'a', 38 'à ': 'a', 39 'Ã¥': 'a', 40 'Ǻ': 'a', 41 'Ç»': 'a', 42 'Ã': 'a', 43 'ä': 'a', 44 'Ç': 'a', 45 'Ç': 'a', 46 'Ã': 'a', 47 'ã': 'a', 48 'Ȧ': 'a', 49 'ȧ': 'a', 50 'Ç ': 'a', 51 'Ç¡': 'a', 52 'Ä': 'a', 53 'Ä ': 'a', 54 'Ä': 'a', 55 'Ä': 'a', 56 'Ả': 'a', 57 'ả': 'a', 58 'È': 'a', 59 'È': 'a', 60 'È': 'a', 61 'È': 'a', 62 'Ạ': 'a', 63 'ạ': 'a', 64 'Ặ': 'a', 65 'ặ': 'a', 66 'Ậ': 'a', 67 'áº': 'a', 68 'á¸': 'a', 69 'á¸': 'a', 70 'Ⱥ': 'a', 71 'â±¥': 'a', 72 'Ǽ': 'a', 73 'ǽ': 'a', 74 'Ç¢': 'a', 75 'Ç£': 'a', 76 'á¸': 'b', 77 'á¸': 'b', 78 'á¸': 'b', 79 'Ḡ': 'b', 80 'á¸': 'b', 81 'á¸': 'b', 82 'É': 'b', 83 'Æ': 'b', 84 'ᵬ': 'b', 85 'Æ': 'b', 86 'É': 'b', 87 'Æ': 'b', 88 'Æ': 'b', 89 'Ä': 'c', 90 'Ä': 'c', 91 'Ä': 'c', 92 'Ä': 'c', 93 'Ä': 'c', 94 'Ä': 'c', 95 'Ä': 'c', 96 'Ä': 'c', 97 'Ã': 'c', 98 'ç': 'c', 99 'á¸': 'c', 100 'á¸': 'c', 101 'È»': 'c', 102 'ȼ': 'c', 103 'Æ': 'c', 104 'Æ': 'c', 105 'É': 'c', 106 'Ä': 'd', 107 'Ä': 'd', 108 'á¸': 'd', 109 'á¸': 'd', 110 'á¸': 'd', 111 'á¸': 'd', 112 'á¸': 'd', 113 'á¸': 'd', 114 'á¸': 'd', 115 'á¸': 'd', 116 'á¸': 'd', 117 'á¸': 'd', 118 'Ä': 'd', 119 'Ä': 'd', 120 'áµ': 'd', 121 'Æ': 'd', 122 'É': 'd', 123 'Æ': 'd', 124 'É': 'd', 125 'Æ': 'd', 126 'Æ': 'd', 127 'È¡': 'd', 128 'ð': 'd', 129 'Ã': 'e', 130 'Æ': 'e', 131 'Æ': 'e', 132 'Ç': 'e', 133 'é': 'e', 134 'Ã': 'e', 135 'è': 'e', 136 'Ä': 'e', 137 'Ä': 'e', 138 'Ã': 'e', 139 'ê': 'e', 140 'Ế': 'e', 141 'ế': 'e', 142 'á»': 'e', 143 'á»': 'e', 144 'á»': 'e', 145 'á» ': 'e', 146 'á»': 'e', 147 'á»': 'e', 148 'Ä': 'e', 149 'Ä': 'e', 150 'Ã': 'e', 151 'ë': 'e', 152 'Ẽ': 'e', 153 'ẽ': 'e', 154 'Ä': 'e', 155 'Ä': 'e', 156 'Ȩ': 'e', 157 'È©': 'e', 158 'á¸': 'e', 159 'á¸': 'e', 160 'Ä': 'e', 161 'Ä': 'e', 162 'Ä': 'e', 163 'Ä': 'e', 164 'á¸': 'e', 165 'á¸': 'e', 166 'á¸': 'e', 167 'á¸': 'e', 168 'Ẻ': 'e', 169 'ẻ': 'e', 170 'È': 'e', 171 'È ': 'e', 172 'È': 'e', 173 'È': 'e', 174 'Ẹ': 'e', 175 'ẹ': 'e', 176 'á»': 'e', 177 'á»': 'e', 178 'á¸': 'e', 179 'á¸': 'e', 180 'á¸': 'e', 181 'á¸': 'e', 182 'É': 'e', 183 'É': 'e', 184 'É': 'e', 185 'É': 'e', 186 'á¸': 'f', 187 'á¸': 'f', 188 'áµ®': 'f', 189 'Æ': 'f', 190 'Æ': 'f', 191 'Ç´': 'g', 192 'ǵ': 'g', 193 'Ä': 'g', 194 'Ä': 'g', 195 'Ä': 'g', 196 'Ä': 'g', 197 'Ǧ': 'g', 198 'ǧ': 'g', 199 'Ä ': 'g', 200 'Ä¡': 'g', 201 'Ä¢': 'g', 202 'Ä£': 'g', 203 'Ḡ': 'g', 204 'ḡ': 'g', 205 'Ǥ': 'g', 206 'Ç¥': 'g', 207 'Æ': 'g', 208 'É ': 'g', 209 'Ĥ': 'h', 210 'Ä¥': 'h', 211 'È': 'h', 212 'È': 'h', 213 'Ḧ': 'h', 214 'ḧ': 'h', 215 'Ḣ': 'h', 216 'ḣ': 'h', 217 'Ḩ': 'h', 218 'ḩ': 'h', 219 'Ḥ': 'h', 220 'ḥ': 'h', 221 'Ḫ': 'h', 222 'ḫ': 'h', 223 'H': 'h', 224 '̱': 'h', 225 'áº': 'h', 226 'Ħ': 'h', 227 'ħ': 'h', 228 'â±§': 'h', 229 'ⱨ': 'h', 230 'Ã': 'i', 231 'Ã': 'i', 232 'Ã': 'i', 233 'ì': 'i', 234 'Ĭ': 'i', 235 'Ä': 'i', 236 'Ã': 'i', 237 'î': 'i', 238 'Ç': 'i', 239 'Ç': 'i', 240 'Ã': 'i', 241 'ï': 'i', 242 'Ḯ': 'i', 243 'ḯ': 'i', 244 'Ĩ': 'i', 245 'Ä©': 'i', 246 'İ': 'i', 247 'i': 'i', 248 'Ä®': 'i', 249 'į': 'i', 250 'Ī': 'i', 251 'Ä«': 'i', 252 'á»': 'i', 253 'á»': 'i', 254 'È': 'i', 255 'È': 'i', 256 'È': 'i', 257 'È': 'i', 258 'á»': 'i', 259 'á»': 'i', 260 'Ḭ': 'i', 261 'á¸': 'i', 262 'I': 'i', 263 'ı': 'i', 264 'Æ': 'i', 265 'ɨ': 'i', 266 'Ä´': 'j', 267 'ĵ': 'j', 268 'J': 'j', 269 'Ì': 'j', 270 'ǰ': 'j', 271 'È·': 'j', 272 'É': 'j', 273 'É': 'j', 274 'Ê': 'j', 275 'É': 'j', 276 'Ê': 'j', 277 'Ḱ': 'k', 278 'ḱ': 'k', 279 'Ǩ': 'k', 280 'Ç©': 'k', 281 'Ķ': 'k', 282 'Ä·': 'k', 283 'Ḳ': 'k', 284 'ḳ': 'k', 285 'Ḵ': 'k', 286 'ḵ': 'k', 287 'Æ': 'k', 288 'Æ': 'k', 289 'Ⱪ': 'k', 290 'ⱪ': 'k', 291 'Ĺ': 'a', 292 'ĺ': 'l', 293 'Ľ': 'l', 294 'ľ': 'l', 295 'Ä»': 'l', 296 'ļ': 'l', 297 'Ḷ': 'l', 298 'ḷ': 'l', 299 'Ḹ': 'l', 300 'ḹ': 'l', 301 'Ḽ': 'l', 302 'ḽ': 'l', 303 'Ḻ': 'l', 304 'ḻ': 'l', 305 'Å': 'l', 306 'Å': 'l', 307 'Å':'l', 308 'Ì£': 'l', 309 'Å':'l', 310 'Ì£':'l', 311 'Ä¿': 'l', 312 'Å': 'l', 313 'Ƚ': 'l', 314 'Æ': 'l', 315 'â± ': 'l', 316 'ⱡ': 'l', 317 'â±¢': 'l', 318 'É«': 'l', 319 'ɬ': 'l', 320 'É': 'l', 321 'È´': 'l', 322 'Ḿ': 'm', 323 'ḿ': 'm', 324 'á¹': 'm', 325 'á¹': 'm', 326 'á¹': 'm', 327 'á¹': 'm', 328 'ɱ': 'm', 329 'Å': 'n', 330 'Å': 'n', 331 'Ǹ': 'n', 332 'ǹ': 'n', 333 'Å': 'n', 334 'Å': 'n', 335 'Ã': 'n', 336 'ñ': 'n', 337 'á¹': 'n', 338 'á¹ ': 'n', 339 'Å ': 'n', 340 'Å': 'n', 341 'á¹': 'n', 342 'á¹': 'n',
343 'á¹': 'n', 344 'á¹': 'n', 345 'á¹': 'n', 346 'á¹': 'n', 347 'Æ': 'n', 348 'ɲ': 'n', 349 'È ': 'n', 350 'Æ': 'n', 351 'ɳ': 'n', 352 'ȵ': 'n', 353 'N': 'n', 354 'Ì': 'n', 355 'n': 'n', 356 'Ì':'n', 357 'Ã': 'o', 358 'ó': 'o', 359 'Ã': 'o', 360 'ò': 'o', 361 'Å': 'o', 362 'Å': 'o', 363 'Ã': 'o', 364 'ô': 'o', 365 'á»': 'o', 366 'á»': 'o', 367 'á»': 'o', 368 'á»': 'o', 369 'á»': 'o', 370 'á»': 'o', 371 'á»': 'o', 372 'á»': 'o', 373 'Ç': 'o', 374 'Ç': 'o', 375 'Ã': 'o', 376 'ö': 'o', 377 'Ȫ': 'o', 378 'È«': 'o', 379 'Å': 'o', 380 'Å': 'o', 381 'Ã': 'o', 382 'õ': 'o', 383 'á¹': 'o', 384 'á¹': 'o', 385 'á¹': 'o', 386 'á¹': 'o', 387 'Ȭ': 'o', 388 'È': 'o', 389 'È®': 'o', 390 'ȯ': 'o', 391 'Ȱ': 'o', 392 'ȱ': 'o', 393 'Ã': 'o', 394 'ø': 'o', 395 'Ǿ': 'o', 396 'Ç¿': 'o', 397 'Ǫ': 'o', 398 'Ç«': 'o', 399 'Ǭ': 'o', 400 'Ç': 'o', 401 'Å': 'o', 402 'Å': 'o', 403 'á¹': 'o', 404 'á¹': 'o', 405 'á¹': 'o', 406 'á¹': 'o', 407 'á»': 'o', 408 'á»': 'o', 409 'È': 'o', 410 'È': 'o', 411 'È': 'o', 412 'È': 'o', 413 'Æ ': 'o', 414 'Æ¡': 'o', 415 'á»': 'o', 416 'á»': 'o', 417 'á»': 'o', 418 'á»': 'o', 419 'á» ': 'o', 420 'ỡ': 'o', 421 'á»': 'o', 422 'á»': 'o', 423 'Ợ': 'o', 424 'ợ': 'o', 425 'á»': 'o', 426 'á»': 'o', 427 'á»': 'o', 428 'á»': 'o', 429 'Æ': 'o', 430 'ɵ': 'o', 431 'á¹': 'p', 432 'á¹': 'p', 433 'á¹': 'p', 434 'á¹': 'p', 435 'â±£': 'p', 436 'Ƥ': 'p', 437 'Æ¥': 'p', 438 'P': 'p', 439 'Ì': 'p', 440 'p': 'p', 441 'Ì':'p', 442 'Ê ': 'q', 443 'É': 'q', 444 'É': 'q', 445 'Å': 'r', 446 'Å': 'r', 447 'Å': 'r', 448 'Å': 'r', 449 'á¹': 'r', 450 'á¹': 'r', 451 'Å': 'r', 452 'Å': 'r', 453 'È': 'r', 454 'È': 'r', 455 'È': 'r', 456 'È': 'r', 457 'á¹': 'r', 458 'á¹': 'r', 459 'á¹': 'r', 460 'á¹': 'r', 461 'á¹': 'r', 462 'á¹': 'r', 463 'É': 'r', 464 'É': 'r', 465 'áµ²': 'r', 466 'ɼ': 'r', 467 'Ɽ': 'r', 468 'ɽ': 'r', 469 'ɾ': 'r', 470 'áµ³': 'r', 471 'Ã': 's', 472 'Å': 's', 473 'Å': 's', 474 'Ṥ': 's', 475 'á¹¥': 's', 476 'Å': 's', 477 'Å': 's', 478 'Å ': 's', 479 'Å¡': 's', 480 'Ṧ': 's', 481 'á¹§': 's', 482 'á¹ ': 's', 483 'ṡ': 's', 484 'áº': 's', 485 'Å': 's', 486 'Å': 's', 487 'á¹¢': 's', 488 'á¹£': 's', 489 'Ṩ': 's', 490 'ṩ': 's', 491 'È': 's', 492 'È': 's', 493 'Ê': 's', 494 'S': 's', 495 'Ì©': 's', 496 's': 's', 497 'Ì©':'s', 498 'Ã': 't', 499 'þ': 't', 500 'Ť': 't', 501 'Å¥': 't', 502 'T': 't', 503 'Ì':'t', 504 'áº': 't', 505 'Ṫ': 't', 506 'ṫ': 't', 507 'Å¢': 't', 508 'Å£': 't', 509 'Ṭ': 't', 510 'á¹': 't', 511 'È': 't', 512 'È': 't', 513 'á¹°': 't', 514 'á¹±': 't', 515 'á¹®': 't', 516 'ṯ': 't', 517 'Ŧ': 't', 518 'ŧ': 't', 519 'Ⱦ': 't', 520 'ⱦ': 't', 521 'áµµ': 't', 522 'Æ«': 't', 523 'Ƭ': 't', 524 'Æ': 't', 525 'Æ®': 't', 526 'Ê': 't', 527 'ȶ': 't', 528 'Ã': 'u', 529 'ú': 'u', 530 'Ã': 'u', 531 'ù': 'u', 532 'Ŭ': 'u', 533 'Å': 'u', 534 'Ã': 'u', 535 'û': 'u', 536 'Ç': 'u', 537 'Ç': 'u', 538 'Å®': 'u', 539 'ů': 'u', 540 'Ã': 'u', 541 'ü': 'u', 542 'Ç': 'u', 543 'Ç': 'u', 544 'Ç': 'u', 545 'Ç': 'u', 546 'Ç': 'u', 547 'Ç': 'u', 548 'Ç': 'u', 549 'Ç': 'u', 550 'Ű': 'u', 551 'ű': 'u', 552 'Ũ': 'u', 553 'Å©': 'u', 554 'Ṹ': 'u', 555 'á¹¹': 'u', 556 'Ų': 'u', 557 'ų': 'u', 558 'Ū': 'u', 559 'Å«': 'u', 560 'Ṻ': 'u', 561 'á¹»': 'u', 562 'Ủ': 'u', 563 'á»§': 'u', 564 'È': 'u', 565 'È': 'u', 566 'È': 'u', 567 'È': 'u', 568 'Ư': 'u', 569 'ư': 'u', 570 'Ứ': 'u', 571 'ứ': 'u', 572 'Ừ': 'u', 573 'ừ': 'u', 574 'á»®': 'u', 575 'ữ': 'u', 576 'Ử': 'u', 577 'á»': 'u', 578 'á»°': 'u', 579 'á»±': 'u', 580 'Ụ': 'u', 581 'ụ': 'u', 582 'á¹²': 'u', 583 'á¹³': 'u', 584 'á¹¶': 'u', 585 'á¹·': 'u', 586 'á¹´': 'u', 587 'á¹µ': 'u', 588 'É': 'u', 589 'Ê': 'u', 590 'á¹¼': 'v', 591 'á¹½': 'v', 592 'á¹¾': 'v', 593 'ṿ': 'v', 594 'Ʋ': 'v', 595 'Ê': 'v', 596 'áº': 'w', 597 'áº': 'w', 598 'áº': 'w', 599 'áº': 'w', 600 'Å´': 'w', 601 'ŵ': 'w', 602 'W': 'w', 603 'Ì': 'w', 604 'áº': 'w', 605 'áº': 'w', 606 'Ạ': 'w', 607 'áº': 'w', 608 'áº': 'w', 609 'áº': 'w', 610 'áº': 'w', 611 'áº': 'x', 612 'áº': 'x', 613 'áº': 'x', 614 'áº': 'x', 615 'Ã': 'y', 616 'ý': 'y', 617 'Ỳ': 'y', 618 'ỳ': 'y', 619 'Ŷ': 'y', 620 'Å·': 'y', 621 'Y': 'y', 622 'Ì':'y', 623 'áº': 'y', 624 'Ÿ': 'y', 625 'ÿ': 'y', 626 'Ỹ': 'y', 627 'ỹ': 'y', 628 'áº': 'y', 629 'áº': 'y', 630 'Ȳ': 'y', 631 'ȳ': 'y', 632 'á»¶': 'y', 633 'á»·': 'y', 634 'á»´': 'y', 635 'ỵ': 'y', 636 'Ê': 'y', 637 'É': 'y', 638 'É': 'y', 639 'Ƴ': 'y', 640 'Æ´': 'y', 641 'Ź': 'z', 642 'ź': 'z', 643 'áº': 'z', 644 'áº': 'z', 645 'Ž': 'z', 646 'ž': 'z', 647 'Å»': 'z', 648 'ż': 'z', 649 'áº': 'z', 650 'áº': 'z', 651 'áº': 'z', 652 'áº': 'z', 653 'Ƶ': 'z', 654 'ƶ': 'z', 655 'Ȥ': 'z', 656 'È¥': 'z', 657 'Ê': 'z', 658 'Ê': 'z', 659 'Ⱬ': 'z', 660 'ⱬ': 'z', 661 'Ç®': 'z', 662 'ǯ': 'z', 663 'ƺ': 'z', 664// Roman fullwidth ascii equivalents: 0xff00 to 0xff5e 665 'ï¼': '2', 666 'ï¼': '6', 667 'ï¼¢': 'B',
668 'F': 'F', 669 'J': 'J', 670 'ï¼®': 'N', 671 'ï¼²': 'R', 672 'ï¼¶': 'V', 673 'Z': 'Z', 674 'ï½': 'b', 675 'ï½': 'f', 676 'ï½': 'j', 677 'ï½': 'n', 678 'ï½': 'r', 679 'ï½': 'v', 680 'ï½': 'z', 681 'ï¼': '1', 682 'ï¼': '5', 683 'ï¼': '9', 684 'A': 'A', 685 'ï¼¥': 'E', 686 'I': 'I', 687 'ï¼': 'M', 688 'ï¼±': 'Q', 689 'ï¼µ': 'U', 690 'ï¼¹': 'Y', 691 'ï½': 'a', 692 'ï½ ': 'e', 693 'ï½': 'i', 694 'ï½': 'm', 695 'ï½': 'q', 696 'ï½': 'u', 697 'ï½': 'y', 698 'ï¼': '0', 699 'ï¼': '4', 700 'ï¼': '8', 701 'D': 'D', 702 'H': 'H', 703 'L': 'L', 704 'ï¼°': 'P', 705 'ï¼´': 'T', 706 'X': 'X', 707 'ï½': 'd', 708 'ï½': 'h', 709 'ï½': 'l', 710 'ï½': 'p', 711 'ï½': 't', 712 'ï½': 'x', 713 'ï¼': '3', 714 'ï¼': '7', 715 'ï¼£': 'C', 716 'ï¼§': 'G', 717 'K': 'K', 718 'O': 'O', 719 'ï¼³': 'S', 720 'ï¼·': 'W', 721 'ï½': 'c', 722 'ï½': 'g', 723 'ï½': 'k', 724 'ï½': 'o', 725 'ï½': 's', 726 'ï½': 'w'}; 727 728FJ.prototype.normalize = function(term) 729{ 730 731 var ret = ""; 732 for (var i = 0; i < term.length; i++) { 733 ret += fjObj.accentMap[ term.charAt(i) ] || term.charAt(i); 734 } 735 return ret; 736} 737 738FJ.prototype.getAutocompleteSource = function(source) 739{ 740 return function(request, response) { 741 var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); 742 response($.grep(source, function(value) { 743 value = value.label || value.value || value; 744 return matcher.test(value) || matcher.test(fjObj.normalize(value)); 745 })); 746 } 747} 748 749/** popup **/ 750FJ.prototype.showAjaxPopup = function(action, query, options) 751{ 752 $.ajax({ 753 type: 'GET', 754 url: action, 755 data: query, 756 cache: false, 757 success: function(data) { 758 if (data.html) 759 fjObj.showPopup(data.html, options); 760 else 761 fjObj.showPopup(data, options); 762 } 763 764 }); 765} 766 767FJ.prototype.showPopup = function(html, options) 768{ 769 var popup; 770 771 if (!isset(options)) 772 options = {}; 773 774 if (!options.notClearPopupsMessage) 775 $('.fj-popup-message').remove(); 776 777 if (!options.notClearPopups) 778 $('.popup').remove(); 779 780 if (html) 781 { 782 popup = $(html); 783 $('body').append(popup); 784 } 785 else 786 { 787 popup = $('.popup'); 788 } 789 790 if (popup.length > 0) 791 { 792 fjObj.showBGOverlay(); 793 794 if (!options.disable_hide) 795 popup.hide(); 796 797 popup.fadeIn(); 798 popup.find('.fj-popup-close').click(function(e) { 799 e.preventDefault(); 800 fjObj.closePopup(); 801 }); 802 803 if (options.positionX == 'center') 804 { 805 popup.css({ 806 'margin-left': popup.width() / (-2), 807 }); 808 } 809 810 if (options.positionY == 'center') 811 { 812 popup.css({ 813 'margin-left': popup.width() / (-2) 814 }); 815 } 816 817 if (options.fixedPosition || popup.data('fixedPosition')) 818 { 819 popup.css({ 820 'margin-left': popup.width() / (-2), 821 'margin-top': popup.height() / (-2), 822 'position': 'fixed' 823 }); 824 } 825 826 if (options.scrollable) 827 { 828 if (popup.position().top < $(window).scrollTop()) 829 $(window).scrollTo('.popup', 500, { 830 offset: -20 831 }); 832 } 833 834 if (options.set_position) 835 { 836 var position_top = options.set_position_top ? options.set_position_top : 0; 837 838 if ($(window).scrollTop() + position_top + popup.height() > $('body').height()) 839 { 840 $(window).scrollTo('.popup', 500, { 841 offset: -20 842 }); 843 844 } 845 else 846 popup.css('top', $(window).scrollTop() + position_top); 847 } 848 849 if (options.buttons) 850 { 851 $.each(options.buttons, function(key, val) { 852 popup.find(val.selector).click(val.callback); 853 }) 854 855 } 856 } 857 858} 859 860FJ.prototype.showBGOverlay = function() 861{ 862 if (!$('.popup-overlay').is(':visible')) 863 $('.popup-overlay').show(); 864} 865 866FJ.prototype.closePopup = function(obj) 867{ 868 var popup = null; 869 870 if (isset(obj)) 871 popup = obj.closest('.popup'); 872 else 873 popup = $('.popup'); 874 875 popup.fadeOut(400, function() { 876 if (!popup.data('hide')) 877 $(this).remove(); 878 879 if ($('.popup').length == 0) 880 $('.popup-overlay').hide(); 881 }); 882} 883 884FJ.prototype.popupInit = function() 885{ 886 $('.fj-catalog-compare').click(function(e) { 887 e.preventDefault(); 888 fjObj.showAjaxPopup($(this).attr('href')); 889 890 }) 891 892 $('.fj-popup-login-register').each(function() { 893 $(this).click(function(e) { 894 e.preventDefault(); 895 fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/users/login-register?type=popup'); 896 }); 897 }) 898 899 $('.fj-form-ask').click(function(e) { 900 e.preventDefault(); 901 fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/contacts/contact', 902 {type: 'popup'}, 903 { 904 set_position: 1, 905 set_position_top: 50 906 }); 907 }); 908 909 $('.fj-popup-newsletter').each(function() { 910 $(this).click(function(e) { 911 e.preventDefault(); 912 fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/forms/newsletter?type=popup'); 913 }); 914 }); 915 916 $('.fj-popup-search').each(function() { 917 $(this).click(function(e) { 918 e.preventDefault(); 919 fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/search?type=popup'); 920 }); 921 }) 922} 923 924 925FJ.prototype.ajaxContent = function(options) 926{ 927 $.ajax({ 928 type: 'GET', 929 url: options.url, 930 cache: false, 931 success: function(data) { 932 options.target.html(data); 933 } 934 }); 935} 936 937/** 938 * reikia siu bloku fj-ajax-container, fj-ajax-loader,fj-ajax-content 939 * 940 */ 941FJ.prototype.ajaxPost = function(options) 942{ 943 $(options.form).submit(function() { 944 var popup = $(options.form).parents('.fj-ajax-container'); 945 var loader = $(options.form).parents('.fj-ajax-container').find('.fj-ajax-loader'); 946 loader.fadeIn() 947 try { 948 $.ajax({ 949 type: 'POST', 950 url: $(this).attr('action'), 951 data: $(this).serialize() + "&" + options.submit, 952 dataType: 'json', 953 success: function(data) { 954 loader.hide(); 955 var parent = $(options.form).closest('.fj-ajax-content'); 956 var form = ''; 957 958 if (data.html.length > 0) 959 { 960 if ($(data['html']).length) 961 form = $(data['html']); 962 else 963 form = $('<p>').html(data['html']); 964 } 965 966 $(options.form).remove(); 967 parent.append(form); 968 form.find('.errors').fadeIn(); 969 fjObj.errorsInit(); 970 971 if (data['success']) 972 { 973 if (options.onSuccess) 974 options.onSuccess(data); 975 } 976 }, 977 cache: false 978 }); 979 } 980 catch (e) { 981 982 } 983 return false;
984 }) 985 986} 987 988/********************************* cart ***********************************/ 989FJ.prototype.cartAdd = function(obj, options) 990{ 991 if (!isset(options)) 992 options = {}; 993 if (options.animate != false) 994 obj.css({opacity: 0}).animate({opacity: 1}, 800) 995 996 $.ajax({ 997 type: 'POST', 998 url: '/' + $('html').attr('lang') + '/cart/add', 999 data: { 1000 id: obj.data('id'), 1001 quantity: obj.data('quantity'), 1002 change: obj.data('change'), 1003 options: obj.data('options') 1004 }, 1005 dataType: 'json', 1006 cache: false, 1007 success: function(data) { 1008 if (data && isset(data.result)) 1009 { 1010 if (isset(data.result.layout.amount)) 1011 fjObj.cartPlaceHolder(data.result.layout.amount); 1012 1013 if (isset(data.result.layout.content)) 1014 fjObj.cartLayoutContent({ 1015 html: data.result.layout.content 1016 }); 1017 1018 if (isset(data.result['recommended-quantity'])) 1019 options.input.val(roundDown(data.result['recommended-quantity'], 3)); 1020 1021 if (data.result.success) 1022 { 1023 if (obj.parent().find('.fj-cart-buy').css('display') == 'none') 1024 obj.parent().find('.fj-cart-buy').css({opacity: 0, display: 'inline-block'}).animate({opacity: 1}); 1025 1026 obj.closest('.fj-product-list-item').addClass('fj-in-cart'); 1027 } 1028 1029 if (data.result.max && obj.prop("tagName") == 'INPUT') 1030 { 1031 obj.val(parseFloat(data.result.quantity)).data('quantity', parseFloat(data.result.quantity)); 1032 } 1033 1034 if (data.result.shipment_price) 1035 { 1036 $('.fj-shipment-price').html(data.result.shipment_price); 1037 } 1038 1039 fjObj.cartItemTotal(obj); 1040 if (isset(data.result.popup)) 1041 fjObj.showPopup(data.result.popup, { 1042 fixedPosition: true 1043 }); 1044 } 1045 }, 1046 complete: function(jqXHR, textStatus) { 1047 if (options.animate != false) 1048 obj.stop(true, true).animate({opacity: 1}, 800); 1049 } 1050 }); 1051} 1052 1053FJ.prototype.cartAddCheckQuantity = function(obj, quantity, options) 1054{ 1055 options = $.extend({}, { 1056 showPopup: true 1057 }, options); 1058 if (!floatEq(quantity, Math.round(quantity / obj.data('step')) * obj.data('step'))) 1059 { 1060 var val = parseFloat((Math.ceil(quantity / obj.data('step')) * obj.data('step')).toFixed(6)); 1061 fjObj.showPopup(arrayReplace(messagesPopup.addCartRecomendedQuantity.html, { 1062 "'%quantity%'": val, 1063 "'%measure%'": obj.data('measure') 1064 })); 1065 return false; 1066 } 1067 1068 return true; 1069} 1070 1071FJ.prototype.cartRemoveItemInit = function(obj) 1072{ 1073 obj.click(function() { 1074 fjObj.cartRemoveItem($(this)); 1075 }); 1076} 1077 1078FJ.prototype.cartRemoveItem = function(obj) 1079{ 1080 1081 var current_obj = obj; 1082 fjObj.showPopup(_messages.cartRemove.html, { 1083 buttons: { 1084 ok: { 1085 selector: '.fj-button-ok', 1086 callback: function() { 1087 $.ajax({ 1088 type: 'GET', 1089 url: '/' + $('html').attr('lang') + "/cart/remove", 1090 data: { 1091 id: current_obj.parents('.fj-cart-item').data('id') 1092 }, 1093 dataType: 'json', 1094 success: function(data) { 1095 if (data) 1096 { 1097 if (isset(data.result.layout.amount)) 1098 fjObj.cartPlaceHolder(data.result.layout.amount); 1099 if (isset(data.result.layout.content)) 1100 fjObj.cartLayoutContent({ 1101 html: data.result.layout.content 1102 }); 1103 var table = current_obj.closest('.fj-cart-items'); 1104 if (data['result']['success']) 1105 { 1106 $('.fj-cart-item[data-id=' + current_obj.parents('.fj-cart-item').data('id') + ']').fadeOut(function() { 1107 $(this).remove(); 1108 if (table.find('.fj-cart-item').length == 0) 1109 { 1110 table.fadeOut(); 1111 $('input[name="cartSubmit"]').fadeOut(); 1112 } 1113 1114 if (data.result.shipment_price) 1115 { 1116 $('.fj-shipment-price').html(data.result.shipment_price); 1117 } 1118 1119 fjObj.cartItemTotal(obj); 1120 fjProject.cartTotal(obj); 1121 }); 1122 } 1123 1124 1125 } 1126 }, 1127 cache: false 1128 }); 1129 fjObj.closePopup(); 1130 } 1131 }, 1132 cancel: { 1133 selector: '.fj-button-cancel', 1134 callback: function() { 1135 fjObj.closePopup(); 1136 } 1137 } 1138 }, 1139 fixedPosition: true 1140 }); 1141} 1142 1143FJ.prototype.cartRemoveHistory = function(obj) 1144{ 1145 1146 try { 1147 var current_obj = obj; 1148 fjObj.showPopup(_messages.cartRemove.html, { 1149 buttons: { 1150 ok: { 1151 selector: '.fj-button-ok', 1152 callback: function() { 1153 $.ajax({ 1154 type: 'GET', 1155 url: '/' + $('html').attr('lang') + '/cart/order', 1156 data: { 1157 public_id: current_obj.closest('.fj-order-item').data('id'), 1158 act: 'remove' 1159 }, 1160 dataType: 'json', 1161 success: function(data) { 1162 if (data['success']) 1163 { 1164 current_obj.parents('.fj-order-item').fadeOut(function() { 1165 $(this).remove(); 1166 }); 1167 } 1168 }, 1169 cache: false 1170 }); 1171 fjObj.closePopup(); 1172 } 1173 }, 1174 cancel: { 1175 selector: '.fj-button-cancel', 1176 callback: function() { 1177 fjObj.closePopup(); 1178 } 1179 } 1180 }, 1181 fixedPosition: true 1182 }); 1183 } 1184 catch (e) { 1185 1186 } 1187} 1188 1189FJ.prototype.cartAddButtonsOptions = function(options) 1190{ 1191 var item_options = $('.fj-cart-add').data('options'); 1192 $.each(options, function(key, val) { 1193 if (!isset(item_options.key)) 1194 { 1195 item_options[key] = val 1196 } 1197 else { 1198 $.each(item_options[key], function(key1, val1) { 1199 item_options[key][key1] = val1; 1200 }); 1201 } 1202 }); 1203 $('.fj-cart-add').data('options', item_options); 1204} 1205 1206FJ.prototype.cartLayoutContent = function(options) 1207{ 1208 if (!isset(options)) 1209 options = {}; 1210 if (options.html) 1211 { 1212 $('.fj-cart-layout-content').html(options.html); 1213 } 1214 1215 $('.fj-cart-layout-content .fj-cart-item').each(function(key, val) { 1216 if (key < 5) 1217 $(this).fadeIn(); 1218 else 1219 $(this).hide(); 1220 }); 1221 fjObj.cartRemoveItemInit($('.fj-cart-layout-content .fj-cart-remove')); 1222 // cart layout content'o kontroles buttonas 1223 if ($('.fj-cart-layout-content .fj-cart-item').length) 1224 $('.fj-cart-layout-control').fadeIn(); 1225 else 1226 { 1227 if (options.control_hide == true) 1228 $('.fj-cart-layout-control').hide(); 1229 else 1230 $('.fj-cart-layout-control').fadeOut(); 1231 } 1232} 1233 1234FJ.prototype.cartPlaceHolder = function(html) 1235{ 1236 $('.fj-cart-layout-amount').html(html); 1237 $('.fj-cart-layout-amount').hide(); 1238 $('.fj-cart-layout-amount').fadeIn(); 1239} 1240 1241FJ.prototype.cartParseQuantity = function(quantity) 1242{ 1243 quantity = parseFloat(quantity); 1244 if (isNaN(quantity) || quantity < 0) 1245 quantity = 0; 1246 if (quantity > 100000) 1247 quantity = 100000; 1248 return quantity; 1249}; 1250FJ.prototype.cartEdit = function(obj) 1251{ 1252 if (obj.val() == obj.data('quantity')) 1253 return; 1254 var quantity = fjObj.cartParseQuantity(obj.val()) 1255 1256 obj.val(quantity); 1257 obj.data('quantity', quantity); 1258 obj.data('options', { 1259 id: obj.closest('.fj-cart-item').data('id'), 1260 type: obj.data('type') 1261 }); 1262 fjObj.cartAdd(obj, {animate: false}); 1263 fjObj.cartItemTotal(obj, {loader: true}); 1264}; 1265FJ.prototype.cartEditSilent = function(obj) 1266{ 1267 var quantity = fjObj.cartParseQuantity(obj.val()) 1268 1269 obj.val(quantity); 1270 fjObj.cartItemTotal(obj, {loader: true}); 1271 if (obj.data('timer')) 1272 clearTimeout(obj.data('timer')); 1273 obj.data('timer', setTimeout(function() { 1274 fjObj.cartEdit(obj); 1275 }, 1000)); 1276}; 1277FJ.prototype.cartItemTotal = function(obj, options) 1278{ 1279 if (!isset(options)) 1280 options = {}; 1281 var item = obj.closest('.fj-cart-item'); 1282 if (item.length) 1283 { 1284 item.find('.fj-cart-item-total').html(item.find('.fj-cart-item-price').asNumber({regi
1284on: currencyRegion}) * obj.val()).formatCurrency({ 1285 region: currencyRegion 1286 }); 1287 } 1288 1289 fjObj.cartTotal(obj.closest('.fj-cart-items'), options); 1290}; 1291FJ.prototype.cartTotal = function(obj, options) 1292{ 1293 if (!$('.fj-cart-total').length) 1294 return; 1295 if (!isset(options)) 1296 options = {}; 1297 var obj = $('.fj-cart-total').closest('.fj-cart-items'); 1298 var total = 0; 1299 obj.find('.fj-cart-item').each(function() { 1300 total += $(this).find('.fj-cart-item-price').asNumber({region: currencyRegion}) * $(this).find('.fj-cart-item-quantity').val(); 1301 }); 1302 var shipment_price = obj.find('.fj-shipment-price'); 1303 if (shipment_price.length) 1304 { 1305 total += shipment_price.asNumber({region: currencyRegion}); 1306 } 1307 1308 if (options.loader) 1309 { 1310 obj.find('.fj-cart-total').html(_messages.cartLoader); 1311 obj.find('.fj-shipment-price').html(_messages.cartLoader); 1312 } 1313 else 1314 obj.find('.fj-cart-total').html(total).formatCurrency({ 1315 region: currencyRegion 1316 }); 1317}; 1318FJ.prototype.cartInit = function() 1319{ 1320 fjObj.cartTotal($('.fj-cart-items')); 1321 $('.fj-cart-items .fj-cart-item-quantity').each(function() { 1322 $(this).blur(function() { 1323 fjObj.cartEdit($(this)); 1324 }).keyup(function(e) { 1325 var arrs = {38: 'up', 40: 'down', 9: 'tab'}; 1326 if (arrs[e.keyCode]) 1327 return; 1328 fjObj.cartEditSilent($(this)); 1329 }).autoNumeric({ 1330 aSep: '', 1331 vMin: 0, 1332 vMax: '99999999999999999999.999999', 1333 aPad: false 1334 }).jStepper({ 1335 decimalSeparator: ".", 1336 minValue: 0, 1337 maxValue: $(this).data('max') == -1 ? null : $(this).data('max'), 1338 allowDecimals: false, 1339 normalStep: $(this).data('step'), 1340 onStep: function(obj, bDirection) { 1341 fjObj.cartEditSilent(obj); 1342 } 1343 }); 1344 }); 1345 fjObj.cartRemoveItemInit($('.fj-cart-items .fj-cart-item-remove')); 1346}; 1347/***************************************************************************/ 1348 1349/**************** select blok'ui ***********************/ 1350FJ.prototype.initSelect = function(obj) 1351{ 1352 fjObj.initSelectSpanClick(obj.find('.select span')); 1353 fjObj.initSelectLiClick(obj.find('.select li')); 1354 fjObj.initSelectMultipleClick(obj.find('.select[data-select-type="multiple"] input[type="checkbox"]')); 1355//fjObj.selectCurrentItem(obj.find('input[type=hidden]:first')); 1356} 1357 1358FJ.prototype.initSelectSpanClick = function(obj) 1359{ 1360 obj.click(function() { 1361 if ($(this).parent().find('ul').is(':visible') == false) { 1362 if (!isset($(this).parent().attr('disabled'))) 1363 $(this).parent().find('ul').show(); 1364 } else { 1365 $(this).parent().find('ul').hide(); 1366 } 1367 }); 1368 obj.parents('.select').mouseleave(function() { 1369 if ($(this).data('selectType') == 'multiple' && $(this).find('ul').css('display') == 'block' && obj.parents('.select').data('changed') == 1) 1370 { 1371 obj.parents('.select').data('changed', 0); 1372 fjObj.selectExecFunc(obj); 1373 } 1374 1375 $(this).find('ul').hide(); 1376 }); 1377} 1378 1379FJ.prototype.initSelectLiClick = function(obj) 1380{ 1381 obj.click(function() { 1382 var select = $(this).parents('.select'); 1383 if (select.data('selectType') == 'multiple') 1384 return; 1385 select.find('.active').removeClass('active'); 1386 var clone = $(this).clone(); 1387 var title = clone.find('input').remove().end().html(); 1388 $(this).addClass('active').parents('.select').find('.selected span').html(title); 1389 select.find('ul').hide(); 1390 var block = $(this).parents('.select'); 1391 var input = ''; 1392 if (block.data('targetInput')) 1393 input = block.parents('.select-block').find('#' + block.data('targetInput')) 1394 1395 if (block.data('targetInputName')) 1396 input = block.parents('.select-block').find('input[name=' + block.data('targetInputName') + ']') 1397 1398 if (input == '') 1399 { 1400 input = block.parents('.select-block').find('input[type=hidden]'); 1401 } 1402 1403 if (block.data('targetType') == 'date') 1404 { 1405 input.val(fjObj.parseDateValue(block.parents('.select-block').find('.year li.active').attr('data-id')) + '-' + fjObj.parseDateValue(block.parents('.select-block').find('.month li.active').attr('data-id')) + '-' + fjObj.parseDateValue(block.parents('.select-block').find('.day li.active').attr('data-id'))); 1406 fjObj.selectCurrentDateItem(input); 1407 } 1408 else 1409 input.val($(this).data('id')); 1410 fjObj.selectExecFunc(input); 1411 }); 1412} 1413 1414FJ.prototype.initSelectMultipleClick = function(obj) 1415{ 1416 obj.each(function() { 1417 1418 var select = $(this).parents('.select'); 1419 var clone = $(this).parents('li').clone(); 1420 if (select.data('selectType') != 'multiple') 1421 return; 1422 if ($(this).is(':checked')) 1423 { 1424 $(this).parents('li').addClass('active') 1425 } 1426 1427 $(this).click(function() { 1428 if ($(this).is(':checked')) 1429 { 1430 $(this).parents('li').addClass('active') 1431 1432 if ($(this).data('all') == '1') 1433 { 1434 select.find('.select-item input').attr('checked', 'checked'); 1435 select.find('.select-item').addClass('active') 1436 } 1437 } 1438 else 1439 { 1440 $(this).parents('li').removeClass('active'); 1441 if ($(this).data('all') == '1') 1442 { 1443 select.find('.select-item input').removeAttr('checked'); 1444 select.find('.select-item').removeClass('active') 1445 } 1446 else 1447 { 1448 var item_all = select.find('.select-item input[data-all="1"]'); 1449 if (item_all.length) 1450 { 1451 item_all.removeAttr('checked'); 1452 item_all.parents('.select-item').removeClass('active'); 1453 } 1454 } 1455 } 1456 1457 1458 1459 select.data('changed', 1); 1460 fjObj.setSelectMultipleTitle($(this)); 1461 }) 1462 1463 1464 1465 }); 1466} 1467 1468FJ.prototype.setSelectMultipleTitle = function(obj) 1469{ 1470 var select = obj.parents('.select-block').find('.select'); 1471 var selected_span = obj.parents('.select-block').find('.selected span'); 1472 var title = ''; 1473 select.find('li').each(function() { 1474 if ($(this).find('input').is(':checked')) 1475 { 1476 // jei pazymim kad visos kategorijos 1477 if ($(this).find('input').data('all') == '1') 1478 { 1479 title = $(this).find('input').attr('title'); 1480 return false;
1481 } 1482 1483 title += (title.length == 0 ? '' : ', ') + $(this).find('input').attr('title'); 1484 } 1485 }); 1486 if (title.length > 0) 1487 { 1488 if (title.length > 27) 1489 selected_span.html(title.substring(0, 27) + '...'); 1490 else 1491 selected_span.html(title); 1492 selected_span.attr('title', title); 1493 } 1494 else 1495 { 1496 selected_span.html(select.data('empty')); 1497 } 1498} 1499 1500/** 1501 * obj - li active elementas 1502 * 1503 **/ 1504FJ.prototype.selectExecFunc = function(obj) 1505{ 1506 var block = obj.parents('.select-block').find('.select'); 1507 if (block.data('func')) 1508 { 1509 1510 if (window[block.data('func')]) 1511 { 1512 window[block.data('func')](obj); 1513 } 1514 } 1515 1516 if (block.data('targetAjax')) 1517 { 1518 $.getJSON( 1519 block.data('targetAjax'), 1520 { 1521 pid: $(this).data('id') 1522 }, 1523 function(data) { 1524 var select = block.parents('form').find('#' + block.data('targetSelect')); 1525 select.find('.selected span').html(''); 1526 select.find('ul').remove(); 1527 if (data) 1528 { 1529 select.append('<ul></ul>'); 1530 var select_ul = select.find('ul'); 1531 $.each(data, function(key, val) { 1532 select_ul.append('<li data-id="' + key + '">' + val + '</li>'); 1533 }); 1534 fjObj.initSelectLiClick(select.find('li')); 1535 } 1536 1537 if (select.data('targetInput')) 1538 { 1539 select.parent().find('#' + select.data('targetInput')).val(''); 1540 fjObj.selectCurrentItem($('#' + select.data('targetInput'))); 1541 } 1542 }); 1543 } 1544 1545} 1546 1547/** 1548 * obj - hidden elementas 1549 * 1550 **/ 1551FJ.prototype.selectCurrentItem = function(obj) 1552{ 1553 1554 obj.each(function() { 1555 var select = $(this).parents('.select-block').find('.select'); 1556 var item = $(this).parents('.select-block').find('li[data-id=' + $(this).val() + ']'); 1557 if (select.data('selectType') == 'multiple') 1558 { 1559 fjObj.setSelectMultipleTitle($(this)); 1560 } 1561 else { 1562 if ($(this).val() && $(this).val() != 0 && item.length) 1563 { 1564 item.addClass('active'); 1565 $(this).parents('.select-block').find('.selected span').html(item.html()); 1566 } 1567 else 1568 { 1569 $(this).parents('.select-block').find('.selected span').html($(this).parents('.select-block').find('.select').data('empty')); 1570 $(this).val(''); 1571 } 1572 } 1573 }) 1574 1575} 1576 1577FJ.prototype.selectCurrentDateItem = function(obj) 1578{ 1579 var date = ''; 1580 if (isset(obj.val())) 1581 date = obj.val().split('-'); 1582 var y = 0, m = 0, d = 0; 1583 if (isset(date[0])) 1584 y = date[0]; 1585 fjObj.selectCurrentDateItemElement(obj, '.year', y); 1586 if (isset(date[1])) 1587 m = date[1]; 1588 fjObj.selectCurrentDateItemElement(obj, '.month', m); 1589 fjObj.selectCurrentDateFillDays(obj); 1590 if (isset(date[2])) 1591 m = date[2]; 1592 fjObj.selectCurrentDateItemElement(obj, '.day', m); 1593} 1594 1595FJ.prototype.selectCurrentDateItemElement = function(obj, selector, val) 1596{ 1597 var item = obj.parents('.select-block').find(selector + ' li[data-id=' + val + ']'); 1598 if (item.length) 1599 { 1600 item.addClass('active'); 1601 obj.parents('.select-block').find(selector + ' .selected span').html(item.html()); 1602 } 1603 else 1604 { 1605 obj.parents('.select-block').find(selector + ' li').removeClass('active'); 1606 obj.parents('.select-block').find(selector + ' .selected span').html(obj.parent().find(selector).data('empty')); 1607 } 1608 1609} 1610 1611FJ.prototype.selectCurrentDateFillDays = function(obj) 1612{ 1613 var active = obj.parents('.select-block').find('.month li.active'); 1614 obj.parents('.select-block').find('.day ul').remove(); 1615 if (active) 1616 { 1617 var days = fjObj.parseInt(active.data('days')); 1618 var y = obj.parents('.select-block').find('.year li.active'); 1619 if (y && active.data('id') == 2 && y.data('id') % 4 == 0) 1620 days = 29; 1621 obj.parents('.select-block').find('.day').append('<ul></ul>'); 1622 var days_ul = obj.parents('.select-block').find('.day ul'); 1623 for (var i = 1; i <= days; i++) 1624 { 1625 var val = i < 10 ? '0' + i : i; 1626 days_ul.append('<li data-id="' + val + '">' + val + '</li>') 1627 } 1628
1629 fjObj.initSelectLiClick(days_ul.find('li')); 1630 } 1631} 1632/***************************************************************************/ 1633 1634/******************************* KITA*********************************/ 1635FJ.prototype.addLabelInit = function(obj) 1636{ 1637 var label; 1638 obj.each(function() { 1639 if (isset($(this).attr('title')) && $(this).hasClass('add-label')) 1640 { 1641 if (!$(this).val().length) 1642 label = $('<span class="label-text">' + $(this).attr('title') + '</span>'); 1643 else 1644 label = $('<span class="label-text" style="display:none;">' + $(this).attr('title') + '</span>'); 1645 label.css({ 1646 'padding-top': obj.css('padding-top'), 1647 'padding-bottom': obj.css('padding-bottom'), 1648 'padding-left': obj.css('padding-left'), 1649 'padding-right': obj.css('padding-right'), 1650 'font-family': obj.css('font-family'), 1651 'font-size': obj.css('font-size'), 1652 'font-weight': obj.css('font-weight'), 1653 'font-style': obj.css('font-style'), 1654 'line-height': obj.css('height'), 1655 'height': obj.css('height'), 1656 'width': obj.css('width'), 1657 'overflow': 'hidden', 1658 'position': 'absolute' 1659 }).offset({ 1660 'top': 0 + 1, 1661 'left': 0 + 2 1662 }); 1663 $(this).parent().css('position', 'relative'); 1664 $(this).parent().append(label); 1665 $(this).parent().find('.label-text').click(function() { 1666 $(this).parent().find('input[type=text], input[type=password], textarea:first').focus(); 1667 }) 1668 1669 $(this).focusin(function() { 1670 $(this).parent().find('.label-text').addClass('active'); 1671 }).focusout(function() { 1672 $(this).parent().find('.label-text').removeClass('active'); 1673 }).keydown(function() { 1674 if ($(this).val() != '') 1675 $(this).parent().find('.label-text').hide(); 1676 else 1677 $(this).parent().find('.label-text').show(); 1678 }).keyup(function() { 1679 if ($(this).val() != '') 1680 $(this).parent().find('.label-text').hide(); 1681 else 1682 $(this).parent().find('.label-text').show(); 1683 }); 1684 } 1685 1686 1687 }); 1688} 1689 1690FJ.prototype.initToolTip = function(obj) 1691{ 1692 obj.each(function() { 1693 $(this).cluetip({ 1694 showTitle: false, 1695 splitTitle: '|', 1696 arrows: true, 1697 dropShadow: false, 1698 cluetipClass: 'jtip', 1699 positionBy: 'topBottom', 1700 cursor: 'pointer', 1701 cluezIndex: 10000 1702 }); 1703 }); 1704} 1705 1706FJ.prototype.imgSlide = function(obj) 1707{ 1708 $(obj).slides({ 1709 }); 1710} 1711 1712FJ.prototype.owexxHover = function() 1713{ 1714 $('.fj-owexx-footer').each(function() { 1715 $(this).find('img').data('src', $(this).find('img').attr('src')); 1716 $(this).hover(function() { 1717 $(this).find('img').attr('src', $(this).find('img').attr('rev')); 1718 }, function() { 1719 $(this).find('img').attr('src', $(this).find('img').data('src')); 1720 }); 1721 }) 1722} 1723 1724FJ.prototype.imposeMaxLength = function(obj, MaxLen) 1725{ 1726 return (obj.value.length <= MaxLen); 1727} 1728 1729/** 1730 * <ul class="product-nav fj-tabs" id="product-tabs"> 1731 * <li><a href="#info" id="info" ></a></li> 1732 * 1733 * <div class="article fj-tab-content" rel="info" data-parent="product-tabs"> 1734 * 1735 * id="product-tabs" -> data-parent="product-tabs 1736 * id="info" -> rel="info" 1737 */ 1738FJ.prototype.activeTab = function(obj) 1739{ 1740 obj.parents('.fj-tabs').find('li a').removeClass('active'); 1741 obj.addClass('active'); 1742 $('.fj-tab-content[data-parent="' + obj.parents('.fj-tabs').attr('id') + '"]').hide(); 1743 $('.fj-tab-content[rel="' + obj.attr('id') + '"]').fadeIn(600); 1744} 1745 1746FJ.prototype.addToFavorite = function(obj) 1747{ 1748 try 1749 { 1750 obj.fadeOut(function() { 1751 $(this).fadeIn(); 1752 }); 1753 $.ajax({ 1754 type: 'GET', 1755 url: obj.data('href'), 1756 dataType: 'json', 1757 success: function(data) { 1758 if (data['success']) 1759 { 1760 if ($('.fj-catalog-favorite-count').find('.fj-count').lenght) 1761 $('.fj-catalog-favorite-count').find('.fj-count').html(data.count) 1762 else 1763 $('.fj-catalog-favorite-count').html(data.count); 1764 } 1765 }, 1766 complete: function(jqXHR, textStatus) { 1767 }, 1768 cache: false 1769 }); 1770 } 1771 catch (e) { 1772 1773 } 1774 1775} 1776 1777FJ.prototype.catalogRemoveFavorite = function(obj) 1778{ 1779 try { 1780 var current_obj = obj; 1781 fjObj.showPopup(_messages.cartRemove.html, { 1782 buttons: { 1783 ok: { 1784 selector: '.fj-button-ok', 1785 callback: function() { 1786 $.ajax({ 1787 type: 'GET', 1788 url: current_obj.data('href'), 1789 dataType: 'json', 1790 success: function(data) { 1791 if (data['success']) 1792 { 1793 current_obj.parents('.fj-catalog-favorite-item').fadeOut(function() { 1794 $(this).remove(); 1795 }); 1796 1797 if ($('.fj-catalog-favorite-count').find('.fj-count').lenght) 1798 $('.fj-catalog-favorite-count').find('.fj-count').html(data.count) 1799 else 1800 $('.fj-catalog-favorite-count').html(data.count); 1801 } 1802 }, 1803 cache: false 1804 }); 1805 fjObj.closePopup(); 1806 } 1807 }, 1808 cancel: { 1809 selector: '.fj-button-cancel', 1810 callback: function() { 1811 fjObj.closePopup(); 1812 } 1813 } 1814 }, 1815 fixedPosition: true 1816 }); 1817 } 1818 catch (e) { 1819 1820 } 1821} 1822 1823FJ.prototype.catalogRemoveHistory = function(obj) 1824{ 1825 try { 1826 var current_obj = obj; 1827 fjObj.showPopup(_messages.cartRemove.html, { 1828 buttons: { 1829 ok: { 1830 selector: '.fj-button-ok', 1831 callback: function() { 1832 $.ajax({ 1833 type: 'GET', 1834 url: current_obj.data('href'), 1835 dataType: 'json', 1836 success: function(data) { 1837 if (data['success']) 1838 { 1839 current_obj.parents('.fj-catalog-history-item').fadeOut(function() { 1840 $(this).remove(); 1841 }); 1842 1843 if ($('.fj-catalog-history-count').find('.fj-count').lenght) 1844 $('.fj-catalog-history-count').find('.fj-count').html(data.count) 1845 else 1846 $('.fj-catalog-history-count').html(data.count); 1847 } 1848 }, 1849 cache: false 1850 }); 1851 fjObj.closePopup(); 1852 } 1853 }, 1854 cancel: { 1855 selector: '.fj-button-cancel', 1856 callback: function() { 1857 fjObj.closePopup(); 1858 } 1859 } 1860 }, 1861 fixedPosition: true 1862 }); 1863 } 1864 catch (e) { 1865 1866 } 1867 1868} 1869 1870FJ.prototype.addCompare = function(obj) 1871{ 1872 try 1873 { 1874 if (obj.data('isCompared')) 1875 { 1876 fjObj.showAjaxPopup('/' + $('html').attr('lang') + '/catalog/view-compare/', null, {set_position: 1, set_position_top: 30}); 1877 return; 1878 } 1879 1880 obj.fadeOut(function() { 1881 obj.text(obj.data('titleAlt')); 1882 obj.data('isCompared', 1); 1883 $(this).fadeIn(); 1884 }); 1885 1886 $.ajax({ 1887 type: 'GET', 1888 url: obj.data('href'), 1889 dataType: 'json', 1890 success: function(data) { 1891 if (data['success']) 1892 if ($('.fj-catalog-compare-count').find('.fj-count').lenght) 1893 $('.fj-catalog-compare-count').find('.fj-count').html(data.count) 1894 else 1895 $('.fj-catalog-compare-count').html(data.count); 1896 ; 1897 }, 1898 complete: function(jqXHR, textStatus) { 1899 }, 1900 cache: false 1901 }); 1902 } 1903 catch (e) { 1904 1905 } 1906 1907} 1908 1909FJ.prototype.catalogRemoveCompare = function(obj) 1910{ 1911 try { 1912 var current_obj = obj; 1913 var id = current_obj.closest('.fj-compare-item').data('id'); 1914 fjObj.showPopup(_messages.cartRemove.html, { 1915 notClearPopups: true, 1916 buttons: { 1917 ok: { 1918 selector: '.fj-button-ok', 1919 callback: function() { 1920 $.ajax({ 1921 type: 'GET', 1922 url: '/' + $('html').attr('lang') + '/catalog/remove-compare/' + id, 1923 dataType: 'json', 1924 success: function(data) { 1925 if (data['success']) 1926 { 1927 current_obj.closest('.fj-compare-container').find('.fj-compare-item[data-id="' + id + '"]').fadeOut(function() { 1928 $(this).remove(); 1929 }); 1930 1931 if ($('.fj-catalog-compare-count').find('.fj-count').lenght) 1932 $('.fj-catalog-compare-count').find('.fj-count').html(data.count) 1933 else 1934 $('.fj-catalog-compare-count').html(data.count); 1935 } 1936 }, 1937 cache: false 1938 }); 1939 fjObj.closePopup($(this)); 1940 } 1941 }, 1942 cancel: { 1943 selector: '.fj-button-cancel', 1944 callback: function() { 1945 fjObj.closePopup($(this)); 1946 } 1947 } 1948 }, 1949 fixedPosition: true 1950 }); 1951 } 1952 catch (e) { 1953 1954 } 1955 1956} 1957 1958FJ.prototype.catalogToggleFilter = function(options) 1959{ 1960 try 1961 { 1962 $.ajax({ 1963 type: 'GET', 1964 url: '/catalog/toggle-filter', 1965 data: options.data, 1966 dataType: 'json', 1967 success: function(data) { 1968 if (data['success']) 1969 ; 1970 }, 1971 complete: function(jqXHR, textStatus) { 1972 }, 1973 cache: false 1974 }); 1975 } 1976 catch (e) { 1977 1978 } 1979 1980} 1981 1982FJ.prototype.backToTopInit = function(obj, options) 1983{ 1984 if (!isset(options)) 1985 options = {}; 1986 obj.click(function() { 1987 $(window).scrollTo(options.target, 300, { 1988 // offset:-50 1989 }); 1990 }) 1991 1992 $(window).scroll(function() { 1993 if ($(window).scrollTop() > 0) 1994 { 1995 if (fjObj.is_scrool_top) 1996 obj.stop(true, true).fadeIn(); 1997 fjObj.is_scrool_top = false;
1998 } 1999 else 2000 { 2001 if (!fjObj.is_scrool_top) 2002 obj.stop(true, true).fadeOut(); 2003 fjObj.is_scrool_top = true; 2004 } 2005 }); 2006} 2007 2008FJ.prototype.blockSwicher = function(obj, options) 2009{ 2010 if (obj.data('switch') && obj.data('parent')) 2011 { 2012 $(obj.data('parent')).hide(); 2013 $(obj.data('switch')).fadeIn(); 2014 } 2015} 2016 2017/******************************* USER PLACE HOLDER (ajax login) *********************************/ 2018FJ.prototype.userPlaceHolder = function(html) 2019{ 2020 $('.fj-user-place').hide(); 2021 $('.fj-user-place').html(html); 2022 $('.fj-user-place').fadeIn(); 2023 2024 fjObj.menuInit($('.fj-user-place .fj-menu-open')); 2025 2026}; 2027 2028/******************************* USERS FORM **************************************/ 2029FJ.prototype.usersLoginRemindChange = function(obj) 2030{ 2031 if (obj.hasClass('fj-login-remind')) 2032 { 2033 $('.fj-form-login-bock').hide(); 2034 $('.fj-form-remind-bock').fadeIn(); 2035 } 2036 else 2037 { 2038 $('.fj-form-remind-bock').hide(); 2039 $('.fj-form-login-bock').fadeIn(); 2040 } 2041 2042} 2043 2044/******************************* MENU FADE **************************************/ 2045FJ.prototype.menuInit = function(obj) 2046{ 2047 2048 if (!isset(obj)) 2049 obj = $('.fj-menu-open'); 2050 2051 2052 2053 $('.fj-menu').bind('click', function(e) { 2054 e.stopPropagation(); 2055 }); 2056 2057 2058 2059 obj.each(function() { 2060 2061 var submenu = $(this).closest('.fj-menu').find('.fj-submenu'); 2062 2063 if (!submenu.length) 2064 return; 2065 2066 $(this).click(function(e) { 2067 e.preventDefault(); 2068 2069 if ($(this).data('fade')) 2070 $(this).stop(true, true).fadeOut(); 2071 2072 submenu.stop(true, true).fadeIn(); 2073 }); 2074 2075 submenu.find('.fj-menu-close').each(function() { 2076 $(this).click(function(e) { 2077 e.preventDefault(); 2078 fjObj.menuClose($(this)); 2079 }); 2080 }); 2081 2082 submenu.hover(function() { 2083 if (isset(submenu.data('isHover'))) 2084 $(this).stop(true, true).fadeIn(); 2085 $(this).data('isHover', 1); 2086 2087 if (isset(submenu.data('timer'))) 2088 clearTimeout(submenu.data('timer')); 2089 }, function() { 2090 $(this).data('isHover', 0); 2091 $(this).data('timer', 2092 setTimeout(function() { 2093 if (!submenu.data('isHover')) 2094 fjObj.menuClose(submenu); 2095 }, 1000)); 2096 }); 2097 2098 $('body').click(function() { 2099 fjObj.menuClose(submenu); 2100 }); 2101 2102 2103 }); 2104} 2105 2106FJ.prototype.menuClose = function(obj) 2107{ 2108 var submenu = obj.closest('.fj-menu').find('.fj-submenu'); 2109 2110 submenu.fadeOut(200, function() { 2111 submenu.removeData('isHover'); 2112 }); 2113 2114 var menu_open = obj.closest('.fj-menu').find('.fj-menu-open'); 2115 if (menu_open.data('fade')) 2116 menu_open.stop(true, true).fadeIn(); 2117} 2118 2119/************************* SKYPE ******************************************/ 2120FJ.prototype.skypeInit = function() 2121{ 2122 $('.fj-skype').each(function() { 2123 var obj = $(this); 2124 2125 if (!obj.data('skypeName')) 2126 return; 2127 2128 $.ajax({ 2129 url: 'http://www.owexx.com/skype.php', 2130 cache: false, 2131 dataType: 'jsonp', 2132 data: { 2133 name: obj.data('skypeName') 2134 }, 2135 success: function(data) { 2136 if (data.status == 2) { 2137 obj.addClass('active'); 2138 } 2139 } 2140 }); 2141 }) 2142} 2143 2144/************************* LIVE CHAT ******************************************/ 2145FJ.prototype.initLiveChat = function(options) 2146{ 2147 var live_chat = $(options.link.selector); 2148 2149 if (live_chat.length > 0 && !live_chat.data('changed')) 2150 { 2151 live_chat.each(function() { 2152 if (!$(this).data('changed')) 2153 { 2154 if ($(this).hasClass('offline')) 2155 { 2156 $(this).html(options.link.title.offline) 2157 2158 if (options.link.onclick.offline) 2159 { 2160 $(this).click(options.link.onclick.offline); 2161 } 2162 } 2163 else 2164 { 2165 $(this).html(options.link.title.online) 2166 } 2167 $(this).data('changed', 1); 2168 } 2169 }) 2170 } 2171 else 2172 { 2173 setTimeout(function() { 2174 fjObj.initLiveChat(options); 2175 }, 100); 2176 } 2177 2178} 2179/************************* OTHER ******************************************/ 2180FJ.prototype.errorsInit = function() 2181{ 2182 var error = $('.errors'); 2183 var target = error; 2184 var offset = -50; 2185 2186 if (error.parent().children('label').size()) 2187 { 2188 target = error.parent().find('label'); 2189 offset = 0; 2190 } 2191 2192 if (target.size()) 2193 $(window).scrollTo(target, 700, { 2194 offset: offset 2195 }); 2196} 2197 2198/************************* IMAGE MANAGER ******************************************/ 2199FJ.prototype.imageManager = function(obj) 2200{ 2201 $.ajax({ 2202 type: 'POST', 2203 url: obj.closest('.fj-im-cotrol').data('url'), 2204 data: { 2205 act: obj.data('act') 2206 }, 2207 cache: false, 2208 success: function(data) { 2209 if (data.success) 2210 { 2211 switch (obj.data('act')) 2212 { 2213 case 'delete': 2214 obj.closest('.fj-im-list-item').fadeOut(function() { 2215 $(this).remove(); 2216 }); 2217 break; 2218 case 'move-up': 2219 var item = obj.closest('.fj-im-list-item'); 2220 var target = item.prev(); 2221 if (target.length) 2222 { 2223 target.before(item); 2224 } 2225 break; 2226 case 'move-down': 2227 var item = obj.closest('.fj-im-list-item'); 2228 var target = item.next(); 2229 if (target.length) 2230 { 2231 target.after(item); 2232 } 2233 break; 2234 case 'spin': 2235 var img = obj.closest('.fj-im-list-item').find('.fj-im-img'); 2236 img.attr('src', data.thumbnail_url).parent().attr('url', data.url); 2237 break; 2238 } 2239 } 2240 } 2241 2242 }); 2243} 2244 2245/************************* VIDEO MANAGER ******************************************/ 2246FJ.prototype.videoManager = function(obj) 2247{ 2248 $.ajax({ 2249 type: 'POST', 2250 url: obj.closest('.fj-vm-cotrol').data('url'), 2251 data: { 2252 act: obj.data('act') 2253 }, 2254 cache: false, 2255 success: function(data) { 2256 if (data.success) 2257 { 2258 switch (obj.data('act')) 2259 { 2260 case 'delete': 2261 obj.closest('.fj-vm-list-item').fadeOut(function() { 2262 $(this).remove(); 2263 }); 2264 break; 2265 case 'move-up': 2266 var item = obj.closest('.fj-vm-list-item'); 2267 var target = item.prev(); 2268 if (target.length) 2269 { 2270 target.before(item); 2271 } 2272 break; 2273 case 'move-down': 2274 var item = obj.closest('.fj-vm-list-item'); 2275 var target = item.next(); 2276 if (target.length) 2277 { 2278 target.after(item); 2279 } 2280 break; 2281 } 2282 } 2283 } 2284 2285 }); 2286} 2287 2288/************************* FUNCTIONS ******************************************/ 2289 2290FJ.prototype.parseInt = function(val) 2291{ 2292 val = parseInt(val); 2293 if (isNaN(val)) 2294 val = 0; 2295 2296 return val; 2297} 2298 2299FJ.prototype.parseFloat = function(val) 2300{ 2301 val = parseFloat(val); 2302 if (isNaN(val)) 2303 val = 0; 2304 2305 return val; 2306} 2307 2308FJ.prototype.parseDateValue = function(val) 2309{ 2310 if (isset(val)) 2311 return val; 2312 else 2313 return ''; 2314} 2315 2316 2317FJ.prototype.serviceInit = function(obj) 2318{
2319 $('.fj-service-settings-elem').change(function() { 2320 var fj_service_item = $(this).closest('.fj-service-item'); 2321 var fj_service_container = $(this).closest('.fj-service-container'); 2322 2323 fjObj.serviceCalculate(fj_service_item); 2324 fjObj.serviceCalculateTotal(fj_service_container); 2325 }); 2326 2327 2328 // sukalculuojam kaina po onLoado 2329 $('.fj-service-container').each(function() { 2330 var fj_service_container = $(this); 2331 $('.fj-service-item', fj_service_container).each(function() { 2332 var fj_service_item = $(this).closest('.fj-service-item'); 2333 fjObj.serviceCalculate(fj_service_item); 2334 }); 2335 fjObj.serviceCalculateTotal(fj_service_container); 2336 }); 2337 2338} 2339 2340FJ.prototype.serviceCalculate = function(fj_service_item) 2341{ 2342 2343 var service = fj_service_item.data('fjServiceSettings'); 2344 var total = null; 2345 var total_price = 0; 2346 2347 fj_service_item.find('.fj-service-settings-elem').each(function() { 2348 2349 var setting = isset(service['settings'][$(this).val()]) ? service['settings'][$(this).val()] : null; 2350 if (setting) 2351 { 2352 if (total == null) 2353 total = fjObj.parseFloat(service.price); 2354 2355 if (isset(setting.price)) 2356 total_price += fjObj.parseFloat(setting.price); 2357 else if (isNumber(setting.value) && setting.setting_type == 'periods' || setting.setting_type == 'priorities') 2358 total *= fjObj.parseFloat(setting.value); 2359 } 2360 else if ($(this).data('fjSettingType') == 'periods' || $(this).data('fjSettingType') == 'priorities') 2361 total = 0; 2362 }); 2363 2364 if (total == null) 2365 total = 0; 2366 2367 total += total_price; 2368 2369 fj_service_item.find('.fj-service-item-total').data('fjTotal', total).html(total); 2370} 2371 2372FJ.prototype.serviceCalculateTotal = function(fj_service_container) 2373{ 2374 var total = 0; 2375 fj_service_container.find('.fj-service-item-total').each(function() { 2376 total += fjObj.parseFloat($(this).data('fjTotal')); 2377 }); 2378 2379 fj_service_container.find('.fj-service-total').html(total); 2380} 2381 2382FJ.prototype.getFirstDay = function(year, month) 2383{ 2384 var date = new Date(year, month, 1); 2385 return date.getDay(); 2386} 2387 2388FJ.prototype.getLastDay = function(year, month) 2389{ 2390 var date = new Date(year, month + 1, 0); 2391 return date.getDate(); 2392} 2393 2394 2395function isset(variable) { 2396 return typeof(variable) != "undefined" && variable !== null; 2397} 2398 2399function isNumber(n) { 2400 return !isNaN(parseFloat(n)) && isFinite(n); 2401} 2402 2403function floatEq(var1, var2) 2404{ 2405 if (Math.abs(var1 - var2) < epsilon) 2406 return true; 2407 return false; 2408} 2409 2410function arrayReplace(variable, data) 2411{ 2412 $.each(data, function(key, val) { 2413 variable = variable.replace(key, val); 2414 }); 2415 return variable; 2416} 2417 2418function roundUp(rnum, rlength) { 2419 var newnumber = Math.ceil(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength); 2420 return newnumber; 2421} 2422 2423function roundDown(rnum, rlength) { 2424 var newnumber = Math.floor(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength); 2425 return newnumber; 2426} 2427/*****************************************************************************/ 2428 2429var epsilon = 0.0000001; 2430var fjObj = new FJ(); 2431$(function() { 2432// fjObj.initToolTip($('.tooltip')); 2433 2434 fjObj.menuInit(); 2435 fjObj.skypeInit(); 2436 fjObj.owexxHover(); 2437 $('.fj-popup-overlay').click(function() { 2438 fjObj.closePopup(); 2439 }); 2440 2441 if ($('.popup').length > 0) 2442 { 2443 fjObj.showPopup(null, { 2444 notClearPopups: 1, 2445 notClearPopupsMessage: 1 2446 }); 2447 } 2448 2449 fjObj.popupInit(); 2450 fjObj.errorsInit(); 2451 fjObj.cartRemoveItemInit($('.fj-cart-remove')); 2452 fjObj.cartLayoutContent({control_hide: true}); 2453});
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.