vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [HELP]someone knowledgable in jQuery (https://vborg.vbsupport.ru/showthread.php?t=322066)

Dr.CustUmz 03-09-2016 05:40 PM

[HELP]someone knowledgable in jQuery
 
so we have a html link
Code:

<a href="http://google.com">Google</a>
and we target the google.com part like this
Code:

return this.each(function(){
    var link = $(this);
    var url = settings.service
    .replace("__URL__" , link.attr("href"))
    .replace("__DOMAIN__", link.attr("href")
    .replace("http://","").replace("https://", ""));.......more code

and this works, for my normal href's

but i want to target a link like this
Code:

<a href="out.php?link=http://google.com">Google</a>
so the end __URL__ is only "google.com"

i have tried many ways, and looking at this code the obvious replace has been done
replace("out.php?link=http://","").replace("out.php?link=https://", "")

im stuck, i set a demo up HERE

Dave 03-09-2016 05:44 PM

Might be easier to make use of split like this:
HTML Code:

"out.php=?link=http://google.com".split('//')[1]
will output "google.com".

Dr.CustUmz 03-09-2016 05:50 PM

did you take a look at the demo dave? i implemented the split but im still not getting the desired results

--------------- Added [DATE]1457553299[/DATE] at [TIME]1457553299[/TIME] ---------------

this is the full code
Code:

jQuery.fn.favicons = function(config){
  var settings = jQuery.extend({
    "classname": "favicon",
    "service": "http://api.byi.pw/favicon?url=__URL__"
  }, config);

  return this.each(function(){
    var link = $(this);
    var url = settings.service
                .replace("__URL__" , link.attr("href"))
                .replace("__DOMAIN__", link.attr("href")
                .replace("http://","").replace("https://", ""));
    link.css("background-image", "url(" + url + ")")
                .addClass(settings.classname);
  });
};



All times are GMT. The time now is 04:18 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00907 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete