Add cloacked links as external
-
Hi,
I have cloacked links like this
mydomaine.tld/go/my_custom_nameI want hueman identified links as mydomain.tld/go/XXXX as external links. (Mean : icon + new tab)
I didn’t code for 4 years, never been very good, and never done javascript…I don’t understand everything in the javascript I read. So here’s my try
there’s is two similar functions
assets/czr/js/czr-preview-base.js line 186 – _is_external : function( _href )
asset/front/js/scripts.js line 623 – Plugin.prototype._is_external = function( _href )I even don’t know which one (or both) I must change.
with the czr-preview-base.js I think I must do something like that
_is_external : function( _href ) { var _thisHref = $.trim( _href ), _main_domain = (location.host).split('.').slice(-2).join('.'), // add mydomain.tld/go/ as external link // _begin part 1/2 _cloack_folder = '/go/', _main_domain_cloack = _main_domain._cloack_folder, _reg_cloack = new RegExp( _main_domain_cloack ), // _end part 1/2 _reg = new RegExp( _main_domain ); if ( _thisHref !== '' && _thisHref != '#' && _isValidURL( _thisHref ) ) return ! _reg.test( _thisHref ) $$ ! /* begin part 2/2 */ $$ ! _reg_cloack.test(_thisHref) /* end part 2/2 */; return;and this is obviously not a very clean way to do this. But if it works it’s a good start.
What do you think about ?
The topic ‘Add cloacked links as external’ is closed to new replies.
