Skip to content

Commit

Permalink
Added easy webmaster code pasting
Browse files Browse the repository at this point in the history
  • Loading branch information
sybrew committed Aug 9, 2018
1 parent e0d00f5 commit 8896069
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
7 changes: 6 additions & 1 deletion inc/views/debug/index.php
@@ -1,2 +1,7 @@
<?php
//* We often discover what will do, by finding out what will not do; and probably he who never made a mistake never made a discovery - Samuel Smiles
/**
* We often discover what will do, by finding out what will not do;
* and probably he who never made a mistake never made a discovery.
*
* - Samuel Smiles
*/
7 changes: 6 additions & 1 deletion index.php
@@ -1,2 +1,7 @@
<?php
//* Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time. - Thomas A. Edison
/**
* Our greatest weakness lies in giving up.
* The most certain way to succeed is always to try just one more time.
*
* - Thomas A. Edison
*/
39 changes: 39 additions & 0 deletions lib/js/tsf.js
Expand Up @@ -1678,6 +1678,43 @@ window.tsf = {
counter.className = counterClass;
},

/**
* Initializes Webmasters' meta input.
*
* @since 3.1.0
*
* @function
* @return {undefined}
*/
_initWebmastersInput: function() {

if ( ! tsf.states.isSettingsPage )
return;

let $inputs = jQuery( [
"#autodescription-site-settings\\[google_verification\\]",
"#autodescription-site-settings\\[bing_verification\\]",
"#autodescription-site-settings\\[yandex_verification\\]",
"#autodescription-site-settings\\[pint_verification\\]"
].join( ', ' ) );

if ( ! $inputs.length )
return;

$inputs.on( 'paste', ( event ) => {
let val = event.originalEvent.clipboardData && event.originalEvent.clipboardData.getData('text') || void 0;

if ( val ) {
let match = /<meta[^>]+content=(\"|\')?([^\"\'>\s]+)\1?.*?>/i.exec( val );
if ( match && 2 in match && 'string' === typeof match[2] && match[2].length ) {
event.stopPropagation();
event.preventDefault();
event.target.value = match[2];
}
}
} );
},

/**
* Initializes counters.
*
Expand Down Expand Up @@ -2464,6 +2501,8 @@ window.tsf = {
tsf._initDescInputs();
tsf._initSocialDescInputs();

tsf._initWebmastersInput();

// Sets tabs to correct radio button on load.
tsf.setTabsOnload();

Expand Down
2 changes: 1 addition & 1 deletion lib/js/tsf.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion readme.txt
Expand Up @@ -385,7 +385,8 @@ TODO: Update plugin setup guide, as pagination settings have been updated.
* On Firefox, list table overflow is now less prone to happen. We've removed compatibility fixes, and introduced a flexible system via CSS.
* The overflowing is caused by a bug in Internet Explorer 6, which Firefox happily integrated, affecting roughly 30% of their users.
* In short, [Gecko ignores word-wrap values in tables](https://bugzilla.mozilla.org/show_bug.cgi?id=587438), and for [13 years running](https://bugzilla.mozilla.org/show_bug.cgi?id=307866), Firefox ignores overflow-preventing width values. Both these bugs combined cause mayhem.
* TODO maybe: Webmasters' code input now automatically stripts extraneous HTML. So, you can simply paste the code you copied from the analytical setup interfaces.
* Webmasters' code input now automatically stripts extraneous HTML. So, you can simply paste the code you copied from the analytical setup interfaces.
* TODO this might not work on IE11? If it doesn't, we won't upgrade this functionality to support it.
* The upgrade routine is now more intelligent, and is now able to skip upgrades that aren't necessary for new installations.
* The upgrade routine can no longer happen on the SEO Settings page; instead, it redirects you from it to prevent setting desynchronization.
* The upgrade routine automatically registers the default site options for new sites, so the admin interface no longer needs to be accessed (once) for them to have effect.
Expand Down

0 comments on commit 8896069

Please sign in to comment.