PageRenderTime 63ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/wp-ui/js/wp-ui-old.js

https://gitlab.com/Blueprint-Marketing/interoccupy.net
JavaScript | 1240 lines | 800 code | 253 blank | 187 comment | 198 complexity | 1abf3739b94aad2985ebf2a49252f037 MD5 | raw file
  1. /*!
  2. * WP UI version 0.8.5
  3. *
  4. * Copyright (c) 2011, Kavin Amuthan ( http://kav.in )
  5. * @license - Dual licensed under the MIT and GPL licenses.
  6. *
  7. * Below components Copyright and License as per the respective authors.
  8. * Thanks for their hard work.
  9. *
  10. * Includes jQuery cookie plugin by Klaus Hartl.
  11. * Includes hashchange event plugin by Ben Alman.
  12. * Includes Mousewheel event plugin by Brandon Aaron.
  13. *
  14. *
  15. * Requires : jQuery v1.4.2, jQuery UI v1.8 or later.
  16. */
  17. // document.write blank page fix. Thanks to altCognito's code on stackoverflow. ( http://stackoverflow.com/q/761190 ) from which this is adapted.
  18. if ( typeof wpUIOpts == 'object' && wpUIOpts.docWriteFix == 'on' ) {
  19. var docWriteTxt = "";
  20. jQuery(function() {
  21. document.write = function( dWT ) {
  22. docWriteTxt += dWT;
  23. }
  24. // document.write("");
  25. jQuery( docWriteTxt ).appendTo( 'body' );
  26. });
  27. } // END doc write fix.
  28. /*
  29. * Component - Tabs
  30. */
  31. tabSet = 0;
  32. function getNextSet() {
  33. return ++tabSet;
  34. }
  35. var tabNames = [], accNames = [];
  36. jQuery.fn.wptabs = function( options ) {
  37. var linkAttrs;
  38. var o = jQuery.extend({} , jQuery.fn.wptabs.defaults, options);
  39. // Assign $this.
  40. this.each(function() {
  41. uid = getNextSet();
  42. base = this;
  43. var $this = jQuery(this);
  44. base.jqui = false;
  45. if ( $this.hasClass( 'jqui-styles' ) ) {
  46. base.jqui = true;
  47. }
  48. // Add an empty UL element.
  49. $this.prepend('<ul class="ui-tabs-nav" />');
  50. var wrapper = $this.children(o.h3Class).wrap('<div class="ui-tabs-panel"></div>');
  51. $this.find('div.ui-tabs-panel:last-child').after('<p id="jqtemp">');
  52. if ( o.wpuiautop ) {
  53. $this
  54. .find('p, br')
  55. .not('div.wp-tab-content br, div.wp-tab-content p ')
  56. .filter(function() {
  57. return jQuery.trim(jQuery(this).html()) === ''
  58. }).remove();
  59. }
  60. wrapper.each(function() {
  61. jQuery(this).parent().append( jQuery(this).parent().nextUntil("div.ui-tabs-panel") );
  62. });
  63. // liStr = '';
  64. // Add the respective IDs to the ui-tabs-panel(content) and remove the h3s.
  65. $this.find('.ui-tabs-panel').children(o.h3Class).each(function( index ) {
  66. dup = getNextSet();
  67. parID = jQuery( this ).text();
  68. otherClass = jQuery( this ).hasClass( 'wpui-hidden-tab' ) ? 'wpui-hidden-tab' : '';
  69. // Non english characters.
  70. if ( parID.match( /[^\x00-\x80]+/ ) ) {
  71. base.nonEng = true;
  72. parID = 'tab-' + dup;
  73. }
  74. if ( jQuery( this ).has( o.linkAjaxClass ).length != 0 )
  75. base.linkAJAX = true;
  76. // Process pID.
  77. parID = parID.replace(/\s{1,}/gm, '_')
  78. .replace( /[^\-A-Za-z0-9\s_]/mg, '')
  79. .toLowerCase();
  80. var linkS = '';
  81. if ( jQuery.inArray( parID, tabNames ) != '-1' )
  82. parID = parID + '-' + dup;
  83. if ( base.linkAJAX ) {
  84. aLink = jQuery( this ).find( o.linkAjaxClass );
  85. linkS = '<a href="' + aLink.attr( "href" ) + '">' + aLink.text() + '</a>';
  86. } else if( jQuery( this ).find( 'img' ).length == 1 ) {
  87. var parIMG = jQuery( this ).find( 'img' );
  88. while ( parIMG.parent().is( 'h3' ) != 1 ) parIMG.unwrap();
  89. parIMG.removeAttr( 'style' ).css( 'vertical-align', 'middle' );
  90. if ( parIMG.attr( 'title' ) != 'undefined' && parIMG.attr( 'title') != '' && jQuery( this ).text() == '' )
  91. parID = parIMG.attr( 'title' ).replace(/\s{1,}/gm, '_').replace( /[^\-A-Za-z0-9\s_]/mg, '');
  92. var imgLink = '<img src="' + parIMG.attr( 'src' ) + '" title="' + parIMG.attr( 'title' ) + '" />';
  93. linkS = '<a href="#' + parID + '">' + imgLink + jQuery( this ).text() + '</a>';
  94. } else {
  95. linkS = '<a href="#' + parID + '">' + jQuery( this ).text() + '</a>';
  96. }
  97. liStr = '<li class="' + otherClass + '">' + linkS + '</li>';
  98. $this.find( 'ul.ui-tabs-nav' ).append( liStr );
  99. if ( ! base.linkAJAX )
  100. jQuery( this ).parent().attr( 'id', parID );
  101. else
  102. jQuery( this ).parent().remove();
  103. tabNames = tabNames.concat( parID );
  104. }).hide();
  105. // Wrap everything inside div.ui-tabs
  106. if ( $this.find('div.ui-tabs').length == 0) {
  107. $this.find('ul.ui-tabs-nav').before("<div class='ui-tabs'>");
  108. $this.find('.ui-tabs').each(function() {
  109. jQuery(this).append( jQuery(this).nextUntil('p#jqtemp'));
  110. });
  111. }
  112. tabsobj = {};
  113. if ( o.effect == 'slideDown' ) {
  114. tabsobj.fx = { height: 'toggle', speed: o.effectSpeed};
  115. } else if ( o.effect == 'fadeIn' ) {
  116. tabsobj.fx = {opacity: 'toggle', speed: o.effectSpeed};
  117. }
  118. if ( o.cookies ) {
  119. tabsobj.cookie = { expires : 30 };
  120. }
  121. if ( o.tabsEvent ) {
  122. tabsobj.event = o.tabsEvent;
  123. }
  124. if ( o.collapsibleTabs ) {
  125. tabsobj.collapsible = true;
  126. }
  127. ////////////////////////////////////////////////
  128. ///////////// Initialize the tabs /////////////
  129. //////////////////////////////////////////////
  130. var $tabs = $this.children('.ui-tabs').tabs(tabsobj);
  131. jQuery('ul.ui-tabs-nav').each(function() {
  132. jQuery('li:first', this).addClass('first-li');
  133. jQuery('li:last', this).addClass('last-li');
  134. });
  135. if ( o.alwaysRotate != 'disable' ) {
  136. jQuery( this + '[class*=tab-rotate]').each(function() {
  137. rotateSpeed = jQuery(this).attr('class').match(/tab-rotate-(.*)/, "$1");
  138. if (rotateSpeed != null ) {
  139. if (rotateSpeed[1].match(/(\d){1,2}s/, "$1")) rotateSpeed[1] = rotateSpeed[1].replace(/s$/, '')*1000 ;
  140. rotateSpeed = rotateSpeed[1];
  141. alwaysRotate = ( o.alwaysRotate == 'always' ) ? true : false;
  142. }
  143. jQuery(this).find('.ui-tabs')
  144. .tabs( 'rotate', rotateSpeed, alwaysRotate );
  145. });
  146. }
  147. if (o.followNav == true || $this.hasClass('tab-nav-follows')) {
  148. o.topNav = o.bottomNav = false;
  149. $tabs.append('<a href="#" class="ui-button tab-nav-follows prev-follow"><span></span>Previous</a> <a href="#" class="ui-button tab-nav-follows next-follow"><span></span>Next</a>');
  150. jQuery('.tab-nav-follows').css({
  151. position: 'absolute'
  152. });
  153. wptabsHgt = $this.height() / 2;
  154. wptabsNavWdt = $tabs.children('.tab-nav-follows').outerWidth();
  155. $tabs.parent().css({
  156. position: 'relative'
  157. });
  158. maxPH = 0;
  159. $tabs.children('.ui-tabs-panel').each(function() {
  160. if (jQuery(this).height() > maxPH) {
  161. maxPH = jQuery(this).height();
  162. }
  163. });
  164. $tabs.children('div.ui-tabs-panel').innerHeight(maxPH + 50);
  165. jQuery('.next-follow').css({
  166. right: wptabsNavWdt * -1 + "px",
  167. top: "150px"
  168. }).click(function() {
  169. wpuiTabsMover('forward');
  170. return false;
  171. });
  172. jQuery('.prev-follow').css({
  173. left: wptabsNavWdt * -1 + "px",
  174. top: "150px"
  175. }).click(function() {
  176. wpuiTabsMover('backward');
  177. return false;
  178. });
  179. $fNavs = $this.find('a.tab-nav-follows');
  180. $fNavs.wpuiScroller({
  181. container: $tabs.get(0)
  182. });
  183. }
  184. if ( o.topNav || o.bottomNav ) {
  185. // Add previous/next navigation.
  186. $this.find('div.ui-tabs-panel').each(function(i) {
  187. // base.navClass = '';
  188. // base.navNextSpan = '';
  189. // base.navPrevSpan = '';
  190. // if ( base.jqui ) {
  191. base.navClass = ' ui-button ui-widget ui-state-default ui-corner-all';
  192. base.navPrevSpan = '<span class="ui-icon ui-icon-circle-triangle-w"></span>';
  193. base.navNextSpan = '<span class="ui-icon ui-icon-circle-triangle-e"></span>';
  194. // }
  195. ! o.topNav || jQuery(this).prepend('<div class="tab-top-nav" />');
  196. ! o.bottomNav || jQuery(this).append('<div style="clear: both;"></div><div class="tab-bottom-nav" />');
  197. var totalLength = jQuery(this).parent().children('.ui-tabs-panel').length -1;
  198. if ( i != 0 ) {
  199. ! o.topNav || jQuery(this).children('.tab-top-nav').prepend('<a href="#" class="backward prev-tab ' + base.navClass + '">' + base.navPrevSpan + o.tabPrevText + '</a>');
  200. ! o.bottomNav || jQuery(this).children('.tab-bottom-nav').append('<a href="#" class="backward prev-tab ' + base.navClass + '">' + base.navPrevSpan + o.tabPrevText + '</a>');
  201. }
  202. if ( i != totalLength ) {
  203. ! o.topNav || jQuery(this).children('.tab-top-nav').append('<a href="#" class="forward next-tab ' + base.navClass + '">' + o.tabNextText + base.navNextSpan + '</a>');
  204. ! o.bottomNav || jQuery(this).children('.tab-bottom-nav').append('<a href="#" class="forward next-tab ' + base.navClass + '">' + o.tabNextText + base.navNextSpan + '</a>');
  205. }
  206. }); //END div.ui-tabs-panel each.
  207. jQuery('a.forward, a.backward').hover(function() {
  208. if ( base.jqui )
  209. jQuery(this).addClass('ui-state-hover');
  210. }, function() {
  211. if ( base.jqui )
  212. jQuery( this ).removeClass('ui-state-hover');
  213. }).focus(function() {
  214. if ( base.jqui )
  215. jQuery(this).addClass('ui-state-focus ui-state-active');
  216. }).blur(function() {
  217. if ( base.jqui )
  218. jQuery(this).removeClass('ui-state-focus ui-state-active');
  219. });
  220. } // END if o.navigation
  221. // $tabs.tabs('option', 'disabled', false);
  222. if ( o.position == 'bottom' || jQuery(this).hasClass('tabs-bottom') ) {
  223. jQuery('ul.ui-tabs-nav', this).each(function() {
  224. jQuery(this)
  225. .appendTo(jQuery(this).parent())
  226. .addClass('ul-bottom');
  227. });
  228. $this.children('.ui-tabs')
  229. .addClass('bottom-tabs')
  230. .children('.ui-tabs-panel')
  231. .each(function() {
  232. jQuery(this).addClass('bottom-tabs');
  233. });
  234. } // END BottomTabs check.
  235. // Vertical tabsets.
  236. if ( $this.hasClass( 'wpui-tabs-vertical' ) ) {
  237. $tabs.addClass( 'ui-tabs-vertical ui-helper-clearfix' );
  238. $tabs.find('li').removeClass('ui-corner-top').addClass( 'ui-corner-left' );
  239. $tabs.find('ul.ui-tabs-nav')
  240. .css({ position : 'absolute' })
  241. .removeClass( 'ui-corner-all' )
  242. .addClass( 'ui-corner-left' )
  243. .children()
  244. .css({ 'float' : 'left', clear: 'left', position : 'relative' });
  245. getListWidth = jQuery(this).attr('class').match(/listwidth-(\d{2,4})/, "$1");
  246. if ( getListWidth != null ) {
  247. ulWidth = getListWidth[ 1 ];
  248. } else {
  249. ulWidth = $tabs.find( 'ul.ui-tabs-nav' ).outerWidth();
  250. }
  251. // console.log( ulWidth );
  252. ulHeight = $tabs.find( 'ul.ui-tabs-nav' ).outerHeight();
  253. $tabs.find( 'ul.ui-tabs-nav' ).width( ulWidth );
  254. $tabs.find( 'div.ui-tabs-panel' ).css({ 'float' : 'right' });
  255. parWidth = $tabs.width() -
  256. (
  257. parseInt( $tabs.children( 'div.ui-tabs-panel' ).css('paddingLeft') ) +
  258. parseInt( $tabs.children( 'div.ui-tabs-panel' ).css('paddingRight') ) +
  259. parseInt( $tabs.children( 'div.ui-tabs-panel' ).css('borderRightWidth') ) +
  260. parseInt( $tabs.children( 'div.ui-tabs-panel' ).css('borderLeftWidth') )
  261. );
  262. PaneWidth = parWidth - ulWidth;
  263. maxPane = 0;
  264. paneCount = $tabs.find( '.ui-tabs-panel' ).length;
  265. $tabs.find('.ui-tabs-panel').width( PaneWidth );
  266. $tabs.find( '.ui-tabs-panel' ).each(function() {
  267. if ( jQuery( this ).outerHeight() > maxPane ) {
  268. maxPane = jQuery( this ).outerHeight();
  269. }
  270. });
  271. // $tabs.find( '.wpui-tabs-arrow' ).each(function() {
  272. // jQuery( this ).height(
  273. // jQuery( this ).parent().height() // +
  274. // // parseInt( jQuery( this ).css( 'borderTopWidth' ) ) +
  275. // // parseInt( jQuery( this ).css( 'borderBottomWidth' ) )
  276. //
  277. // );
  278. // });
  279. // if ( jQuery.browser.mozilla == true ) {
  280. // jQuery( 'body' ).append( '<style type="text/css">.tabs-arrow-svg { clip-path : url( #c1 ); }</style><svg height="0"> <clipPath id="c1" clipPathUnits="objectBoundingBox"> <polygon style="fill:#FFFFFF;" points="0,0 0,1 0.4,1 0.8,0.5 0.4,0"/> </clipPath> </svg> ' );
  281. // jQuery( '.wpui-tabs-arrow' ).each(function() {
  282. // jQuery( this ).addClass( 'tabs-arrow-svg' );
  283. // });
  284. // }
  285. if ( o.effect == 'slideDown' )
  286. $this.find('.ui-tabs').tabs({ fx : null });
  287. if ( maxPane != 0 ) {
  288. ( maxPane > ulHeight ) ?
  289. $tabs.children().innerHeight( maxPane + 40 ) :
  290. $tabs.children().innerHeight( ulHeight + 40 );
  291. }
  292. }
  293. if (typeof WPUIOpts != 'undefined')
  294. $this.append('<a class="thickbox cap-icon-link" title="" href="http://kav.in"><img src="' + wpUIOpts.pluginUrl + '/images/cquest.png" alt="Cap" /></a>');
  295. if ( jQuery.event.special.mousewheel !== "undefined" && o.mouseWheel != 'false' ) {
  296. if ( o.mouseWheel && o.mouseWheel == "panels" ) {
  297. scrollEl = 'div.ui-tabs-panel';
  298. } else {
  299. scrollEl = 'ul.ui-tabs-nav';
  300. }
  301. $this.panelength = $tabs.find( '.ui-tabs-panel' ).length;
  302. $tabs.find( scrollEl ).mousewheel(function( event, delta) {
  303. if ( delta < 0 )
  304. dir = "forward";
  305. else if ( delta > 0 )
  306. dir = "backward";
  307. typeof ( dir ) == 'undefined' || wpuiTabsMover( dir );
  308. return false;
  309. });
  310. }
  311. $this.find( 'a.next-tab, a.prev-tab' ).hover(function() {
  312. jQuery( this ).addClass( 'ui-state-hover' );
  313. }, function() {
  314. jQuery( this ).removeClass( 'ui-state-hover' );
  315. });
  316. $this.find( 'a.next-tab, a.prev-tab' ).click(function() {
  317. if ( jQuery( this ).is('a.next-tab') )
  318. wpuiTabsMover( "forward" );
  319. else
  320. wpuiTabsMover( "backward" );
  321. return false;
  322. });
  323. // Change the corners on no-tabs-background
  324. if ( $this.hasClass( 'wpui-no-background' ) ) {
  325. $this.find( 'ul.ui-tabs-nav > li' )
  326. .removeClass( 'ui-corner-top' )
  327. .addClass( 'ui-corner-all' );
  328. }
  329. // if ( jQuery.fn.wpuiSwipe !== "undefined" && o.mouseWheel != 'false' ) {
  330. //
  331. // $tabs.find( 'div.ui-tabs-panel' ).wpuiSwipe({
  332. // swipeLeft : function() { wpuiTabsMover( "backward" ); },
  333. // swipeRight : function() { wpuiTabsMover( "forward" ); }
  334. // });
  335. // }
  336. var wpuiTabsMover = function( dir ) {
  337. dir = dir || 'forward';
  338. mrel = $this.find('.ui-tabs').tabs('option', 'selected');
  339. mrel = ( dir == 'backward' ) ? mrel - 1 : mrel + 1;
  340. if ( dir == "forward" && mrel == $this.panelength ) mrel = 0;
  341. if ( dir == "backward" && mrel < 0 ) mrel = $this.panelength - 1;
  342. $tabs.tabs( "select", mrel );
  343. };
  344. }); // END return $this.each.
  345. if ( o.hashChange && typeof jQuery.event.special.hashchange != "undefined" ) {
  346. jQuery( window ).hashchange(function() {
  347. tabHash = window.location.hash;
  348. if ( ( jQuery( tabHash ).length != 1 ) ||
  349. ( jQuery.inArray( tabHash.replace( /^#/, '' ) , tabNames ) == -1 )
  350. )
  351. return false;
  352. hashed = jQuery(window.location.hash).prevAll().length - 1;
  353. // console.log( window.location.hash );
  354. // console.log( tabNames );
  355. jQuery( window.location.hash )
  356. .parent()
  357. .tabs({ selected : hashed });
  358. return false;
  359. });
  360. jQuery( window ).hashchange();
  361. } // END check availability for hashchange event.
  362. return this;
  363. }; // END function jQuery.fn.wptabs.
  364. jQuery.fn.wptabs.defaults = {
  365. h3Class : 'h3.wp-tab-title',
  366. linkAjaxClass : 'a.wp-tab-load',
  367. topNav : (typeof wpUIOpts != "undefined" && wpUIOpts.topNav == 'on' ) ? true : false,
  368. bottomNav : (typeof wpUIOpts != "undefined" && wpUIOpts.bottomNav == 'on' ) ? true : false,
  369. position : 'top',
  370. navStyle : (typeof wpUIOpts != "undefined") ? wpUIOpts.tabsLinkClass : '',
  371. effect : (typeof wpUIOpts != "undefined") ? wpUIOpts.tabsEffect : '',
  372. effectSpeed : (typeof wpUIOpts != "undefined") ? wpUIOpts.effectSpeed : '',
  373. alwaysRotate : (typeof wpUIOpts != "undefined") ? wpUIOpts.alwaysRotate : '', // True - will rotate inspite of clicks. False - will stop.
  374. tabsEvent : (typeof wpUIOpts != "undefined") ? wpUIOpts.tabsEvent : '',
  375. collapsibleTabs : (typeof wpUIOpts != "undefined" && wpUIOpts.collapsibleTabs == 'on' ) ? true : false,
  376. tabPrevText : (typeof wpUIOpts != "undefined" && wpUIOpts.tabPrevText != '' ) ? wpUIOpts.tabPrevText : '&laquo; Previous',
  377. tabNextText : (typeof wpUIOpts != "undefined" && wpUIOpts.tabNextText != '' ) ? wpUIOpts.tabNextText : 'Next &raquo;',
  378. cookies : (typeof wpUIOpts != "undefined" && wpUIOpts.cookies == 'on' ) ? true : false,
  379. hashChange : (typeof wpUIOpts != "undefined" && wpUIOpts.hashChange == 'on' ) ? true : false,
  380. hashChange : (typeof wpUIOpts != "undefined" && wpUIOpts.hashChange == 'on' ) ? true : false,
  381. mouseWheel : (typeof wpUIOpts != "undefined" ) ? wpUIOpts.mouseWheelTabs : '',
  382. wpuiautop : true,
  383. followNav: false
  384. };
  385. jQuery.fn.wpuiScroller = function(options) {
  386. var base = this;
  387. base.$el = jQuery(this);
  388. base.opts = jQuery.extend({},
  389. jQuery.fn.wpuiScroller.defaults, options);
  390. base.startTop = parseInt(base.$el.css('top'));
  391. if (base.opts.limiter) {
  392. base.limiter = jQuery(base.opts.limiter);
  393. } else {
  394. base.limiter = base.$el.parent().parent();
  395. }
  396. base.startAt = parseInt(base.limiter.offset().top);
  397. jQuery(window).scroll(function() {
  398. base.endAt = parseInt(base.limiter.height() + jQuery(window).height() / 2);
  399. base.moveTo = base.startTop;
  400. if (jQuery(document).scrollTop() >= base.startAt) {
  401. base.moveTo = base.startTop + (jQuery(window).scrollTop() - base.startAt);
  402. if ((jQuery(window).scrollTop() + jQuery(window).height() / 2) >= (base.limiter.height() + base.limiter.offset().top - base.startTop)) {
  403. base.moveTo = base.limiter.height() - base.startTop;
  404. }
  405. }
  406. base.$el.css('top', base.moveTo);
  407. });
  408. return this;
  409. };
  410. jQuery.fn.wpuiScroller.defaults = {
  411. limiter: false,
  412. adJust: 50
  413. };
  414. /*
  415. * WP UI Pager
  416. */
  417. jQuery.fn.wpuiPager = function( options ) {
  418. var base = this;
  419. base.$el = jQuery( base );
  420. o = jQuery.extend( {} , jQuery.fn.wpuiPager.defaults, options );
  421. base.$el.each(function() {
  422. base.pages = jQuery( this ).children( o.pageClass );
  423. // base.pages.addClass( 'wpui-page-hidden' );
  424. // base.pages.eq( 0 ).removeClass( 'wpui-page-hidden' );
  425. base.pages.hide();
  426. base.pages.eq( 0 ).show();
  427. // Pager
  428. base.pageNum = jQuery( this ).children( o.pageClass ).length;
  429. jQuery( this ).append( '<div class="wpui-pager">' + base.pageNum + ' Pages </div>' );
  430. base.pager = jQuery( this ).find( '.wpui-pager' );
  431. base.wpuiHeight = 0;
  432. base.pages.each(function() {
  433. tisHgt = parseInt( jQuery( this ).css('height') );
  434. if ( tisHgt > base.wpuiHeight )
  435. base.wpuiHeight = tisHgt;
  436. });
  437. base.wpuiHeight <= 0 || base.pages.height( base.wpuiHeight );
  438. pageStr = '';
  439. for( i = 0; i < base.pageNum; i++ ) {
  440. pageNum = i+1;
  441. pageStr += '<a class="wpui-page-number" href="#" rel="' + i + '">' + pageNum + '</a>';
  442. }
  443. base.pager.append( pageStr );
  444. base.pager.append( '<a class="wpui-next-page" href="#">Next &raquo;</a>' );
  445. base.pager.each(function() {
  446. jQuery( this ).find( 'a' ).eq( 0 ).addClass( 'wpui-page-active' );
  447. });
  448. // END base.pager
  449. // // Slide animation
  450. // base.pagesTWidth = Math.round( ( base.pages.length + 1 ) * base.pages.width() );
  451. // base.pageHeight = base.pages.height();
  452. // base.pageWid = base.pages.eq( 0 ).width();
  453. // base.pages.width( base.pages.parent().innerWidth() - 40 );
  454. //
  455. // base.pages
  456. // .parent()
  457. // .wrapInner( '<div class="wpui-pages-wrapper" />' );
  458. //
  459. // base.pages.width( base.pageWid );
  460. //
  461. // base.pages
  462. // .parent()
  463. // .css({ position : 'absolute', width : base.pagesTWidth })
  464. // .parent()
  465. // .css({ position : 'relative', overflow : 'hidden' })
  466. // .height( base.pageHeight );
  467. base.browsePages = function( pageN, el ) {
  468. // console.log( this );
  469. bPage = jQuery( el ).parent().parent().find( o.pageClass );
  470. if ( o.effect == 'fade' ) {
  471. bPage.eq( pageN )
  472. .fadeIn( o.speed )
  473. .siblings( '.wpui-page' )
  474. .hide();
  475. } else if ( o.effect == 'slide' ) {
  476. bPage.eq( pageN )
  477. .slideDown( o.speed )
  478. .siblings( '.wpui-page' )
  479. .hide();
  480. } else {
  481. bPage.eq( pageN ).show().siblings( '.wpui-page' ).hide();
  482. }
  483. jQuery( el ).siblings().removeClass( 'wpui-page-active' );
  484. // console.log( this );
  485. jQuery( el ).addClass( 'wpui-page-active' );
  486. };
  487. base.pager.children( 'a' ).click( function() {
  488. // console.log( base.pages );
  489. pagess = jQuery( this ).parent().parent().find( o.pageClass );
  490. // console.log( pagess );
  491. pagessCount = jQuery( this ).siblings().length;
  492. if ( jQuery( this ).hasClass( 'wpui-next-page' ) ) {
  493. currEl = jQuery( this ).siblings( '.wpui-page-active' );
  494. if ( currEl.attr("rel") == ( pagessCount - 1 ) )
  495. nextEl = jQuery( this ).siblings().eq( 0 );
  496. else
  497. nextEl = currEl.next();
  498. relEL = nextEl.attr( 'rel' );
  499. activeEl = nextEl.get( 0 );
  500. } else {
  501. relEL = jQuery( this ).attr( 'rel' );
  502. activeEl = this;
  503. }
  504. // pagess.addClass( 'wpui-page-hidden' );
  505. // pagess.eq( relEL ).removeClass( 'wpui-page-hidden' );
  506. // // base.$el.find( o.pageClass )
  507. //
  508. // jQuery( this ).siblings().removeClass( 'wpui-page-active' );
  509. // jQuery( this ).addClass( 'wpui-page-active' );
  510. base.browsePages( relEL, activeEl );
  511. return false;
  512. });
  513. });
  514. return this;
  515. };
  516. jQuery.fn.wpuiPager.defaults = {
  517. position : 'bottom',
  518. pageClass : '.wpui-page',
  519. speed : 600,
  520. effect : 'fade'
  521. };
  522. /*
  523. * Component - Accordion
  524. */
  525. jQuery.fn.wpaccord = function( options ) {
  526. var wrapper,
  527. loadLinks,
  528. getAjaxUrl,
  529. o = jQuery.extend({} , jQuery.fn.wpaccord.defaults, options );
  530. this.each(function() {
  531. var $this = jQuery(this);
  532. $this.append('<p id="jqtemp" />');
  533. if ( o.wpuiautop ) {
  534. $this
  535. .find('p, br')
  536. .not('div.wp-tab-content br, div.wp-tab-content p ')
  537. .filter(function() {
  538. return jQuery.trim(jQuery(this).html()) === ''
  539. }).remove();
  540. }
  541. // var wrapcontent = $this.find('h3').next().wrap('<div class="accordion-pre">');
  542. wrapper = $this.find('h3:first').wrap('<div class="accordion">');
  543. // $this.find('p, br').filter(function() {
  544. // return jQuery.trim(jQuery(this).text()) === ''
  545. // }).remove();
  546. if ( o.wpuiautop ) {
  547. $this
  548. .find('p, br')
  549. .not('div.wp-tab-content br, div.wp-tab-content p ')
  550. .filter(function() {
  551. return jQuery.trim(jQuery(this).html()) === ''
  552. }).remove();
  553. }
  554. wrapper.each(function() {
  555. jQuery(this).parent().append( jQuery(this).parent().nextUntil( 'p#jqtemp' ));
  556. });
  557. $this.find(o.h3Class).each(function() {
  558. loadLinks = jQuery(this).children(o.linkAjaxClass);
  559. dup = getNextSet();
  560. aparID = jQuery(this).text().replace(/\s{1,}/gm, '_');
  561. aparID = aparID.replace( /[^\-A-Za-z0-9\s_]/mg, '');
  562. if ( aparID.match( /[^\x00-\x80]+/ ) ) {
  563. aparID = 'acc-' + dup;
  564. }
  565. if ( jQuery.inArray( aparID, accNames ) != '-1' ) {
  566. aparID = aparID + '_' + dup;
  567. }
  568. jQuery(this)
  569. .next()
  570. .attr('id', aparID);
  571. if ( loadLinks.length != 0) {
  572. getAjaxUrl = loadLinks.attr("href");
  573. loadLinks.parent().after('<div></div>');
  574. jQuery(this).next().load(wpUIOpts.wpUrl + "/" + getAjaxUrl);
  575. jQuery(this).text(jQuery(this).children().text());
  576. } // END check loadLinks.length
  577. accNames = accNames.concat( aparID );
  578. }); // END $this h3class.
  579. accordOpts = {};
  580. if ( o.autoHeight ) {
  581. accordOpts.autoHeight = true;
  582. } else {
  583. accordOpts.autoHeight = false;
  584. }
  585. // console.log( accClass.match(/acc-active-(\d){1}/im) );
  586. if ( o.collapse ) {
  587. accordOpts.collapsible = true;
  588. accordOpts.active = false;
  589. }
  590. accordOpts.animated = o.easing;
  591. accordOpts.event = o.accordEvent;
  592. $wpAccord = jQuery( '.accordion' ).accordion(accordOpts);
  593. accClass = $this.attr( 'class' );
  594. if ( activePanel = accClass.match(/acc-active-(\d){1}/im) ) {
  595. $wpAccord.accordion( 'activate', parseInt( activePanel[ 1 ] ) );
  596. }
  597. jQuery('.accordion h3.ui-accordion-header:last').addClass('last-child');
  598. // if ( o.hashChange && typeof jQuery.event.special.hashchange != "undefined" ) {
  599. jQuery( window ).hashchange(function() {
  600. aHash = window.location.hash;
  601. if ( ( jQuery( aHash ).length != 1 ) ||
  602. ( jQuery.inArray( aHash.replace( /^#/, '' ) , accNames ) == -1 )
  603. )
  604. return false;
  605. hashed = jQuery(window.location.hash).prevAll( o.h3Class ).length - 1;
  606. jQuery( window.location.hash ).parent().accordion( 'activate', hashed );
  607. return false;
  608. });
  609. jQuery( window ).hashchange();
  610. // }
  611. // $this.find('p#jqtemp').remove();
  612. });
  613. }; // END Function wpaccord.
  614. jQuery.fn.wpaccord.defaults = {
  615. h3Class : 'h3.wp-tab-title',
  616. linkAjaxClass : 'a.wp-tab-load',
  617. effect : (typeof wpUIOpts != "undefined") ? wpUIOpts.accordEffect : '',
  618. autoHeight : (typeof wpUIOpts != "undefined" && wpUIOpts.accordAutoHeight == 'on' ) ? true : false,
  619. collapse : (typeof wpUIOpts != "undefined" && wpUIOpts.accordCollapsible == 'on' ) ? true : false,
  620. easing : (typeof wpUIOpts != "undefined" ) ? wpUIOpts.accordEasing : '',
  621. accordEvent : ( typeof wpUIOpts != "undefined" ) ? wpUIOpts.accordEvent : '',
  622. wpuiautop : true,
  623. hashChange : true
  624. }; // END wpaccord defaults.
  625. /*
  626. * Component - Spoilers/Collapsibles
  627. */
  628. jQuery.fn.wpspoiler = function( options ) {
  629. var o, defaults, holder, hideText, showText, currText, hideSpan;
  630. o = jQuery.extend({}, jQuery.fn.wpspoiler.defaults, options );
  631. this.each(function() {
  632. var base = this,
  633. $this = jQuery( base );
  634. if ( typeof convertEntities == 'function' ) {
  635. hideText = convertEntities( o.hideText );
  636. showText = convertEntities( o.showText );
  637. } else {
  638. hideText = o.hideText; showText = o.showText;
  639. }
  640. $this.addClass( 'ui-widget ui-collapsible' );
  641. $header = $this.children( o.headerClass );
  642. $header
  643. .addClass( 'ui-collapsible-header' )
  644. .each(function() {
  645. jQuery( this ).prepend( '<span class="ui-icon"></span>' );
  646. jQuery( this )
  647. .addClass( 'ui-state-default ui-corner-all ui-helper-reset' )
  648. .find( 'span.ui-icon', this )
  649. .addClass( o.openIconClass );
  650. jQuery( this )
  651. .append( '<span class="' + o.spanClass.replace(/\./, '') + '" style="float:right"></span>' )
  652. .find( o.spanClass )
  653. .html( showText );
  654. base.aniOpts = {};
  655. if ( o.fade ) base.aniOpts[ 'opacity' ] = 'toggle';
  656. if ( o.slide ) base.aniOpts[ 'height' ] = 'toggle';
  657. if ( o.slide || o.fade ) {
  658. if ( jQuery(this + '[class*=speed-]').length ) {
  659. animSpeed = jQuery(this)
  660. .attr('class')
  661. .match(/speed-(.*)\s|\"/, "$1");
  662. if ( animSpeed ) {
  663. speed = animSpeed[1];
  664. } else {
  665. speed = o.speed;
  666. }
  667. }
  668. }
  669. }).next( 'div' )
  670. .addClass( 'ui-collapsible-content ui-widget-content ui-corner-bottom' )
  671. .wrapInner( '<div class="ui-collapsible-wrapper" />' )
  672. .find( '.close-spoiler')
  673. .addClass('ui-state-default ui-widget ui-corner-all ui-button-text-only' )
  674. .end()
  675. .hide(); // end headerClass each.
  676. $header.hover( function() {
  677. jQuery( this ).addClass( 'ui-state-hover' ).css({ cursor : 'pointer' });
  678. }, function() {
  679. jQuery( this ).removeClass( 'ui-state-hover' );
  680. });
  681. $header.click(function() {
  682. base.headerToggle( this );
  683. });
  684. $this.find( 'a.close-spoiler' ).click(function( e ) {
  685. e.stopPropagation();
  686. e.preventDefault();
  687. heads = jQuery( this ).parent().parent().siblings( o.headerClass ).get(0);
  688. base.headerToggle( heads );
  689. return false;
  690. });
  691. base.headerToggle = function( hel ) {
  692. spanText = jQuery( hel ).find( o.spanClass ).html();
  693. // Toggle the header and icon classes.
  694. jQuery( hel )
  695. .toggleClass( 'ui-state-active ui-corner-all ui-corner-top' )
  696. .children( 'span.ui-icon' )
  697. .toggleClass( o.closeIconClass )
  698. .siblings( o.spanClass )
  699. .html( ( spanText == hideText) ? showText : hideText )
  700. .parent()
  701. .next( 'div.ui-collapsible-content' )
  702. .animate( base.aniOpts , o.speed, o.easing )
  703. .addClass( 'ui-widget-content' );
  704. }; // END headerToggle function.
  705. if ( $this.find( o.headerClass).hasClass( 'open-true' ) ) {
  706. h3 = $this.children( o.headerClass ).get(0);
  707. base.headerToggle( h3 );
  708. } // end check for open-true
  709. }); // this.each function.
  710. return this;
  711. };
  712. jQuery.fn.wpspoiler.defaults = {
  713. // hideText : 'Click to hide',
  714. // showText : 'Click to show',
  715. hideText : (typeof wpUIOpts != "undefined") ? wpUIOpts.spoilerHideText : '',
  716. showText : (typeof wpUIOpts != "undefined") ? wpUIOpts.spoilerShowText : '',
  717. easing : 'easeInOutQuart',
  718. fade : true,
  719. slide : true,
  720. speed : 600,
  721. spanClass: '.toggle_text',
  722. headerClass : 'h3.wp-spoiler-title',
  723. openIconClass : 'ui-icon-triangle-1-e',
  724. closeIconClass : 'ui-icon-triangle-1-s'
  725. };
  726. /**
  727. * The includes below. A lot of thanks to the respective authors.
  728. */
  729. /**
  730. * jQuery Cookie plugin
  731. *
  732. * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
  733. * Dual licensed under the MIT and GPL licenses:
  734. * http://www.opensource.org/licenses/mit-license.php
  735. * http://www.gnu.org/licenses/gpl.html
  736. *
  737. */
  738. // TODO JsDoc
  739. /**
  740. * Create a cookie with the given key and value and other optional parameters.
  741. *
  742. * @example $.cookie('the_cookie', 'the_value');
  743. * @desc Set the value of a cookie.
  744. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
  745. * @desc Create a cookie with all available options.
  746. * @example $.cookie('the_cookie', 'the_value');
  747. * @desc Create a session cookie.
  748. * @example $.cookie('the_cookie', null);
  749. * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
  750. * used when the cookie was set.
  751. *
  752. * @param String key The key of the cookie.
  753. * @param String value The value of the cookie.
  754. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
  755. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
  756. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
  757. * If set to null or omitted, the cookie will be a session cookie and will not be retained
  758. * when the the browser exits.
  759. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
  760. * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
  761. * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
  762. * require a secure protocol (like HTTPS).
  763. * @type undefined
  764. *
  765. * @name $.cookie
  766. * @cat Plugins/Cookie
  767. * @author Klaus Hartl/klaus.hartl@stilbuero.de
  768. */
  769. /**
  770. * Get the value of a cookie with the given key.
  771. *
  772. * @example $.cookie('the_cookie');
  773. * @desc Get the value of a cookie.
  774. *
  775. * @param String key The key of the cookie.
  776. * @return The value of the cookie.
  777. * @type String
  778. *
  779. * @name $.cookie
  780. * @cat Plugins/Cookie
  781. * @author Klaus Hartl/klaus.hartl@stilbuero.de
  782. */
  783. jQuery.cookie = function (key, value, options) {
  784. // key and value given, set cookie...
  785. if (arguments.length > 1 && (value === null || typeof value !== "object")) {
  786. options = jQuery.extend({}, options);
  787. if (value === null) {
  788. options.expires = -1;
  789. }
  790. if (typeof options.expires === 'number') {
  791. var days = options.expires, t = options.expires = new Date();
  792. t.setDate(t.getDate() + days);
  793. }
  794. return (document.cookie = [
  795. encodeURIComponent(key), '=',
  796. options.raw ? String(value) : encodeURIComponent(String(value)),
  797. options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  798. options.path ? '; path=' + options.path : '',
  799. options.domain ? '; domain=' + options.domain : '',
  800. options.secure ? '; secure' : ''
  801. ].join(''));
  802. }
  803. // key and possibly options given, get cookie...
  804. options = value || {};
  805. var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
  806. return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
  807. };
  808. /*
  809. * jQuery hashchange event - v1.3 - 7/21/2010
  810. * http://benalman.com/projects/jquery-hashchange-plugin/
  811. *
  812. * Copyright (c) 2010 "Cowboy" Ben Alman
  813. * Dual licensed under the MIT and GPL licenses.
  814. * http://benalman.com/about/license/
  815. */
  816. (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
  817. /*
  818. * JSON Library
  819. * https://github.com/douglascrockford/JSON-js/blob/master/json2.js
  820. */
  821. var JSON;if(!JSON){JSON={};}
  822. (function(){"use strict";function f(n){return n<10?'0'+n:n;}
  823. if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
  824. f(this.getUTCMonth()+1)+'-'+
  825. f(this.getUTCDate())+'T'+
  826. f(this.getUTCHours())+':'+
  827. f(this.getUTCMinutes())+':'+
  828. f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
  829. var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
  830. function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
  831. if(typeof rep==='function'){value=rep.call(holder,key,value);}
  832. switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
  833. gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
  834. v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
  835. if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
  836. v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
  837. if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
  838. rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
  839. return str('',{'':value});};}
  840. if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
  841. return reviver.call(holder,key,value);}
  842. text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
  843. ('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
  844. if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
  845. throw new SyntaxError('JSON.parse');};}}());
  846. /*
  847. * jQuery hashchange event - v1.3 - 7/21/2010
  848. * http://benalman.com/projects/jquery-hashchange-plugin/
  849. *
  850. * Copyright (c) 2010 "Cowboy" Ben Alman
  851. * Dual licensed under the MIT and GPL licenses.
  852. * http://benalman.com/about/license/
  853. */
  854. (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
  855. /* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
  856. * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  857. * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  858. * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
  859. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
  860. *
  861. * Version: 3.0.2
  862. *
  863. * Requires: 1.2.2+
  864. */
  865. (function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
  866. /**
  867. * Init the scripts.
  868. */
  869. jQuery(document).ready(function( $ ) {
  870. if ( typeof wpUIOpts == 'object' ) {
  871. if ( wpUIOpts.enablePagination == 'on' )
  872. jQuery( 'div.wpui-pages-holder' ).wpuiPager();
  873. if ( wpUIOpts.enableTabs == 'on')
  874. jQuery('div.wp-tabs').wptabs();
  875. if ( wpUIOpts.enableSpoilers == 'on' )
  876. jQuery('.wp-spoiler').wpspoiler();
  877. if ( wpUIOpts.enableAccordion == 'on')
  878. jQuery('.wp-accordion').wpaccord();
  879. // if ( wpUIOpts.enableDialogs == 'on' )
  880. // jQuery('.wp-dialog').wpDialog();
  881. }
  882. jQuery( "ul.wpui-related-posts" ).each(function() {
  883. allWidth = jQuery( this ).children( 'li' ).outerWidth() - jQuery( this ).children('li').width();
  884. if ( jQuery( this ).hasClass( 'wpui-per_3' ) ) {
  885. liWidth = ( jQuery( this ).innerWidth() / 3 ) - allWidth;
  886. } else if ( jQuery( this ).hasClass( 'wpui-per_4' ) ) {
  887. liWidth = ( jQuery( this ).innerWidth() / 4 ) - allWidth;
  888. } else if ( jQuery( this ).hasClass( 'wpui-per_2' ) ) {
  889. liWidth = ( jQuery( this ).innerWidth() / 2 ) - allWidth;
  890. }
  891. if ( typeof( liWidth ) != 'undefined' )
  892. jQuery( this ).children( 'li' ).width( liWidth - 1 );
  893. if ( jQuery( this ).hasClass( 'wpui-per_2' ) ) {
  894. jQuery( this ).children( 'li' ).find( '.wpui-rel-post-meta' ).width( liWidth - 120 );
  895. }
  896. // var soHgt = 0;
  897. // jQuery( this ).children( 'li' ).each(function() {
  898. // soHgt = Math.max( soHgt, jQuery( this ).height());
  899. // }).height( soHgt );
  900. });
  901. });
  902. jQuery.fn.tabsThemeSwitcher = function(classArr) {
  903. return this.each(function() {
  904. var $this = jQuery(this);
  905. $this.prepend('<div class="selector_tab_style">Switch Theme : <select id="tabs_theme_select" /></div>');
  906. for( i=0; i< classArr.length; i++) {
  907. jQuery('#tabs_theme_select', this).append('<option value="' + classArr[i] + '">' + classArr[i] + '</option');
  908. } // END for loop.
  909. if ( jQuery.cookie && jQuery.cookie('tab_demo_style') != null ) {
  910. currentVal = jQuery.cookie('tab_demo_style');
  911. $this.find('select#tabs_theme_select option').each(function() {
  912. if ( currentVal == jQuery(this).attr("value") ) {
  913. jQuery(this).attr( 'selected', 'selected' );
  914. }
  915. });
  916. } else {
  917. currentVal = classArr[0];
  918. } // END cookie value check.
  919. $this.children('.wp-tabs').attr('class', 'wp-tabs wpui-styles').addClass(currentVal, 500);
  920. $this.children('.wp-accordion').attr('class', 'wp-accordion wpui-styles').addClass(currentVal, 500);
  921. $this.children('.wp-spoiler').attr('class', 'wp-spoiler wpui-styles').addClass(currentVal, 500);
  922. jQuery('#tabs_theme_select').change(function(e) {
  923. newVal = jQuery(this).val();
  924. $this.children('.wp-tabs, .wp-accordion, .wp-spoiler').switchClass(currentVal, newVal, 1500);
  925. currentVal = newVal;
  926. if ( jQuery.cookie ) jQuery.cookie('tab_demo_style', newVal, { expires : 2 });
  927. }); // END on select box change.
  928. }); // END each function.
  929. };
  930. //
  931. // var tb_remove = function() {
  932. // // console.log( "Thickbox close fix" );
  933. // jQuery("#TB_imageOff").unbind("click");
  934. // jQuery("#TB_closeWindowButton").unbind("click");
  935. // jQuery("#TB_window")
  936. // .fadeOut("fast",function(){
  937. // jQuery('#TB_window,#TB_overlay,#TB_HideSelect')
  938. // .unload("#TB_ajaxContent")
  939. // .unbind()
  940. // .remove();
  941. // });
  942. // jQuery("#TB_load").remove();
  943. // if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
  944. // jQuery("body","html").css({height: "auto", width: "auto"});
  945. // jQuery("html").css("overflow","");
  946. // }
  947. // jQuery(document).unbind('.thickbox');
  948. // return false;
  949. // } // END function tb_remove()