Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Shorten Bottom [Bit.ly] Details »»
Shorten Bottom [Bit.ly]
Version: 1.00, by LOGECT LOGECT is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.x.x Rating:
Released: 01-03-2011 Last Update: Never Installs: 12
Template Edits
Re-useable Code  
No support by the author.

Info :

A simple way to add a shorten bottom for your vBulletin ( bitly shorten url service )


Note:
Of course, you can use this code to any custom template or page ( like Blogs, Cms, Forums and etc )

Screenshots:








Installation:

1- Go to : Admincp>Phrase Manager>Add New Phrase:

Product = vBulletin
Phrase Type = GLOBAL
Varname: vbshorten
Text: Shorten
Save.


2- In the SHOWTHREAD template, Find:
Code:
<h1>
And below that, add this code:

Code:
<a href="javascript:(function(){%20window.open('http://bit.ly/?url='+encodeURIComponent(location.href));%20})();" rel="nofollow"  class="pagetitleinfo textcontrol" >{vb:rawphrase vbshorten}</a>
This is just an example for threads.
and this code works with any version of vBulletin.


All the best.

Screenshots

File Type: png 1.png (23.4 KB, 0 views)
File Type: png 2.png (62.1 KB, 0 views)
File Type: jpg 5.jpg (29.9 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 03-14-2013, 01:40 AM
xbrian88 xbrian88 is offline
 
Join Date: Jul 2006
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://goo.gl/" target="_blank">http://goo.gl/</a> is possible use???
Reply With Quote
  #13  
Old 03-20-2013, 04:48 PM
xbrian88 xbrian88 is offline
 
Join Date: Jul 2006
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

uppppppppppp
Reply With Quote
  #14  
Old 03-22-2013, 11:54 AM
LOGECT's Avatar
LOGECT LOGECT is offline
 
Join Date: Jun 2010
Location: Copenhagen
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by xbrian88 View Post
http://goo.gl/ is possible use???
Try this:

Code:
<script type="text/javascript">
function makeShort()
{
   var longUrl=document.getElementById("longurl").value;
    var request = gapi.client.urlshortener.url.insert({
      'resource': {
      'longUrl': longUrl
    }
    });
    request.execute(function(response)
    {
 
        if(response.id != null)
        {
            str ="<b>Long URL:</b>"+longUrl+"<br>";
            str +="<b>Short URL:</b> <a href='"+response.id+"'>"+response.id+"</a><br>";
            document.getElementById("output").innerHTML = str;
        }
        else
        {
            alert("error: creating short url \n"+ response.error);
        }
 
    });
 }
 
function getShortInfo()
{
var shortUrl=document.getElementById("shorturl").value;
 
    var request = gapi.client.urlshortener.url.get({
      'shortUrl': shortUrl,
    'projection':'FULL'
    });
    request.execute(function(response)
    {
 
        if(response.longUrl!= null)
        {
            str ="<b>Long URL:</b>"+response.longUrl+"<br>";
            str +="<b>Create On:</b>"+response.created+"<br>";
            str +="<b>Short URL Clicks:</b>"+response.analytics.allTime.shortUrlClicks+"<br>";
            str +="<b>Long URL Clicks:</b>"+response.analytics.allTime.longUrlClicks+"<br>";
 
            document.getElementById("output").innerHTML = str;
        }
        else
        {
            alert("error: "+response.error);
        }
 
    });
 
}
function load()
{
    //Get your own Browser API Key from  https://code.google.com/apis/console/
    gapi.client.setApiKey('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
    gapi.client.load('urlshortener', 'v1',function(){document.getElementById("output").innerHTML="";});
 
}
window.onload = load;
 
</script>
<script src="https://apis.google.com/js/client.js"></script>
 
 
URL: <input type="text" id="longurl" name="url" value="{vb:raw thread_url}" /> <br/>
<input type="button" value="{vb:rawphrase vbshorten}" onclick="makeShort();" />
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07815 seconds
  • Memory Usage 2,262KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete