pen-customize-preview.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  1. /**
  2. * Contains handlers to make Theme Customizer preview reload changes asynchronously.
  3. *
  4. * @package Pen
  5. */
  6. ;( function( $ ) {
  7. function pen_element_header() {
  8. return $( '#pen_header .pen_header_inner' );
  9. }
  10. function pen_element_header_main() {
  11. return $( '#pen_header .pen_header_main' );
  12. }
  13. function pen_element_header_links() {
  14. return pen_element_header_main().find( 'a:not(a#site-title,.pen_phone a)' );
  15. }
  16. function pen_element_header_logo() {
  17. return $( '#pen_header h1 .custom-logo-link' );
  18. }
  19. function pen_element_header_sitetitle() {
  20. return $( '#pen_header h1 a .site-title' );
  21. }
  22. function pen_element_header_sitedescription() {
  23. return $( '#pen_header h1 a .site-description' );
  24. }
  25. function pen_element_header_fields() {
  26. return $( '#pen_header .pen_header_main .search-form .search-field' );
  27. }
  28. function pen_element_phone() {
  29. return $( '.pen_phone' );
  30. }
  31. function pen_element_navigation() {
  32. return $( '#pen_navigation' );
  33. }
  34. function pen_element_navigation_submenu() {
  35. return $( '#pen_navigation ul ul' );
  36. }
  37. function pen_element_navigation_links() {
  38. return $( '#pen_navigation #primary-menu > ul > li > a,#pen_navigation ul.menu > li > a' );
  39. }
  40. function pen_element_navigation_links_submenu() {
  41. return $( '#pen_navigation li li a' );
  42. }
  43. function pen_element_search_bar() {
  44. return $( '#pen_search' );
  45. }
  46. function pen_element_search_bar_links() {
  47. return $( '#pen_search a' );
  48. }
  49. function pen_element_search_bar_field() {
  50. return $( '#pen_search .search-form .search-field' );
  51. }
  52. function pen_element_content() {
  53. return $( '#main .page-content,#main .pen_article_wrapper > article,body.pen_list_masonry #pen_masonry article,#comments,body.pen_list_plain #pen_pager' );
  54. }
  55. function pen_element_content_title() {
  56. return $( '#main article header' );
  57. }
  58. function pen_element_content_title_link() {
  59. return $( '#main article header a' );
  60. }
  61. function pen_element_content_links() {
  62. return $( '#primary a:not(.pen_tabs a,header a)' );
  63. }
  64. function pen_element_content_fields() {
  65. return $( '#main input:not([type="button"],[type="submit"]), #main option, #main select, #main textarea' );
  66. }
  67. function pen_element_bottom() {
  68. return $( '#pen_bottom' );
  69. }
  70. function pen_element_bottom_headings() {
  71. return $( '#pen_bottom .pen_widget_transparent h3,#bottom .pen_widget_transparent h4,#bottom .pen_widget_transparent h5' );
  72. }
  73. function pen_element_bottom_links() {
  74. return $( '#pen_bottom a' );
  75. }
  76. function pen_element_bottom_fields() {
  77. return $( '#pen_bottom input:not([type="button"],[type="submit"]),#pen_bottom option,#pen_bottom select,#pen_bottom textarea' );
  78. }
  79. function pen_element_footer() {
  80. return $( '#pen_footer' );
  81. }
  82. function pen_element_go_to_top() {
  83. return $( 'a#pen_back' );
  84. }
  85. function pen_element_footer_menu() {
  86. return $( '#pen_footer_menu' );
  87. }
  88. function pen_element_footer_copyright() {
  89. return $( '#pen_footer .site-info' );
  90. }
  91. function pen_element_footer_links() {
  92. return $( '#pen_footer a' );
  93. }
  94. function pen_css_background_gradient( color_primary, color_secondary, direction ) {
  95. return 'linear-gradient(' + direction + ', ' + color_primary + ' 0%, ' + color_secondary + ' 100%';
  96. }
  97. function pen_apply_link_color( $element, link_color, link_color_hover ) {
  98. $element.css(
  99. {
  100. color: link_color
  101. }
  102. )
  103. .off( 'mouseenter mouseleave' )
  104. .on(
  105. 'mouseenter',
  106. function() {
  107. $( this ).css(
  108. {
  109. color: link_color_hover
  110. }
  111. );
  112. }
  113. )
  114. .on(
  115. 'mouseleave',
  116. function() {
  117. $( this ).css(
  118. {
  119. color: link_color
  120. }
  121. );
  122. }
  123. );
  124. }
  125. function pen_option_get( option ) {
  126. var preset = ( option.substr( 0, 5 ) === 'color' ) ? pen_preview_js.preset_color : 'preset_1', /* Packaging Difference. */
  127. element = wp.customize( 'pen_' + option + '[' + preset + ']' );
  128. if ( element === 'undefined' || element === undefined || element === null ) {
  129. console.log( option );
  130. }
  131. return wp.customize( 'pen_' + option + '[' + preset + ']' )();
  132. }
  133. /**
  134. * After each page load.
  135. */
  136. wp.customize.bind(
  137. 'preview-ready',
  138. function() {
  139. $( '#page' ).find( 'a.pen_customizer_shortcut' ).each(
  140. function() {
  141. $( this ).on(
  142. 'click',
  143. function( event ) {
  144. var data = $( this ).data();
  145. wp.customize.preview.send( 'pen_switch_section', { type: data.type, target: data.target } );
  146. event.preventDefault();
  147. }
  148. );
  149. }
  150. );
  151. wp.customize.preview.bind(
  152. 'pen_section_change',
  153. function( data ) {
  154. if ( $( data.selector ).length ) {
  155. $( 'html, body' ).stop().animate(
  156. {
  157. scrollTop: $( data.selector ).offset().top
  158. },
  159. 500
  160. );
  161. }
  162. }
  163. );
  164. /**
  165. * Logo.
  166. */
  167. var pen_logo_source = pen_element_header_logo().find( 'img' ).attr( 'src' );
  168. if ( pen_logo_source === 'undefined' || pen_logo_source === undefined || pen_logo_source === null ) {
  169. $( '#pen_header' ).removeClass( 'pen_has_logo' );
  170. } else {
  171. $( '#pen_header' ).addClass( 'pen_has_logo' );
  172. }
  173. /**
  174. * General.
  175. */
  176. $( 'body' ).css(
  177. {
  178. backgroundColor: pen_option_get( 'color_site_background' )
  179. }
  180. );
  181. /**
  182. * Layout
  183. */
  184. $( 'body' ).removeClass(
  185. function( index, css ) {
  186. return ( css.match( /(^|\s)pen_width_\S+/g ) || [] ).join( ' ' );
  187. }
  188. ).addClass( 'pen_width_' + pen_option_get( 'site_width' ) );
  189. $( 'body' ).removeClass(
  190. function( index, css ) {
  191. return ( css.match( /(^|\s)pen_main_container_\S+/g ) || [] ).join( ' ' );
  192. }
  193. ).addClass( 'pen_main_container_' + pen_option_get( 'container_position' ) );
  194. /**
  195. * Header.
  196. */
  197. $( 'body' ).removeClass(
  198. function( index, css ) {
  199. return ( css.match( /(^|\s)pen_header_alignment_\S+/g ) || [] ).join( ' ' );
  200. }
  201. ).addClass( 'pen_header_alignment_' + pen_option_get( 'header_alignment' ) );
  202. pen_element_header_main().css(
  203. {
  204. color: pen_option_get( 'color_header_text' ),
  205. textShadow: ( ! pen_option_get( 'color_header_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_header_text_shadow' )
  206. }
  207. );
  208. pen_apply_link_color( pen_element_header_links(), pen_option_get( 'color_header_link' ), pen_option_get( 'color_header_link_hover' ) );
  209. pen_apply_link_color( pen_element_header_sitetitle(), pen_option_get( 'color_header_sitetitle' ), pen_option_get( 'color_header_sitetitle_hover' ) );
  210. pen_apply_link_color( pen_element_header_sitedescription(), pen_option_get( 'color_header_sitedescription' ), pen_option_get( 'color_header_sitedescription_hover' ) );
  211. pen_apply_link_color( pen_element_header().find( pen_element_phone() ).children( 'a' ), pen_option_get( 'color_header_phone' ), pen_option_get( 'color_header_phone_hover' ) );
  212. pen_element_header_fields().css(
  213. {
  214. background: pen_css_background_gradient( pen_option_get( 'color_header_field_background_primary' ), pen_option_get( 'color_header_field_background_secondary' ), 'to bottom' ),
  215. color: pen_option_get( 'color_header_field_text' )
  216. }
  217. );
  218. /**
  219. * Navigation.
  220. */
  221. $( 'body' ).removeClass(
  222. function( index, css ) {
  223. return ( css.match( /(^|\s)pen_navigation_alignment_\S+/g ) || [] ).join( ' ' );
  224. }
  225. ).addClass( 'pen_navigation_alignment_' + pen_option_get( 'navigation_alignment' ) );
  226. pen_element_navigation_links().css(
  227. {
  228. textShadow: ( ! pen_option_get( 'color_navigation_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_navigation_text_shadow' )
  229. }
  230. );
  231. pen_apply_link_color( pen_element_navigation_links_submenu(), pen_option_get( 'color_navigation_link_submenu' ), pen_option_get( 'color_navigation_link_hover_submenu' ) );
  232. pen_element_navigation_links_submenu().css(
  233. {
  234. textShadow: ( ! pen_option_get( 'color_navigation_text_shadow_display_submenu' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_navigation_text_shadow_submenu' )
  235. }
  236. );
  237. /**
  238. * Search bar.
  239. */
  240. pen_element_search_bar().css(
  241. {
  242. color: pen_option_get( 'color_search_text' ),
  243. textShadow: ( ! pen_option_get( 'color_search_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_search_text_shadow' )
  244. }
  245. );
  246. pen_apply_link_color( pen_element_search_bar_links(), pen_option_get( 'color_search_link' ), pen_option_get( 'color_search_link_hover' ) );
  247. pen_element_search_bar_field().css(
  248. {
  249. background: pen_css_background_gradient( pen_option_get( 'color_search_field_background_primary' ), pen_option_get( 'color_search_field_background_secondary' ), 'to bottom' )
  250. }
  251. );
  252. pen_element_search_bar_field().css(
  253. {
  254. color: pen_option_get( 'color_search_field_text' )
  255. }
  256. );
  257. /**
  258. * Content area.
  259. */
  260. pen_element_content().css(
  261. {
  262. background: pen_option_get( 'color_content_background_primary' )
  263. }
  264. )
  265. .find( '.entry-content,.entry-summary,.page-content,.entry-footer,label' ).css(
  266. {
  267. color: pen_option_get( 'color_content_text' )
  268. }
  269. );
  270. pen_apply_link_color( pen_element_content_links(), pen_option_get( 'color_content_link' ), pen_option_get( 'color_content_link_hover' ) );
  271. pen_element_content_title().css(
  272. {
  273. background: pen_css_background_gradient( pen_option_get( 'color_content_title_background_primary' ), pen_option_get( 'color_content_title_background_secondary' ), pen_option_get( 'color_content_title_background_angle' ) ),
  274. color: pen_option_get( 'color_content_title_text' )
  275. }
  276. )
  277. .children( '.entry-title' ).css(
  278. {
  279. textShadow: ( ! pen_option_get( 'color_content_title_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_content_title_text_shadow' )
  280. }
  281. );
  282. pen_apply_link_color( pen_element_content_title_link(), pen_option_get( 'color_content_title_link' ), pen_option_get( 'color_content_title_link_hover' ) );
  283. pen_element_content_fields().css(
  284. {
  285. background: pen_css_background_gradient( pen_option_get( 'color_content_field_background_primary' ), pen_option_get( 'color_content_field_background_secondary' ), 'to bottom' )
  286. }
  287. );
  288. pen_element_content_fields().css(
  289. {
  290. color: pen_option_get( 'color_content_field_text' )
  291. }
  292. );
  293. /**
  294. * Bottom widget area.
  295. */
  296. pen_element_bottom().css(
  297. {
  298. color: pen_option_get( 'color_bottom_text' )
  299. }
  300. );
  301. pen_apply_link_color( pen_element_bottom_links(), pen_option_get( 'color_bottom_link' ), pen_option_get( 'color_bottom_link_hover' ) );
  302. pen_element_bottom().css(
  303. {
  304. textShadow: ( ! pen_option_get( 'color_bottom_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_bottom_text_shadow' )
  305. }
  306. );
  307. pen_element_bottom_headings().css(
  308. {
  309. color: pen_option_get( 'color_bottom_headings' ),
  310. textShadow: ( ! pen_option_get( 'color_bottom_headings_text_shadow_display' ) ) ? 'none' : '1px 1px 1px ' + pen_option_get( 'color_bottom_headings_text_shadow' )
  311. }
  312. );
  313. pen_element_bottom_fields().css(
  314. {
  315. background: pen_css_background_gradient( pen_option_get( 'color_bottom_field_background_primary' ), pen_option_get( 'color_bottom_field_background_secondary' ), 'to bottom' ),
  316. color: pen_option_get( 'color_bottom_field_text' )
  317. }
  318. );
  319. /**
  320. * Footer.
  321. */
  322. $( 'body' ).removeClass(
  323. function( index, css ) {
  324. return ( css.match( /(^|\s)pen_footer_alignment_\S+/g ) || [] ).join( ' ' );
  325. }
  326. ).addClass( 'pen_footer_alignment_' + pen_option_get( 'footer_alignment' ) );
  327. if ( pen_option_get( 'footer_menu_display' ) ) {
  328. pen_element_footer_menu().show();
  329. } else {
  330. pen_element_footer_menu().hide();
  331. }
  332. if ( pen_option_get( 'footer_copyright_display' ) ) {
  333. pen_element_footer_copyright().show();
  334. } else {
  335. pen_element_footer_copyright().hide();
  336. }
  337. /**
  338. * Footer colors.
  339. */
  340. pen_element_footer().css(
  341. {
  342. color: pen_option_get( 'color_footer_text' )
  343. }
  344. );
  345. var pen_color_footer_link = pen_option_get( 'color_footer_link' ),
  346. pen_color_footer_text_shadow = pen_option_get( 'color_footer_text_shadow' ),
  347. pen_color_footer_text_shadow_display = pen_option_get( 'color_footer_text_shadow_display' );
  348. pen_element_footer().css(
  349. {
  350. textShadow: ( ! pen_color_footer_text_shadow_display ) ? 'none' : '1px 1px 1px ' + pen_color_footer_text_shadow
  351. }
  352. );
  353. var pen_color_footer_background_secondary = pen_option_get( 'color_footer_background_secondary' );
  354. pen_element_go_to_top().css(
  355. {
  356. background: pen_color_footer_background_secondary,
  357. boxShadow: '0 0 10px ' + pen_color_footer_background_secondary,
  358. color: pen_color_footer_link,
  359. textShadow: ( ! pen_color_footer_text_shadow_display ) ? 'none' : '1px 1px 1px ' + pen_color_footer_text_shadow,
  360. }
  361. );
  362. }
  363. );
  364. /**
  365. * Logo.
  366. */
  367. wp.customize(
  368. 'custom_logo',
  369. function( value ) {
  370. value.bind(
  371. function( logo ) {
  372. if ( logo ) {
  373. $( '#pen_header' ).addClass( 'pen_has_logo' );
  374. } else {
  375. $( '#pen_header' ).removeClass( 'pen_has_logo' );
  376. }
  377. }
  378. );
  379. }
  380. );
  381. /**
  382. * General.
  383. */
  384. wp.customize(
  385. 'pen_color_site_background[' + pen_preview_js.preset_color + ']',
  386. function( value ) {
  387. value.bind(
  388. function( color ) {
  389. $( 'body' ).css(
  390. {
  391. backgroundColor: color
  392. }
  393. );
  394. }
  395. );
  396. }
  397. );
  398. /**
  399. * Layout.
  400. */
  401. wp.customize(
  402. 'pen_site_width[preset_1]',
  403. function( value ) {
  404. value.bind(
  405. function( position ) {
  406. $( 'body' ).removeClass(
  407. function( index, css ) {
  408. return ( css.match( /(^|\s)pen_width_\S+/g ) || [] ).join( ' ' );
  409. }
  410. ).addClass( 'pen_width_' + position );
  411. }
  412. );
  413. }
  414. );
  415. wp.customize(
  416. 'pen_container_position[preset_1]',
  417. function( value ) {
  418. value.bind(
  419. function( position ) {
  420. $( 'body' ).removeClass(
  421. function( index, css ) {
  422. return ( css.match( /(^|\s)pen_main_container_\S+/g ) || [] ).join( ' ' );
  423. }
  424. ).addClass( 'pen_main_container_' + position );
  425. }
  426. );
  427. }
  428. );
  429. /**
  430. * Header.
  431. */
  432. wp.customize(
  433. 'pen_header_alignment[preset_1]',
  434. function( value ) {
  435. value.bind(
  436. function( position ) {
  437. $( 'body' ).removeClass(
  438. function( index, css ) {
  439. return ( css.match( /(^|\s)pen_header_alignment_\S+/g ) || [] ).join( ' ' );
  440. }
  441. ).addClass( 'pen_header_alignment_' + position );
  442. }
  443. );
  444. }
  445. );
  446. /**
  447. * Header colors.
  448. */
  449. wp.customize(
  450. 'pen_color_header_text[' + pen_preview_js.preset_color + ']',
  451. function( value ) {
  452. value.bind(
  453. function( text_color ) {
  454. pen_element_header_main().css(
  455. {
  456. color: text_color
  457. }
  458. );
  459. }
  460. );
  461. }
  462. );
  463. wp.customize(
  464. 'pen_color_header_link[' + pen_preview_js.preset_color + ']',
  465. function( value ) {
  466. value.bind(
  467. function( pen_color_header_link ) {
  468. var pen_color_header_link_hover = pen_option_get( 'color_header_link_hover' );
  469. pen_apply_link_color( pen_element_header_links(), pen_color_header_link, pen_color_header_link_hover );
  470. }
  471. );
  472. }
  473. );
  474. wp.customize(
  475. 'pen_color_header_link_hover[' + pen_preview_js.preset_color + ']',
  476. function( value ) {
  477. value.bind(
  478. function( pen_color_header_link_hover ) {
  479. var pen_color_header_link = pen_option_get( 'color_header_link' );
  480. pen_apply_link_color( pen_element_header_links(), pen_color_header_link, pen_color_header_link_hover );
  481. }
  482. );
  483. }
  484. );
  485. wp.customize(
  486. 'pen_color_header_sitetitle[' + pen_preview_js.preset_color + ']',
  487. function( value ) {
  488. value.bind(
  489. function( pen_color_header_sitetitle ) {
  490. var pen_color_header_sitetitle_hover = pen_option_get( 'color_header_sitetitle_hover' );
  491. pen_apply_link_color( pen_element_header_sitetitle(), pen_color_header_sitetitle, pen_color_header_sitetitle_hover );
  492. }
  493. );
  494. }
  495. );
  496. wp.customize(
  497. 'pen_color_header_sitetitle_hover[' + pen_preview_js.preset_color + ']',
  498. function( value ) {
  499. value.bind(
  500. function( pen_color_header_sitetitle_hover ) {
  501. var pen_color_header_sitetitle = pen_option_get( 'color_header_sitetitle' );
  502. pen_apply_link_color( pen_element_header_sitetitle(), pen_color_header_sitetitle, pen_color_header_sitetitle_hover );
  503. }
  504. );
  505. }
  506. );
  507. wp.customize(
  508. 'pen_color_header_sitedescription[' + pen_preview_js.preset_color + ']',
  509. function( value ) {
  510. value.bind(
  511. function( pen_color_header_sitedescription ) {
  512. var pen_color_header_sitedescription_hover = pen_option_get( 'color_header_sitedescription_hover' );
  513. pen_apply_link_color( pen_element_header_sitedescription(), pen_color_header_sitedescription, pen_color_header_sitedescription_hover );
  514. }
  515. );
  516. }
  517. );
  518. wp.customize(
  519. 'pen_color_header_sitedescription_hover[' + pen_preview_js.preset_color + ']',
  520. function( value ) {
  521. value.bind(
  522. function( pen_color_header_sitedescription_hover ) {
  523. var pen_color_header_sitedescription = pen_option_get( 'color_header_sitedescription' );
  524. pen_apply_link_color( pen_element_header_sitedescription(), pen_color_header_sitedescription, pen_color_header_sitedescription_hover );
  525. }
  526. );
  527. }
  528. );
  529. wp.customize(
  530. 'pen_color_header_phone[' + pen_preview_js.preset_color + ']',
  531. function( value ) {
  532. value.bind(
  533. function( pen_color_header_phone ) {
  534. var pen_color_header_phone_hover = pen_option_get( 'color_header_phone_hover' );
  535. pen_apply_link_color( pen_element_header().find( pen_element_phone() ).children( 'a' ), pen_color_header_phone, pen_color_header_phone_hover );
  536. }
  537. );
  538. }
  539. );
  540. wp.customize(
  541. 'pen_color_header_phone_hover[' + pen_preview_js.preset_color + ']',
  542. function( value ) {
  543. value.bind(
  544. function( pen_color_header_phone_hover ) {
  545. var pen_color_header_phone = pen_option_get( 'color_header_phone' );
  546. pen_apply_link_color( pen_element_header().find( pen_element_phone() ).children( 'a' ), pen_color_header_phone, pen_color_header_phone_hover );
  547. }
  548. );
  549. }
  550. );
  551. wp.customize(
  552. 'pen_color_header_field_background_primary[' + pen_preview_js.preset_color + ']',
  553. function( value ) {
  554. value.bind(
  555. function( top ) {
  556. var bottom = pen_option_get( 'color_header_field_background_secondary' );
  557. pen_element_header_fields().css(
  558. {
  559. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  560. }
  561. );
  562. }
  563. );
  564. }
  565. );
  566. wp.customize(
  567. 'pen_color_header_field_background_secondary[' + pen_preview_js.preset_color + ']',
  568. function( value ) {
  569. value.bind(
  570. function( bottom ) {
  571. var top = pen_option_get( 'color_header_field_background_primary' );
  572. pen_element_header_fields().css(
  573. {
  574. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  575. }
  576. );
  577. }
  578. );
  579. }
  580. );
  581. wp.customize(
  582. 'pen_color_header_field_text[' + pen_preview_js.preset_color + ']',
  583. function( value ) {
  584. value.bind(
  585. function( text_color ) {
  586. pen_element_header_fields().css(
  587. {
  588. color: text_color
  589. }
  590. );
  591. }
  592. );
  593. }
  594. );
  595. wp.customize(
  596. 'pen_color_header_text_shadow[' + pen_preview_js.preset_color + ']',
  597. function( value ) {
  598. value.bind(
  599. function( shadow_color ) {
  600. var shadow_display = pen_option_get( 'color_header_text_shadow_display' );
  601. if ( shadow_display ) {
  602. pen_element_header_main().css(
  603. {
  604. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  605. }
  606. );
  607. }
  608. }
  609. );
  610. }
  611. );
  612. wp.customize(
  613. 'pen_color_header_text_shadow_display[' + pen_preview_js.preset_color + ']',
  614. function( value ) {
  615. value.bind(
  616. function( shadow_display ) {
  617. var shadow_color = pen_option_get( 'color_header_text_shadow' );
  618. pen_element_header_main().css(
  619. {
  620. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  621. }
  622. );
  623. }
  624. );
  625. }
  626. );
  627. /**
  628. * Navigation.
  629. */
  630. wp.customize(
  631. 'pen_navigation_alignment[preset_1]',
  632. function( value ) {
  633. value.bind(
  634. function( position ) {
  635. $( 'body' ).removeClass(
  636. function( index, css ) {
  637. return ( css.match( /(^|\s)pen_navigation_alignment_\S+/g ) || [] ).join( ' ' );
  638. }
  639. ).addClass( 'pen_navigation_alignment_' + position );
  640. }
  641. );
  642. }
  643. );
  644. /**
  645. * Navigation colors.
  646. */
  647. wp.customize(
  648. 'pen_color_navigation_link_hover[' + pen_preview_js.preset_color + ']',
  649. function( value ) {
  650. value.bind(
  651. function( pen_color_navigation_link_hover ) {
  652. var pen_color_navigation_link = pen_option_get( 'color_navigation_link' );
  653. pen_apply_link_color( pen_element_navigation_links(), pen_color_navigation_link, pen_color_navigation_link_hover );
  654. }
  655. );
  656. }
  657. );
  658. wp.customize(
  659. 'pen_color_navigation_text_shadow[' + pen_preview_js.preset_color + ']',
  660. function( value ) {
  661. value.bind(
  662. function( shadow_color ) {
  663. var shadow_display = pen_option_get( 'color_navigation_text_shadow_display' );
  664. if ( shadow_display ) {
  665. pen_element_navigation_links().css(
  666. {
  667. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  668. }
  669. );
  670. }
  671. }
  672. );
  673. }
  674. );
  675. wp.customize(
  676. 'pen_color_navigation_text_shadow_display[' + pen_preview_js.preset_color + ']',
  677. function( value ) {
  678. value.bind(
  679. function( shadow_display ) {
  680. var shadow_color = pen_option_get( 'color_navigation_text_shadow' );
  681. pen_element_navigation_links().css(
  682. {
  683. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  684. }
  685. );
  686. }
  687. );
  688. }
  689. );
  690. wp.customize(
  691. 'pen_color_navigation_link_submenu[' + pen_preview_js.preset_color + ']',
  692. function( value ) {
  693. value.bind(
  694. function( pen_color_navigation_link_submenu ) {
  695. var pen_color_navigation_link_hover_submenu = pen_option_get( 'color_navigation_link_hover_submenu' );
  696. pen_apply_link_color( pen_element_navigation_links_submenu(), pen_color_navigation_link_submenu, pen_color_navigation_link_hover_submenu );
  697. }
  698. );
  699. }
  700. );
  701. wp.customize(
  702. 'pen_color_navigation_link_hover_submenu[' + pen_preview_js.preset_color + ']',
  703. function( value ) {
  704. value.bind(
  705. function( pen_color_navigation_link_hover_submenu ) {
  706. var pen_color_navigation_link_submenu = pen_option_get( 'color_navigation_link_submenu' );
  707. pen_apply_link_color( pen_element_navigation_links_submenu(), pen_color_navigation_link_submenu, pen_color_navigation_link_hover_submenu );
  708. }
  709. );
  710. }
  711. );
  712. wp.customize(
  713. 'pen_color_navigation_text_shadow_submenu[' + pen_preview_js.preset_color + ']',
  714. function( value ) {
  715. value.bind(
  716. function( shadow_color ) {
  717. var shadow_display = pen_option_get( 'color_navigation_text_shadow_display_submenu' );
  718. if ( shadow_display ) {
  719. pen_element_navigation_links_submenu().css(
  720. {
  721. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  722. }
  723. );
  724. }
  725. }
  726. );
  727. }
  728. );
  729. wp.customize(
  730. 'pen_color_navigation_text_shadow_display_submenu[' + pen_preview_js.preset_color + ']',
  731. function( value ) {
  732. value.bind(
  733. function( shadow_display ) {
  734. var shadow_color = pen_option_get( 'color_navigation_text_shadow_submenu' );
  735. pen_element_navigation_links_submenu().css(
  736. {
  737. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  738. }
  739. );
  740. }
  741. );
  742. }
  743. );
  744. /**
  745. * Search bar colors.
  746. */
  747. wp.customize(
  748. 'pen_color_search_text[' + pen_preview_js.preset_color + ']',
  749. function( value ) {
  750. value.bind(
  751. function( text_color ) {
  752. pen_element_search_main().css(
  753. {
  754. color: text_color
  755. }
  756. );
  757. }
  758. );
  759. }
  760. );
  761. wp.customize(
  762. 'pen_color_search_link[' + pen_preview_js.preset_color + ']',
  763. function( value ) {
  764. value.bind(
  765. function( pen_color_search_link ) {
  766. var pen_color_search_link_hover = pen_option_get( 'color_search_link_hover' );
  767. pen_apply_link_color( pen_element_search_bar_links(), pen_color_search_link, pen_color_search_link_hover );
  768. }
  769. );
  770. }
  771. );
  772. wp.customize(
  773. 'pen_color_search_link_hover[' + pen_preview_js.preset_color + ']',
  774. function( value ) {
  775. value.bind(
  776. function( pen_color_search_link_hover ) {
  777. var pen_color_search_link = pen_option_get( 'color_search_link' );
  778. pen_apply_link_color( pen_element_search_bar_links(), pen_color_search_link, pen_color_search_link_hover );
  779. }
  780. );
  781. }
  782. );
  783. wp.customize(
  784. 'pen_color_search_field_background_primary[' + pen_preview_js.preset_color + ']',
  785. function( value ) {
  786. value.bind(
  787. function( top ) {
  788. var bottom = pen_option_get( 'color_search_field_background_secondary' );
  789. pen_element_search_bar_field().css(
  790. {
  791. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  792. }
  793. );
  794. }
  795. );
  796. }
  797. );
  798. wp.customize(
  799. 'pen_color_search_field_background_secondary[' + pen_preview_js.preset_color + ']',
  800. function( value ) {
  801. value.bind(
  802. function( bottom ) {
  803. var top = pen_option_get( 'color_search_field_background_primary' );
  804. pen_element_search_bar_field().css(
  805. {
  806. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  807. }
  808. );
  809. }
  810. );
  811. }
  812. );
  813. wp.customize(
  814. 'pen_color_search_field_text[' + pen_preview_js.preset_color + ']',
  815. function( value ) {
  816. value.bind(
  817. function( text_color ) {
  818. pen_element_search_bar_field().css(
  819. {
  820. color: text_color
  821. }
  822. );
  823. }
  824. );
  825. }
  826. );
  827. wp.customize(
  828. 'pen_color_search_text_shadow[' + pen_preview_js.preset_color + ']',
  829. function( value ) {
  830. value.bind(
  831. function( shadow_color ) {
  832. var shadow_display = pen_option_get( 'color_search_text_shadow_display' );
  833. if ( shadow_display ) {
  834. pen_element_search_main().css(
  835. {
  836. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  837. }
  838. );
  839. }
  840. }
  841. );
  842. }
  843. );
  844. wp.customize(
  845. 'pen_color_search_text_shadow_display[' + pen_preview_js.preset_color + ']',
  846. function( value ) {
  847. value.bind(
  848. function( shadow_display ) {
  849. var shadow_color = pen_option_get( 'color_search_text_shadow' );
  850. pen_element_search_main().css(
  851. {
  852. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  853. }
  854. );
  855. }
  856. );
  857. }
  858. );
  859. /**
  860. * Content area.
  861. */
  862. wp.customize(
  863. 'pen_color_content_title_background_primary[' + pen_preview_js.preset_color + ']',
  864. function( value ) {
  865. value.bind(
  866. function( primary ) {
  867. var secondary = pen_option_get( 'color_content_title_background_secondary' ),
  868. angle = pen_option_get( 'color_content_title_background_angle' );
  869. pen_element_content_title().css(
  870. {
  871. background: pen_css_background_gradient( primary, secondary, angle )
  872. }
  873. );
  874. }
  875. );
  876. }
  877. );
  878. wp.customize(
  879. 'pen_color_content_title_background_secondary[' + pen_preview_js.preset_color + ']',
  880. function( value ) {
  881. value.bind(
  882. function( secondary ) {
  883. var primary = pen_option_get( 'color_content_title_background_primary' ),
  884. angle = pen_option_get( 'color_content_title_background_angle' );
  885. pen_element_content_title().css(
  886. {
  887. background: pen_css_background_gradient( primary, secondary, angle )
  888. }
  889. );
  890. }
  891. );
  892. }
  893. );
  894. wp.customize(
  895. 'pen_color_content_title_background_angle[' + pen_preview_js.preset_color + ']',
  896. function( value ) {
  897. value.bind(
  898. function( angle ) {
  899. var primary = pen_option_get( 'color_content_title_background_primary' ),
  900. secondary = pen_option_get( 'color_content_title_background_secondary' );
  901. pen_element_content_title().css(
  902. {
  903. background: pen_css_background_gradient( primary, secondary, angle )
  904. }
  905. );
  906. }
  907. );
  908. }
  909. );
  910. wp.customize(
  911. 'pen_color_content_title_link[' + pen_preview_js.preset_color + ']',
  912. function( value ) {
  913. value.bind(
  914. function( pen_color_content_title_link ) {
  915. var pen_color_content_title_link_hover = pen_option_get( 'color_content_title_link_hover' );
  916. pen_apply_link_color( pen_element_content_title_link(), pen_color_content_title_link, pen_color_content_title_link_hover );
  917. }
  918. );
  919. }
  920. );
  921. wp.customize(
  922. 'pen_color_content_title_link_hover[' + pen_preview_js.preset_color + ']',
  923. function( value ) {
  924. value.bind(
  925. function( pen_color_content_title_link_hover ) {
  926. var pen_color_content_title_link = pen_option_get( 'color_content_title_link' );
  927. pen_apply_link_color( pen_element_content_title_link(), pen_color_content_title_link, pen_color_content_title_link_hover );
  928. }
  929. );
  930. }
  931. );
  932. wp.customize(
  933. 'pen_color_content_title_text[' + pen_preview_js.preset_color + ']',
  934. function( value ) {
  935. value.bind(
  936. function( text_color ) {
  937. pen_element_content_title().css(
  938. {
  939. color: text_color
  940. }
  941. );
  942. }
  943. );
  944. }
  945. );
  946. wp.customize(
  947. 'pen_color_content_title_text_shadow[' + pen_preview_js.preset_color + ']',
  948. function( value ) {
  949. value.bind(
  950. function( shadow_color ) {
  951. var shadow_display = pen_option_get( 'color_content_title_text_shadow_display' );
  952. if ( shadow_display ) {
  953. pen_element_content_title().children( '.entry-title' ).css(
  954. {
  955. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  956. }
  957. );
  958. }
  959. }
  960. );
  961. }
  962. );
  963. wp.customize(
  964. 'pen_color_content_title_text_shadow_display[' + pen_preview_js.preset_color + ']',
  965. function( value ) {
  966. value.bind(
  967. function( shadow_display ) {
  968. var shadow_color = pen_option_get( 'color_content_title_text_shadow' );
  969. pen_element_content_title().children( '.entry-title' ).css(
  970. {
  971. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  972. }
  973. );
  974. }
  975. );
  976. }
  977. );
  978. wp.customize(
  979. 'pen_color_content_background_primary[' + pen_preview_js.preset_color + ']',
  980. function( value ) {
  981. value.bind(
  982. function( color ) {
  983. pen_element_content().css(
  984. {
  985. background: color
  986. }
  987. );
  988. }
  989. );
  990. }
  991. );
  992. wp.customize(
  993. 'pen_color_content_text[' + pen_preview_js.preset_color + ']',
  994. function( value ) {
  995. value.bind(
  996. function( text_color ) {
  997. pen_element_content().find( '.entry-content,.entry-summary,.page-content,.entry-footer,label' ).css(
  998. {
  999. color: text_color
  1000. }
  1001. );
  1002. }
  1003. );
  1004. }
  1005. );
  1006. wp.customize(
  1007. 'pen_color_content_link[' + pen_preview_js.preset_color + ']',
  1008. function( value ) {
  1009. value.bind(
  1010. function( pen_color_content_link ) {
  1011. var pen_color_content_link_hover = pen_option_get( 'color_content_link_hover' );
  1012. pen_apply_link_color( pen_element_content_links(), pen_color_content_link, pen_color_content_link_hover );
  1013. }
  1014. );
  1015. }
  1016. );
  1017. wp.customize(
  1018. 'pen_color_content_link_hover[' + pen_preview_js.preset_color + ']',
  1019. function( value ) {
  1020. value.bind(
  1021. function( pen_color_content_link_hover ) {
  1022. var pen_color_content_link = pen_option_get( 'color_content_link' );
  1023. pen_apply_link_color( pen_element_content_links(), pen_color_content_link, pen_color_content_link_hover );
  1024. }
  1025. );
  1026. }
  1027. );
  1028. wp.customize(
  1029. 'pen_color_content_field_background_primary[' + pen_preview_js.preset_color + ']',
  1030. function( value ) {
  1031. value.bind(
  1032. function( top ) {
  1033. var bottom = pen_option_get( 'color_content_field_background_secondary' );
  1034. pen_element_content_fields().css(
  1035. {
  1036. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  1037. }
  1038. );
  1039. }
  1040. );
  1041. }
  1042. );
  1043. wp.customize(
  1044. 'pen_color_content_field_background_secondary[' + pen_preview_js.preset_color + ']',
  1045. function( value ) {
  1046. value.bind(
  1047. function( bottom ) {
  1048. var top = pen_option_get( 'color_content_field_background_primary' );
  1049. pen_element_content_fields().css(
  1050. {
  1051. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  1052. }
  1053. );
  1054. }
  1055. );
  1056. }
  1057. );
  1058. wp.customize(
  1059. 'pen_color_content_field_text[' + pen_preview_js.preset_color + ']',
  1060. function( value ) {
  1061. value.bind(
  1062. function( text_color ) {
  1063. pen_element_content_fields().css(
  1064. {
  1065. color: text_color
  1066. }
  1067. );
  1068. }
  1069. );
  1070. }
  1071. );
  1072. /**
  1073. * Bottom widget area.
  1074. */
  1075. wp.customize(
  1076. 'pen_color_bottom_text[' + pen_preview_js.preset_color + ']',
  1077. function( value ) {
  1078. value.bind(
  1079. function( text_color ) {
  1080. pen_element_bottom().css(
  1081. {
  1082. color: text_color
  1083. }
  1084. );
  1085. }
  1086. );
  1087. }
  1088. );
  1089. wp.customize(
  1090. 'pen_color_bottom_link[' + pen_preview_js.preset_color + ']',
  1091. function( value ) {
  1092. value.bind(
  1093. function( pen_color_bottom_link ) {
  1094. var pen_color_bottom_link_hover = pen_option_get( 'color_bottom_link_hover' );
  1095. pen_apply_link_color( pen_element_bottom_links(), pen_color_bottom_link, pen_color_bottom_link_hover );
  1096. }
  1097. );
  1098. }
  1099. );
  1100. wp.customize(
  1101. 'pen_color_bottom_link_hover[' + pen_preview_js.preset_color + ']',
  1102. function( value ) {
  1103. value.bind(
  1104. function( pen_color_bottom_link_hover ) {
  1105. var pen_color_bottom_link = pen_option_get( 'color_bottom_link' );
  1106. pen_apply_link_color( pen_element_bottom_links(), pen_color_bottom_link, pen_color_bottom_link_hover );
  1107. }
  1108. );
  1109. }
  1110. );
  1111. wp.customize(
  1112. 'pen_color_bottom_text_shadow[' + pen_preview_js.preset_color + ']',
  1113. function( value ) {
  1114. value.bind(
  1115. function( shadow_color ) {
  1116. var shadow_display = pen_option_get( 'color_bottom_text_shadow_display' );
  1117. if ( shadow_display ) {
  1118. pen_element_bottom().css(
  1119. {
  1120. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 2px ' + shadow_color
  1121. }
  1122. );
  1123. }
  1124. }
  1125. );
  1126. }
  1127. );
  1128. wp.customize(
  1129. 'pen_color_bottom_text_shadow_display[' + pen_preview_js.preset_color + ']',
  1130. function( value ) {
  1131. value.bind(
  1132. function( shadow_display ) {
  1133. var shadow_color = pen_option_get( 'color_bottom_text_shadow' );
  1134. pen_element_bottom().css(
  1135. {
  1136. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 2px ' + shadow_color
  1137. }
  1138. );
  1139. }
  1140. );
  1141. }
  1142. );
  1143. wp.customize(
  1144. 'pen_color_bottom_headings[' + pen_preview_js.preset_color + ']',
  1145. function( value ) {
  1146. value.bind(
  1147. function( text_color ) {
  1148. pen_element_bottom_headings().css(
  1149. {
  1150. color: text_color
  1151. }
  1152. );
  1153. }
  1154. );
  1155. }
  1156. );
  1157. wp.customize(
  1158. 'pen_color_bottom_headings_text_shadow[' + pen_preview_js.preset_color + ']',
  1159. function( value ) {
  1160. value.bind(
  1161. function( shadow_color ) {
  1162. var shadow_display = pen_option_get( 'color_bottom_headings_text_shadow_display' );
  1163. if ( shadow_display ) {
  1164. pen_element_bottom_headings().css(
  1165. {
  1166. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 2px ' + shadow_color
  1167. }
  1168. );
  1169. }
  1170. }
  1171. );
  1172. }
  1173. );
  1174. wp.customize(
  1175. 'pen_color_bottom_headings_text_shadow_display[' + pen_preview_js.preset_color + ']',
  1176. function( value ) {
  1177. value.bind(
  1178. function( shadow_display ) {
  1179. var shadow_color = pen_option_get( 'color_bottom_headings_text_shadow' );
  1180. pen_element_bottom_headings().css(
  1181. {
  1182. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 2px ' + shadow_color
  1183. }
  1184. );
  1185. }
  1186. );
  1187. }
  1188. );
  1189. wp.customize(
  1190. 'pen_color_bottom_field_background_primary[' + pen_preview_js.preset_color + ']',
  1191. function( value ) {
  1192. value.bind(
  1193. function( top ) {
  1194. var bottom = pen_option_get( 'color_bottom_field_background_secondary' );
  1195. pen_element_bottom_fields().css(
  1196. {
  1197. background: pen_css_background_gradient( top, bottom, 'to bottom' )
  1198. }
  1199. );
  1200. }
  1201. );
  1202. }
  1203. );
  1204. wp.customize(
  1205. 'pen_color_bottom_field_background_secondary[' + pen_preview_js.preset_color + ']',
  1206. function( value ) {
  1207. value.bind(
  1208. function( bottom ) {
  1209. var top = pen_option_get( 'color_bottom_field_background_primary' );
  1210. pen_element_bottom_fields().css(
  1211. {
  1212. background: pen_css_background_gradient( bottom, top, 'top bottom' )
  1213. }
  1214. );
  1215. }
  1216. );
  1217. }
  1218. );
  1219. wp.customize(
  1220. 'pen_color_bottom_field_text[' + pen_preview_js.preset_color + ']',
  1221. function( value ) {
  1222. value.bind(
  1223. function( text_color ) {
  1224. pen_element_bottom_fields().css(
  1225. {
  1226. color: text_color
  1227. }
  1228. );
  1229. }
  1230. );
  1231. }
  1232. );
  1233. /**
  1234. * Footer.
  1235. */
  1236. wp.customize(
  1237. 'pen_footer_alignment[preset_1]',
  1238. function( value ) {
  1239. value.bind(
  1240. function( position ) {
  1241. $( 'body' ).removeClass(
  1242. function( index, css ) {
  1243. return ( css.match( /(^|\s)pen_footer_alignment_\S+/g ) || [] ).join( ' ' );
  1244. }
  1245. ).addClass( 'pen_footer_alignment_' + position );
  1246. }
  1247. );
  1248. }
  1249. );
  1250. wp.customize(
  1251. 'pen_footer_menu_display[preset_1]',
  1252. function( value ) {
  1253. value.bind(
  1254. function( display ) {
  1255. if ( display ) {
  1256. pen_element_footer_menu().show();
  1257. } else {
  1258. pen_element_footer_menu().hide();
  1259. }
  1260. }
  1261. );
  1262. }
  1263. );
  1264. wp.customize(
  1265. 'pen_footer_copyright_display[preset_1]',
  1266. function( value ) {
  1267. value.bind(
  1268. function( display ) {
  1269. if ( display ) {
  1270. pen_element_footer_copyright().show();
  1271. } else {
  1272. pen_element_footer_copyright().hide();
  1273. }
  1274. }
  1275. );
  1276. }
  1277. );
  1278. /**
  1279. * Footer colors.
  1280. */
  1281. function pen_go_to_top() {
  1282. var pen_color_footer_background_secondary = pen_option_get( 'color_footer_background_secondary' ),
  1283. pen_color_footer_link = pen_option_get( 'color_footer_link' ),
  1284. pen_color_footer_text_shadow = pen_option_get( 'color_footer_text_shadow' ),
  1285. pen_color_footer_text_shadow_display = pen_option_get( 'color_footer_text_shadow_display' );
  1286. pen_element_go_to_top().css(
  1287. {
  1288. background: pen_color_footer_background_secondary,
  1289. boxShadow: '0 0 10px ' + pen_color_footer_background_secondary,
  1290. color: pen_color_footer_link,
  1291. textShadow: ( ! pen_color_footer_text_shadow_display ) ? 'none' : '1px 1px 1px ' + pen_color_footer_text_shadow,
  1292. }
  1293. );
  1294. }
  1295. wp.customize(
  1296. 'pen_color_footer_text[' + pen_preview_js.preset_color + ']',
  1297. function( value ) {
  1298. value.bind(
  1299. function( text_color ) {
  1300. pen_element_footer().css(
  1301. {
  1302. color: text_color
  1303. }
  1304. );
  1305. }
  1306. );
  1307. }
  1308. );
  1309. wp.customize(
  1310. 'pen_color_footer_link_hover[' + pen_preview_js.preset_color + ']',
  1311. function( value ) {
  1312. value.bind(
  1313. function( pen_color_footer_link_hover ) {
  1314. var pen_color_footer_link = pen_option_get( 'color_footer_link' );
  1315. pen_apply_link_color( pen_element_footer_links(), pen_color_footer_link, pen_color_footer_link_hover );
  1316. }
  1317. );
  1318. }
  1319. );
  1320. wp.customize(
  1321. 'pen_color_footer_text_shadow[' + pen_preview_js.preset_color + ']',
  1322. function( value ) {
  1323. value.bind(
  1324. function( shadow_color ) {
  1325. pen_go_to_top();
  1326. var shadow_display = pen_option_get( 'color_footer_text_shadow_display' );
  1327. if ( shadow_display ) {
  1328. pen_element_footer().css(
  1329. {
  1330. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  1331. }
  1332. );
  1333. }
  1334. }
  1335. );
  1336. }
  1337. );
  1338. wp.customize(
  1339. 'pen_color_footer_text_shadow_display[' + pen_preview_js.preset_color + ']',
  1340. function( value ) {
  1341. value.bind(
  1342. function( shadow_display ) {
  1343. pen_go_to_top();
  1344. var shadow_color = pen_option_get( 'color_footer_text_shadow' );
  1345. pen_element_footer().css(
  1346. {
  1347. textShadow: ( ! shadow_display ) ? 'none' : '1px 1px 1px ' + shadow_color
  1348. }
  1349. );
  1350. }
  1351. );
  1352. }
  1353. );
  1354. } )( jQuery );