Changeset 1019742
- Timestamp:
- 11/04/2014 07:38:56 PM (11 years ago)
- Location:
- getty-images/trunk
- Files:
-
- 7 edited
-
getty-images.css (modified) (3 diffs)
-
getty-images.php (modified) (5 diffs)
-
getty-templates.php (modified) (2 diffs)
-
js/getty-images.js (modified) (7 diffs)
-
js/getty-models.js (modified) (7 diffs)
-
js/getty-views.js (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
getty-images/trunk/getty-images.css
r998658 r1019742 478 478 background-color: #f5f5f5; 479 479 -webkit-transform: translate(-50%, 0); 480 left: 50%; 481 } 480 } 481 @media only screen and (max-width: 900px) { 482 .getty-title-link .getty-prompt-login.getty-user-panel { 483 left: -50%; 484 } 485 } 482 486 .getty-prompt-login .getty-user-chevron { 483 487 border-left: 15px solid transparent; … … 488 492 top: -15px; 489 493 } 494 @media only screen and (max-width: 900px) { 495 .getty-prompt-login .getty-user-chevron { 496 right: 13em; 497 } 498 } 490 499 .getty-user-chevron span { 491 500 border-left: 14px solid transparent; … … 753 762 754 763 /** 764 * Welcome screen with opt-in 765 */ 766 .getty-welcome { 767 position: absolute; 768 top: 20%; 769 bottom: 20%; 770 left: 20%; 771 right: 20%; 772 } 773 @media only screen and (max-width: 640px), screen and (max-height: 400px) { 774 .getty-welcome { 775 top: 80px; 776 bottom: 5px; 777 } 778 } 779 @media only screen and (max-height: 400px) { 780 .getty-welcome { 781 top: 5px; 782 } 783 } 784 @media screen and (max-width: 640px) { 785 .getty-welcome { 786 left: 5px; 787 right: 5px; 788 } 789 } 790 .getty-welcome-opt-in, 791 .getty-welcome-continue { 792 position: absolute; 793 bottom: 0; 794 } 795 .getty-welcome-opt-in { 796 left: 0; 797 } 798 .getty-welcome-continue { 799 right: 0; 800 } 801 802 /** 755 803 * Choose mode 756 804 */ -
getty-images/trunk/getty-images.php
r998660 r1019742 6 6 Author: gettyImages 7 7 Author URI: http://gettyimages.com/ 8 Version: 2. 1.18 Version: 2.2.1 9 9 */ 10 10 … … 132 132 wp_register_script( 'jquery-cookie', plugins_url( '/js/jquery.cookie.js', __FILE__ ), array( 'jquery' ), '2006', true ); 133 133 134 $isWPcom = self::isWPcom(); 135 136 // Determine if the Omniture Javascript should be loaded 137 $load_omniture = true; 138 if ( $isWPcom ) { 139 $settings = isset( $_COOKIE['wpGIc'] ) ? json_decode( stripslashes( $_COOKIE['wpGIc'] ) ) : false; 140 if ( isset( $settings->{'omniture-opt-in'} ) && ! $settings->{'omniture-opt-in'} ) { 141 // Don't load the s_code script if the user has opted out 142 $load_omniture = false; 143 } 144 } 145 134 146 wp_enqueue_script( 'spin-js', plugins_url( '/js/spin.js', __FILE__ ), array(), 1, true ); 135 wp_enqueue_script( 'getty-omniture-scode', plugins_url( '/js/s_code.js', __FILE__ ), array(), 1, true );136 147 wp_enqueue_script( 'getty-images-filters', plugins_url( '/js/getty-filters.js', __FILE__ ), array(), 1, true ); 137 148 wp_enqueue_script( 'getty-images-views', plugins_url( '/js/getty-views.js', __FILE__ ), array( 'getty-images-filters', 'spin-js' ), 1, true ); 138 wp_enqueue_script( 'getty-images-models', plugins_url( '/js/getty-models.js', __FILE__ ), array( 'jquery-cookie', 'getty-omniture-scode' ), 1, true ); 139 wp_enqueue_script( 'getty-images', plugins_url( '/js/getty-images.js', __FILE__ ), array( 'getty-images-views', 'getty-images-models', 'getty-omniture-scode' ), 1, true ); 140 149 150 // Register Omniture s-code 151 wp_register_script( 'getty-omniture-scode', apply_filters( 'getty_images_s_code_js_url', plugins_url( '/js/s_code.js', __FILE__ ) ), array(), 1, true ); 152 153 // Optionally load it as a dependency 154 $models_depend = $load_omniture ? array( 'jquery-cookie', 'getty-omniture-scode' ) : array( 'jquery-cookie' ); 155 156 wp_enqueue_script( 'getty-images-models', plugins_url( '/js/getty-models.js', __FILE__ ), $models_depend, 1, true ); 157 wp_enqueue_script( 'getty-images', plugins_url( '/js/getty-images.js', __FILE__ ), array( 'getty-images-views', 'getty-images-models' ), 1, true ); 141 158 142 159 wp_enqueue_style( 'getty-images', plugins_url( '/getty-images.css', __FILE__ ) ); … … 147 164 'nonce' => wp_create_nonce( 'getty-images' ), 148 165 'sizes' => $this->get_possible_image_sizes(), 149 'isWPcom' => function_exists( 'wpcom_is_vip' ) && wpcom_is_vip(),166 'isWPcom' => $isWPcom, 150 167 'text' => array( 151 168 // Getty Images search field placeholder … … 215 232 } 216 233 234 static function isWPcom() { 235 return isset( $_GET['gettyTestWPcomIsVip'] ) || ( function_exists( 'wpcom_is_vip' ) && wpcom_is_vip() ); 236 } 237 217 238 /** 218 239 * Add "Getty Images..." button to edit screen … … 471 492 } 472 493 } 494 473 495 Getty_Images::instance(); -
getty-images/trunk/getty-templates.php
r998658 r1019742 58 58 <div class="getty-title-links"> 59 59 <# var loggedIn = gettyImages.user.get('loggedIn'); #> 60 <# if( gettyImages.isWPcom|| data.mode == 'login' && loggedIn) { #>60 <# if((gettyImages.isWPcom && gettyImages.user.settings.get('omniture-opt-in') !== undefined) || data.mode == 'login' && loggedIn) { #> 61 61 <span class="getty-title-link"> 62 62 <a class="getty-login-toggle getty-title-link {{ loggedIn ? 'getty-logged-in' : '' }}">{{ loggedIn ? gettyImages.user.get('username') : "<?php esc_html_e( "Log in", 'getty-images' ); ?>" }}</a> … … 470 470 </script> 471 471 472 <script type="text/html" id="tmpl-getty-welcome"> 473 <h1>Welcome</h1> 474 475 <p><?php _e( "Getty Images tracks usage of this plugin via a third party tool that sets cookies in your browser. We use the statistics collected this way to help improve the plugin. However, you may opt out of this tracking, which will not affect the operation of this plugin. For more information, please <a href=\"http://www.gettyimages.com/Corporate/PrivacyPolicy.aspx\" target=\"_getty\">refer to our privacy policy</a>.", 'getty-images' ); ?></p> 476 477 <p class="getty-welcome-opt-in"> 478 <label><input type="checkbox" name="getty-images-omniture-opt-in" value="1" <# if(data.optIn) { #>checked="checked"<# } #> /> Agree to third-party tracking</label> 479 </p> 480 481 <p class="getty-welcome-continue"> 482 <button class="button-primary">Continue</button> 483 </p> 484 485 </script> 486 472 487 <script type="text/html" id="tmpl-getty-choose-mode"> 473 488 <# if(data.mode != 'login') { #> -
getty-images/trunk/js/getty-images.js
r923152 r1019742 9 9 var media = wp.media; 10 10 var getty = gettyImages; 11 var s = window.getty_s;12 11 13 12 // The Getty User session, which handles authentication needs and maintains … … 15 14 getty.user = new media.model.GettyUser(); 16 15 getty.user.restore(); 16 17 // Omniture tracking 18 if ( getty.isWPcom ) { 19 getty.t = function() { 20 var s = window.getty_s; 21 if(getty.user.settings.get('omniture-opt-in') && s && s.t) { 22 s.t(); 23 } 24 }; 25 getty.tl = function() { 26 var s = window.getty_s; 27 if(getty.user.settings.get('omniture-opt-in') && s && s.tl) { 28 s.tl(); 29 } 30 }; 31 } else { 32 getty.t = function() { 33 var s = window.getty_s; 34 if(s && s.t) { 35 s.t(); 36 } 37 }; 38 getty.tl = function() { 39 var s = window.getty_s; 40 if(s && s.tl) { 41 s.tl(); 42 } 43 }; 44 } 17 45 18 46 /** … … 30 58 'content:activate:getty-images-browse': 'activateBrowser', 31 59 'toolbar:create:getty-images-toolbar': 'createToolbar', 60 'content:create:getty-welcome': 'createWelcome', 32 61 'content:create:getty-mode-select': 'createModeSelect', 33 62 'toolbar:create:blank-toolbar': 'createBlankToolbar', … … 57 86 } 58 87 59 getty.user.settings.on('change:mode ', this.setMode, this);88 getty.user.settings.on('change:mode change:omniture-opt-in', this.setMode, this); 60 89 getty.user.on('change:loggedIn', this.setMode, this); 61 90 }, … … 77 106 this.turnBindings('on'); 78 107 79 s && s.t();108 getty.t(); 80 109 81 110 this.setMode(); … … 84 113 setMode: function() { 85 114 if(getty.isWPcom) { 115 if(getty.user.settings.get('omniture-opt-in') === undefined) { 116 this.set('content', 'getty-welcome'); 117 this.set('toolbar', 'blank-toolbar'); 118 } 119 else { 120 getty.user.settings.set('mode', 'login'); 121 this.set('content', 'getty-images-browse'); 122 this.set('toolbar', 'getty-images-toolbar'); 123 } 124 86 125 return; 87 126 } … … 122 161 123 162 content.view = new media.view.GettyModeSelect({ 163 controller: this.frame, 164 model: this 165 }); 166 }, 167 168 createWelcome: function(content) { 169 content.view = new media.view.GettyWelcome({ 124 170 controller: this.frame, 125 171 model: this -
getty-images/trunk/js/getty-models.js
r923152 r1019742 8 8 var media = wp.media; 9 9 var getty = gettyImages; 10 var s = window.getty_s;11 10 var GettyAttachments; 12 11 … … 326 325 // Image downloaded! Yay! 327 326 downloaded: function(response) { 327 var s = window.getty_s; 328 328 this.set('attachment', new media.model.Attachment(response)); 329 329 … … 333 333 s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = ''; 334 334 s.prop3 = s.eVar3 = this.get('ImageId'); 335 s.tl();335 getty.tl(); 336 336 } 337 337 }, … … 410 410 // Perform a search with queued search properties 411 411 search: function() { 412 var searchTerm = this.propsQueue.get('search'); 412 var searchTerm = this.propsQueue.get('search'), 413 s = window.getty_s; 413 414 414 415 if(typeof searchTerm != 'string' || !searchTerm.match(/[^\s]/)) { … … 444 445 s.prop1 = s.eVar1 = s.prop3 = s.eVar3 = ''; 445 446 s.prop2 = s.eVar2 = this.props.get('search'); 446 s.tl();447 getty.tl(); 447 448 } 448 449 } … … 926 927 927 928 login: function(password) { 929 var s = window.getty_s; 930 928 931 this.set('loggingIn', true); 929 932 this.unset('error'); … … 945 948 s.prop2 = s.eVar2 = s.prop3 = s.eVar3 = ''; 946 949 s.prop1 = s.eVar1 = self.get('username'); 947 s.tl();950 getty.tl(); 948 951 } 949 952 }) -
getty-images/trunk/js/getty-views.js
r923152 r1019742 8 8 var media = wp.media; 9 9 var getty = gettyImages; 10 var s = window.getty_s; 11 var l10n = media.view.l10n; 10 var l10n = media.view.l10n; 12 11 13 12 // Turn a number string into a comma-separated triplet human-readable number, … … 274 273 createSingle: function() { 275 274 var sidebar = this.sidebar, 276 single = this.options.selection.single(); 275 single = this.options.selection.single(), 276 s = window.getty_s; 277 277 278 278 var attachment = single.id ? media.model.GettyAttachments.all.get(single.id) : false; … … 299 299 s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = ''; 300 300 s.prop3 = s.eVar3 = single.id; 301 s.tl();301 getty.tl(); 302 302 } 303 303 } … … 656 656 // Create user view using the globalized, persistent user model 657 657 if(gettyImages.isWPcom || this.controller.get('mode') == 'login') { 658 this.updateMode(this.controller, this.controller.get('mode'));659 } 660 661 getty.user.settings.on('change:mode ', this.render, this);658 this.updateMode(this.controller, 'login'); 659 } 660 661 getty.user.settings.on('change:mode change:omniture-opt-in', this.render, this); 662 662 getty.user.settings.on('change:mode', this.updateMode, this); 663 663 … … 1155 1155 1156 1156 insertImage: function() { 1157 var image = this.collection.single(); 1157 var image = this.collection.single(), 1158 s = window.getty_s; 1158 1159 1159 1160 if(this.controller.state().get('mode') != 'embed' && !image.get('attachment')) { … … 1175 1176 s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = ''; 1176 1177 s.prop3 = s.eVar3 = image.get('id'); 1177 s.tl(); 1178 s.prop5 = s.eVar5 = this.controller.state().get('mode') === 'embed' ? "Embed" : "License"; 1179 getty.tl(); 1178 1180 } 1179 1181 … … 1183 1185 1184 1186 insertComp: function() { 1185 var image = this.controller.state().get('selection').single(); 1187 var image = this.controller.state().get('selection').single(), 1188 s = window.getty_s; 1186 1189 1187 1190 if(s && image) { … … 1189 1192 s.prop1 = s.eVar1 = s.prop2 = s.eVar2 = ''; 1190 1193 s.prop3 = s.eVar3 = image.get('id'); 1191 s.tl();1194 getty.tl(); 1192 1195 } 1193 1196 … … 1317 1320 1318 1321 /** 1322 * Welcome screen + opt-in 1323 */ 1324 media.view.GettyWelcome = media.View.extend({ 1325 tagName: 'div', 1326 className: 'getty-welcome', 1327 template: media.template('getty-welcome'), 1328 1329 events: { 1330 'click .getty-welcome-continue button': 'save', 1331 }, 1332 1333 save: function() { 1334 var checked = this.$el.find('.getty-welcome-opt-in input').prop('checked'); 1335 1336 if ( ! checked ) { 1337 delete window.getty_s; 1338 } 1339 getty.user.settings.set('omniture-opt-in', checked); 1340 }, 1341 1342 prepare: function() { 1343 var optIn = getty.user.settings.get('omniture-opt-in'); 1344 1345 if(optIn === undefined) { 1346 optIn = true; 1347 } 1348 1349 return { 1350 optIn: optIn 1351 } 1352 }, 1353 }); 1354 1355 /** 1319 1356 * Mode selection 1320 1357 */ -
getty-images/trunk/readme.txt
r998659 r1019742 4 4 Requires at least: 3.9 5 5 Tested up to: 4.0 6 Stable tag: 2. 1.16 Stable tag: 2.2.1 7 7 License: GPLv2 or later 8 8 … … 51 51 == Changelog == 52 52 53 = 2.2.1 = 54 Fold in optimizations from VIP, ht Jeff Bowen @ Automattic 55 56 = 2.2 = 57 Added Omniture Opt-in for WordPress.com VIP 58 53 59 = 2.1.1 = 54 60 Updated library size language
Note: See TracChangeset
for help on using the changeset viewer.