Sync plugins from current page

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-09-11 19:08:46 +02:00
parent 85d41e4216
commit 8515ff9587
1847 changed files with 505469 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
(function($, undefined){
var Field = acf.Field.extend({
type: 'url',
events: {
'keyup input[type="url"]': 'onkeyup'
},
$control: function(){
return this.$('.acf-input-wrap');
},
$input: function(){
return this.$('input[type="url"]');
},
initialize: function(){
this.render();
},
isValid: function(){
// vars
var val = this.val();
// bail early if no val
if( !val ) {
return false;
}
// url
if( val.indexOf('://') !== -1 ) {
return true;
}
// protocol relative url
if( val.indexOf('//') === 0 ) {
return true;
}
// return
return false;
},
render: function(){
// add class
if( this.isValid() ) {
this.$control().addClass('-valid');
} else {
this.$control().removeClass('-valid');
}
},
onkeyup: function( e, $el ){
this.render();
}
});
acf.registerFieldType( Field );
})(jQuery);