1/** 2* The MIT License (MIT) 3* 4* Copyright (c) 2015 Max Valiano | http://unitegallery.net 5* 6* Permission is hereby granted, free of charge, to any person 7* obtaining a copy of this software and associated documentation 8* files (the "Software"), to deal in the Software without 9* restriction, including without limitation the rights to use, 10* copy, modify, merge, publish, distribute, sublicense, and/or sell 11* copies of the Software, and to permit persons to whom the 12* Software is furnished to do so, subject to the following 13* conditions: 14* 15* The above copyright notice and this permission notice shall be 16* included in all copies or substantial portions of the Software. 17* 18* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25* OTHER DEALINGS IN THE SOFTWARE. 26* 27* @author Max Valiano 28* @copyright Copyright (c) 2017 Max Valiano | http://unitegallery.net 29* @license The MIT License (MIT) 30*/ 31 32/** 33 * thumbs class 34 * addon to strip gallery 35 */ 36function UGThumbsStrip(){ 37 38 var t = this; 39 var g_gallery = new UniteGalleryMain(), g_objGallery, g_objects, g_objWrapper; 40 var g_arrItems, g_objStrip, g_objStripInner; 41 var g_aviaControl, g_touchThumbsControl, g_functions = new UGFunctions(); 42 var g_isVertical = false, g_thumbs = new UGThumbsGeneral(); 43 var g_functions = new UGFunctions(); 44 45 var g_options = { 46 strip_vertical_type: false, 47 strip_thumbs_align: "left", //left, center, right, top, middle, bottom - the align of the thumbs when they smaller then the strip size. 48 strip_space_between_thumbs:6, //space between thumbs 49 strip_thumb_touch_sensetivity:15, //from 1-100, 1 - most sensetive, 100 - most unsensetive 50 strip_scroll_to_thumb_duration:500, //duration of scrolling to thumb 51 strip_scroll_to_thumb_easing:"easeOutCubic", //easing of scrolling to thumb animation 52 strip_control_avia:true, //avia control - move the strip according strip moseover position 53 strip_control_touch:true, //touch control - move the strip by dragging it 54 strip_padding_top: 0, //add some space from the top 55 strip_padding_bottom: 0, //add some space from the bottom 56 strip_padding_left: 0, //add some space from left 57 strip_padding_right: 0 //add some space from right 58 } 59 60 var g_temp = { 61 isRunOnce:false, 62 is_placed:false, 63 isNotFixedThumbs: false, 64 handle: null 65 }; 66 67 var g_sizes = { 68 stripSize:0, //set after position thumbs 69 stripActiveSize:0, //strip size without the padding 70 stripInnerSize:0, 71 thumbSize:0, 72 thumbSecondSize:0 //size of the height and width of the strip 73 } 74 75 this.events = { //events variables 76 STRIP_MOVE:"stripmove", 77 INNER_SIZE_CHANGE:"size_change" 78 } 79 80 //the defaults for vertical align 81 var g_defaultsVertical = { 82 strip_thumbs_align: "top", 83 thumb_resize_by: "width" 84 } 85 86 87 /** 88 * set the thumbs strip html 89 */ 90 this.setHtml = function(objParent){ 91 92 if(!objParent){ 93 var objParent = g_objWrapper; 94 if(g_options.parent_container != null) 95 objParent = g_options.parent_container; 96 } 97 98 objParent.append("<div class='ug-thumbs-strip'><div class='ug-thumbs-strip-inner'></div></div>"); 99 g_objStrip = objParent.children(".ug-thumbs-strip"); 100 101 g_objStripInner = g_objStrip.children(".ug-thumbs-strip-inner"); 102 103 //put the thumbs to inner strip 104 g_thumbs.setHtmlThumbs(g_objStripInner); 105 106 //hide thumbs on not fixed mode 107 if(g_temp.isNotFixedThumbs == true) 108 g_thumbs.hideThumbs(); 109 110 } 111 112 113 function ___________GENERAL___________(){}; 114 115 116 /** 117 * init the strip 118 */ 119 function initStrip(gallery, customOptions){ 120 121 g_objects = gallery.getObjects(); 122 g_gallery = gallery; 123 124 g_gallery.attachThumbsPanel("strip", t); 125 126 g_objGallery = jQuery(gallery); 127 g_objWrapper = g_objects.g_objWrapper; 128 g_arrItems = g_objects.g_arrItems; 129 130 g_options = jQuery.extend(g_options, customOptions); 131 g_isVertical = g_options.strip_vertical_type; 132 133 //set vertical defaults 134 if(g_isVertical == true){ 135 g_options = jQuery.extend(g_options, g_defaultsVertical); 136 g_options = jQuery.extend(g_options, customOptions); 137 138 customOptions.thumb_resize_by = "width"; 139 } 140 141 g_thumbs.init(gallery, customOptions); 142 143 onAfterSetOptions(); 144 } 145 146 147 /** 148 * run this funcion after set options. 149 */ 150 function onAfterSetOptions(){ 151 152 var thumbsOptions = g_thumbs.getOptions(); 153 154 g_temp.isNotFixedThumbs = (thumbsOptions.thumb_fixed_size === false); 155 g_isVertical = g_options.strip_vertical_type; 156 } 157 158 159 /** 160 * run the strip 161 */ 162 function runStrip(){ 163 164 g_thumbs.setHtmlProperties(); 165 166 initSizeParams(); 167 168 fixSize(); 169 170 positionThumbs(); 171 172 //run only once 173 if(g_temp.isRunOnce == false){ 174 175 //init thumbs strip touch 176 if(g_options.strip_control_touch == true){ 177 g_touchThumbsControl = new UGTouchThumbsControl(); 178 g_touchThumbsControl.init(t); 179 } 180 181 //init thumbs strip avia control 182 if(g_options.strip_control_avia == true){ 183 g_aviaControl = new UGAviaControl(); 184 g_aviaControl.init(t); 185 } 186 187 checkControlsEnableDisable(); 188 189 g_thumbs.loadThumbsImages(); 190 191 initEvents(); 192 } 193 194 195 g_temp.isRunOnce = true; 196 197 } 198 199 200 /** 201 * store strip size and strip active size in vars 202 * do after all strip size change 203 */ 204 function storeStripSize(size){ 205 206 g_sizes.stripSize = size; 207 208 if(g_isVertical == false) 209 g_sizes.stripActiveSize = g_sizes.stripSize - g_options.strip_padding_left - g_options.strip_padding_right; 210 else 211 g_sizes.stripActiveSize = g_sizes.stripSize - g_options.strip_padding_top - g_options.strip_padding_bottom; 212 213 if(g_sizes.stripActiveSize < 0) 214 g_sizes.stripActiveSize = 0; 215 216 } 217 218 219 /** 220 * init some size parameters, before size init and after position thumbs 221 */ 222 function initSizeParams(){ 223 224 //set thumb outer size: 225 var arrThumbs = g_objStripInner.children(".ug-thumb-wrapper"); 226 var firstThumb = jQuery(arrThumbs[0]); 227 var thumbsRealWidth = firstThumb.outerWidth(); 228 var thumbsRealHeight = firstThumb.outerHeight(); 229 var thumbs_options = g_thumbs.getOptions(); 230 231 if(g_isVertical == false){ //horizontal 232 233 g_sizes.thumbSize = thumbsRealWidth; 234 235 if(thumbs_options.thumb_fixed_size == true){ 236 g_sizes.thumbSecondSize = thumbsRealHeight; 237 } else { 238 g_sizes.thumbSecondSize = thumbs_options.thumb_height; 239 } 240 241 storeStripSize(g_objStrip.width()); 242 g_sizes.stripInnerSize = g_objStripInner.width(); 243 244 }else{ //vertical 245 g_sizes.thumbSize = thumbsRealHeight; 246 247 if(thumbs_options.thumb_fixed_size == true){ 248 g_sizes.thumbSecondSize = thumbsRealWidth; 249 } else { 250 g_sizes.thumbSecondSize = thumbs_options.thumb_width; 251 } 252 253 storeStripSize(g_objStrip.height()); 254 255 g_sizes.stripInnerSize = g_objStripInner.height(); 256 } 257 258 259 } 260 261 262 263 264 /** 265 * set size of inner strip according the orientation 266 */ 267 function setInnerStripSize(innerSize){ 268 269 if(g_isVertical == false) 270 g_objStripInner.width(innerSize); 271 else 272 g_objStripInner.height(innerSize); 273 274 g_sizes.stripInnerSize = innerSize; 275 276 checkControlsEnableDisable(); 277 278 jQuery(t).trigger(t.events.INNER_SIZE_CHANGE); 279 } 280 281 282 /** 283 * position thumbnails in the thumbs panel 284 */ 285 function positionThumbs(){ 286 287 var arrThumbs = g_objStripInner.children(".ug-thumb-wrapper"); 288 289 var posx = 0; 290 var posy = 0; 291 292 if(g_isVertical == false) 293 posy = g_options.strip_padding_top; 294 295 for (i = 0; i < arrThumbs.length; i++) { 296 297 var objThumb = jQuery(arrThumbs[i]); 298 299 //skip from placing if not loaded yet on non fixed mode 300 if(g_temp.isNotFixedThumbs == true){ 301 objItem = g_thumbs.getItemByThumb(objThumb); 302 if(objItem.isLoaded == false) 303 continue; 304 305 //the thumb is hidden if not placed 306 objThumb.show(); 307 } 308 309 g_functions.placeElement(objThumb, posx, posy); 310 311 if(g_isVertical == false) 312 posx += objThumb.outerWidth() + g_options.strip_space_between_thumbs; 313 else 314 posy += objThumb.outerHeight() + g_options.strip_space_between_thumbs; 315 } 316 317 //set strip size, width or height 318 if(g_isVertical == false) 319 var innerStripSize = posx - g_options.strip_space_between_thumbs; 320 else 321 var innerStripSize = posy - g_options.strip_space_between_thumbs; 322 323 setInnerStripSize(innerStripSize); 324 } 325 326 327 328 /** 329 * fix strip and inner size 330 */ 331 function fixSize(){ 332 333 if(g_isVertical == false){ //fix horizontal 334 335 var height = g_sizes.thumbSecondSize; 336 337 var objCssStrip = {}; 338 objCssStrip["height"] = height+"px"; 339 340 //set inner strip params 341 var objCssInner = {}; 342 objCssInner["height"] = height+"px"; 343 344 }else{ //fix vertical 345 346 var width = g_sizes.thumbSecondSize; 347 348 var objCssStrip = {};
349 objCssStrip["width"] = width+"px"; 350 351 //set inner strip params 352 var objCssInner = {}; 353 objCssInner["width"] = width+"px"; 354 355 } 356 357 g_objStrip.css(objCssStrip); 358 g_objStripInner.css(objCssInner); 359 } 360 361 362 363 /** 364 * scroll by some number 365 * . 366 */ 367 function scrollBy(scrollStep){ 368 369 var innerPos = t.getInnerStripPos(); 370 var finalPos = innerPos + scrollStep; 371 372 finalPos = t.fixInnerStripLimits(finalPos); 373 374 t.positionInnerStrip(finalPos, true); 375 } 376 377 378 /** 379 * scroll to thumb from min. (left or top) position 380 */ 381 function scrollToThumbMin(objThumb){ 382 383 var objThumbPos = getThumbPos(objThumb); 384 385 var scrollPos = objThumbPos.min * -1; 386 scrollPos = t.fixInnerStripLimits(scrollPos); 387 388 t.positionInnerStrip(scrollPos, true); 389 } 390 391 392 /** 393 * scroll to thumb from max. (right or bottom) position 394 */ 395 function scrollToThumbMax(objThumb){ 396 397 var objThumbPos = getThumbPos(objThumb); 398 399 var scrollPos = objThumbPos.max * -1 + g_sizes.stripSize; 400 scrollPos = t.fixInnerStripLimits(scrollPos); 401 402 t.positionInnerStrip(scrollPos, true); 403 } 404 405 406 /** 407 * scroll to some thumbnail 408 */ 409 function scrollToThumb(objThumb){ 410 411 if(isStripMovingEnabled() == false) 412 return(false); 413 414 var objBounds = getThumbsInsideBounds(); 415 416 var objThumbPos = getThumbPos(objThumb); 417 418 if(objThumbPos.min < objBounds.minPosThumbs){ 419 420 var prevThumb = objThumb.prev(); 421 if(prevThumb.length) 422 scrollToThumbMin(prevThumb); 423 else 424 scrollToThumbMin(objThumb); 425 426 }else if(objThumbPos.max > objBounds.maxPosThumbs){ 427 428 var nextThumb = objThumb.next(); 429 if(nextThumb.length) 430 scrollToThumbMax(nextThumb); 431 else 432 scrollToThumbMax(objThumb); 433 434 } 435 436 } 437 438 /** 439 * scroll to selected thumb 440 */ 441 function scrollToSelectedThumb(){ 442 443 var selectedItem = g_gallery.getSelectedItem(); 444 if(selectedItem == null) 445 return(true); 446 447 var objThumb = selectedItem.objThumbWrapper; 448 if(objThumb) 449 scrollToThumb(objThumb); 450 451 } 452 453 454 455 /** 456 * check that the inner strip off the limits position, and reposition it if there is a need 457 */ 458 function checkAndRepositionInnerStrip(){ 459 if(isStripMovingEnabled() == false) 460 return(false); 461 462 var pos = t.getInnerStripPos(); 463 464 var posFixed = t.fixInnerStripLimits(pos); 465 466 if(pos != posFixed) 467 t.positionInnerStrip(posFixed, true); 468 } 469 470 471 /** 472 * enable / disable controls according inner width (move enabled). 473 */ 474 function checkControlsEnableDisable(){ 475 476 var isMovingEndbled = isStripMovingEnabled(); 477 478 if(isMovingEndbled == true){ 479 480 if(g_aviaControl) 481 g_aviaControl.enable(); 482 483 if(g_touchThumbsControl) 484 g_touchThumbsControl.enable(); 485 486 }else{ 487 488 if(g_aviaControl) 489 g_aviaControl.disable(); 490 491 if(g_touchThumbsControl) 492 g_touchThumbsControl.disable(); 493 494 } 495 496 } 497 498 /** 499 * align inner strip according the options 500 */ 501 function alignInnerStrip(){ 502 503 if(isStripMovingEnabled()) 504 return(false); 505 506 if(g_isVertical == false) 507 g_functions.placeElement(g_objStripInner, g_options.strip_thumbs_align, 0); 508 else 509 g_functions.placeElement(g_objStripInner, 0, g_options.strip_thumbs_align); 510 511 } 512 513 514 function ___________EVENTS___________(){}; 515 516 /** 517 * on thumb click event. Select the thumb 518 */ 519 function onThumbClick(objThumb){ 520 521 //cancel click event only if passed significant movement 522 if(t.isTouchMotionActive()){ 523 524 var isSignificantPassed = g_touchThumbsControl.isSignificantPassed(); 525 if(isSignificantPassed == true) 526 return(true); 527 } 528 529 //run select item operation 530 var objItem = g_thumbs.getItemByThumb(objThumb); 531 532 g_gallery.selectItem(objItem); 533 } 534 535 536 /** 537 * on some thumb placed, run the resize, but with time passed 538 */ 539 function onThumbPlaced(){ 540 541 clearTimeout(g_temp.handle); 542 543 g_temp.handle = setTimeout(function(){ 544 545 positionThumbs(); 546 547 },50); 548 549 550 } 551 552 /** 553 * on item change 554 */ 555 function onItemChange(){ 556 557 var objItem = g_gallery.getSelectedItem(); 558 g_thumbs.setThumbSelected(objItem.objThumbWrapper); 559 scrollToThumb(objItem.objThumbWrapper); 560 } 561 562 563 /** 564 * init panel events 565 */ 566 function initEvents(){ 567 568 g_thumbs.initEvents(); 569 570 var objThumbs = g_objStrip.find(".ug-thumb-wrapper"); 571 572 objThumbs.on("click touchend", function(event){ 573 574 var clickedThumb = jQuery(this); 575 onThumbClick(clickedThumb); 576 }); 577 578 //on item change, make the thumb selected 579 g_objGallery.on(g_gallery.events.ITEM_CHANGE, onItemChange); 580 581 582 //position thumbs after each load on non fixed mode 583 if(g_temp.isNotFixedThumbs){ 584 585 jQuery(g_thumbs).on(g_thumbs.events.AFTERPLACEIMAGE, onThumbPlaced); 586 587 } 588 589 } 590 591 592 /** 593 * destroy the strip panel events 594 */ 595 this.destroy = function(){ 596 597 var objThumbs = g_objStrip.find(".ug-thumb-wrapper"); 598 599 objThumbs.off("click"); 600 objThumbs.off("touchend"); 601 g_objGallery.off(g_gallery.events.ITEM_CHANGE); 602 603 jQuery(g_thumbs).off(g_thumbs.events.AFTERPLACEIMAGE); 604 605 if(g_touchThumbsControl) 606 g_touchThumbsControl.destroy(); 607 608 if(g_aviaControl) 609 g_aviaControl.destroy(); 610 611 g_thumbs.destroy(); 612 } 613 614 615 function ____________GETTERS___________(){}; 616 617 618 /** 619 * check if the inner width is more then strip width 620 */ 621 function isStripMovingEnabled(){ 622 623 if(g_sizes.stripInnerSize > g_sizes.stripActiveSize) 624 return(true); 625 else 626 return(false); 627 628 } 629 630 631 /** 632 * get bounds, if the thumb not in them, it need to be scrolled 633 * minPosThumbs, maxPosThumbs - the min and max position that the thumbs should be located to be visible 634 */ 635 function getThumbsInsideBounds(){ 636 var obj = {}; 637 var innerPos = t.getInnerStripPos(); 638 639 //the 1 is gap that avoid exact bounds 640 obj.minPosThumbs = innerPos * -1 + 1; 641 obj.maxPosThumbs = innerPos * -1 + g_sizes.stripSize - 1; 642 643 return(obj); 644 } 645 646 647 /** 648 * get thumb position according the orientation in the inner strip 649 */ 650 function getThumbPos(objThumb){ 651 652 var objReturn = {}; 653 654 var objPos = objThumb.position(); 655 656 if(g_isVertical == false){ 657 objReturn.min = objPos.left; 658 objReturn.max = objPos.left + g_sizes.thumbSize; 659 }else{ 660 objReturn.min = objPos.top; 661 objReturn.max = objPos.top + g_sizes.thumbSize; 662 } 663 664 665 return(objReturn); 666 } 667 668 669 670 671 this.________EXTERNAL_GENERAL___________ = function(){}; 672 673 /** 674 * init function for avia controls 675 */ 676 this.init = function(gallery, customOptions){ 677 678 initStrip(gallery, customOptions); 679 } 680 681 682 /** 683 * set html and properties 684 */ 685 this.run = function(){ 686 runStrip(); 687 } 688 689 690 691 692 /** 693 * position inner strip on some pos according the orientation 694 */ 695 this.positionInnerStrip = function(pos, isAnimate){ 696 697 if(isAnimate === undefined) 698 var isAnimate = false;
699 700 if(g_isVertical == false) 701 var objPosition = {"left": pos + "px"}; 702 else 703 var objPosition = {"top": pos + "px"}; 704 705 if(isAnimate == false){ //normal position 706 707 g_objStripInner.css(objPosition); 708 t.triggerStripMoveEvent(); 709 } 710 else{ //position with animation 711 712 t.triggerStripMoveEvent(); 713 714 g_objStripInner.stop(true).animate(objPosition ,{ 715 duration: g_options.strip_scroll_to_thumb_duration, 716 easing: g_options.strip_scroll_to_thumb_easing, 717 queue: false, 718 progress:function(){t.triggerStripMoveEvent()}, 719 always: function(){t.triggerStripMoveEvent()} 720 }); 721 722 } 723 724 } 725 726 /** 727 * trigger event - on strip move 728 */ 729 this.triggerStripMoveEvent = function(){ 730 731 //trigger onstripmove event 732 jQuery(t).trigger(t.events.STRIP_MOVE); 733 734 } 735 736 737 738 /** 739 * return true if the touch animation or dragging is active 740 */ 741 this.isTouchMotionActive = function(){ 742 if(!g_touchThumbsControl) 743 return(false); 744 745 var isActive = g_touchThumbsControl.isTouchActive(); 746 747 return(isActive); 748 } 749 750 751 /** 752 * check if thmb item visible, means inside the visible part of the inner strip 753 */ 754 this.isItemThumbVisible = function(objItem){ 755 756 var objThumb = objItem.objThumbWrapper; 757 var thumbPos = objThumb.position(); 758 759 var posMin = t.getInnerStripPos() * -1; 760 761 if(g_isVertical == false){ 762 var posMax = posMin + g_sizes.stripSize; 763 var thumbPosMin = thumbPos.left; 764 var thumbPosMax = thumbPos.left + objThumb.width(); 765 }else{ 766 var posMax = posMin + g_sizes.stripSize; 767 var thumbPosMin = thumbPos.top; 768 var thumbPosMax = thumbPos.top + objThumb.height(); 769 } 770 771 var isVisible = false; 772 if(thumbPosMax >= posMin && thumbPosMin <= posMax) 773 isVisible = true; 774 775 return(isVisible); 776 } 777 778 /** 779 * get inner strip position according the orientation 780 */ 781 this.getInnerStripPos = function(){ 782 783 if(g_isVertical == false) 784 return g_objStripInner.position().left; 785 else 786 return g_objStripInner.position().top; 787 } 788 789 790 /** 791 * get inner strip limits 792 */ 793 this.getInnerStripLimits = function(){ 794 795 var output = {}; 796 797 if(g_isVertical == false) 798 output.maxPos = g_options.strip_padding_left; 799 else 800 output.maxPos = g_options.strip_padding_top; 801 802 //debugLine(g_sizes.stripActiveSize); 803 804 output.minPos = -(g_sizes.stripInnerSize - g_sizes.stripActiveSize); 805 806 return(output); 807 } 808 809 810 /** 811 * fix inner position by check boundaries limit 812 */ 813 this.fixInnerStripLimits = function(distPos){ 814 815 var minPos; 816 817 var objLimits = t.getInnerStripLimits(); 818 819 if(distPos > objLimits.maxPos) 820 distPos = objLimits.maxPos; 821 822 if(distPos < objLimits.minPos) 823 distPos = objLimits.minPos; 824 825 return(distPos); 826 } 827 828 829 830 /** 831 * scroll left or down 832 */ 833 this.scrollForeward = function(){ 834 scrollBy(-g_sizes.stripSize); 835 } 836 837 838 /** 839 * scroll left or down 840 */ 841 this.scrollBack = function(){ 842 843 scrollBy(g_sizes.stripSize); 844 } 845 846 847 this.________EXTERNAL_SETTERS___________ = function(){}; 848 849 850 /** 851 * set the options of the strip 852 */ 853 this.setOptions = function(objOptions){ 854 855 g_options = jQuery.extend(g_options, objOptions); 856 857 g_thumbs.setOptions(objOptions); 858 859 onAfterSetOptions(); 860 } 861 862 863 /** 864 * set size of the strip 865 * the height size is set automatically from options 866 */ 867 this.setSizeVertical = function(height){ 868 869 if(g_isVertical == false){ 870 throw new Error("setSizeVertical error, the strip size is not vertical"); 871 return(false); 872 } 873 874 var width = g_sizes.thumbSecondSize; 875 876 var objCssStrip = {}; 877 objCssStrip["width"] = width+"px"; 878 objCssStrip["height"] = height+"px"; 879 880 g_objStrip.css(objCssStrip); 881 882 storeStripSize(height); 883 884 //set inner strip params 885 var objCssInner = {}; 886 objCssInner["width"] = width+"px"; 887 objCssInner["left"] = "0px"; 888 objCssInner["top"] = "0px"; 889 890 g_objStripInner.css(objCssInner); 891 892 g_temp.is_placed = true; 893 894 checkControlsEnableDisable(); 895 } 896 897 898 /** 899 * set size of the strip 900 * the height size is set automatically from options 901 */ 902 this.setSizeHorizontal = function(width){ 903 904 if(g_isVertical == true){ 905 throw new Error("setSizeHorizontal error, the strip size is not horizontal"); 906 return(false); 907 } 908
909 var height = g_sizes.thumbSecondSize + g_options.strip_padding_top + g_options.strip_padding_bottom; 910 911 var objCssStrip = {}; 912 objCssStrip["width"] = width+"px"; 913 objCssStrip["height"] = height+"px"; 914 915 g_objStrip.css(objCssStrip); 916 917 storeStripSize(width); 918 919 var innerLeft = g_options.strip_padding_left; 920 921 //set inner strip params 922 var objCssInner = {}; 923 objCssInner["height"] = height+"px"; 924 objCssInner["left"] = innerLeft + "px"; 925 objCssInner["top"] = "0px"; 926 927 g_objStripInner.css(objCssInner); 928 929 g_temp.is_placed = true; 930 931 checkControlsEnableDisable(); 932 } 933 934 935 /** 936 * set position of the strip 937 */ 938 this.setPosition = function(left, top, offsetLeft, offsetTop){ 939 g_functions.placeElement(g_objStrip, left, top, offsetLeft, offsetTop); 940 } 941 942 943 /** 944 * resize the panel according the orientation 945 */ 946 this.resize = function(newSize){ 947 948 if(g_isVertical == false){ 949 950 g_objStrip.width(newSize); 951 g_sizes.stripActiveSize = newSize - g_options.strip_padding_left - g_options.strip_padding_right; 952 953 }else{ 954 g_objStrip.height(newSize); 955 g_sizes.stripActiveSize = newSize - g_options.strip_padding_top - g_options.strip_padding_bottom; 956 } 957 958 storeStripSize(newSize); 959 960 checkControlsEnableDisable(); 961 962 checkAndRepositionInnerStrip(); 963 964 alignInnerStrip(); 965 966 scrollToSelectedThumb(); 967 } 968 969 970 /** 971 * set the thumb unselected state 972 */ 973 this.setThumbUnselected = function(objThumbWrapper){ 974 975 g_thumbs.setThumbUnselected(objThumbWrapper); 976 977 } 978 979 980 /** 981 * set custom thumbs 982 */ 983 this.setCustomThumbs = function(funcSetHtml){ 984 985 g_thumbs.setCustomThumbs(funcSetHtml); 986 987 } 988 989 990 991 992 this.________EXTERNAL_GETTERS___________ = function(){}; 993 994 /** 995 * get objects 996 */ 997 this.getObjects = function(){ 998 999 var thumbsOptions = g_thumbs.getOptions(); 1000 var commonOpitions = jQuery.extend(g_options, thumbsOptions); 1001 1002 var obj = { 1003 g_gallery: g_gallery, 1004 g_objGallery: g_objGallery, 1005 g_objWrapper:g_objWrapper, 1006 g_arrItems:g_arrItems, 1007 g_objStrip : g_objStrip, 1008 g_objStripInner : g_objStripInner, 1009 g_aviaControl:g_aviaControl, 1010 g_touchThumbsControl:g_touchThumbsControl, 1011 isVertical: g_isVertical, 1012 g_options: commonOpitions, 1013 g_thumbs: g_thumbs 1014 }; 1015 1016 return(obj); 1017 } 1018 1019 1020 /** 1021 * get thumbs onject 1022 */ 1023 this.getObjThumbs = function(){ 1024 1025 return(g_thumbs); 1026 } 1027 1028 1029 /** 1030 * get selected thumb 1031 */ 1032 this.getSelectedThumb = function(){ 1033 1034 var selectedIndex = g_gallery.getSelectedItemIndex(); 1035 if(selectedIndex == -1) 1036 return(null); 1037 1038 return g_thumbs.getThumbByIndex(selectedIndex); 1039 } 1040 1041 1042 /** 1043 * get strip size and position object 1044 */ 1045 this.getSizeAndPosition = function(){ 1046 1047 var obj = g_functions.getElementSize(g_objStrip); 1048 1049 return(obj); 1050 } 1051 1052 /** 1053 * get thumbs strip height 1054 */ 1055 this.getHeight = function(){ 1056 1057 var stripHeight = g_objStrip.outerHeight(); 1058 1059 return(stripHeight) 1060 } 1061 1062 1063 /** 1064 * get thumbs strip width 1065 */ 1066 this.getWidth = function(){ 1067 1068 var stripWidth = g_objStrip.outerWidth(); 1069 1070 return(stripWidth); 1071 } 1072 1073 1074 1075 /** 1076 * get all stored sizes object 1077 */ 1078 this.getSizes = function(){ 1079 1080 return(g_sizes); 1081 } 1082 1083 1084 /** 1085 * return if vertical orientation or not 1086 */ 1087 this.isVertical = function(){ 1088 return(g_isVertical); 1089 } 1090 1091 1092 /** 1093 * return if the strip is placed or not 1094 */ 1095 this.isPlaced = function(){ 1096 1097 return(g_temp.is_placed); 1098 } 1099 1100 /** 1101 * return if the strip moving enabled or not 1102 */ 1103 this.isMoveEnabled = function(){ 1104 var isEnabled = isStripMovingEnabled(); 1105 return(isEnabled); 1106 } 1107 1108}
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.