WebsiteBaker Support (2.8.x) > jQuery

Twitter badge with jquery

<< < (3/6) > >>

Damaverick:

--- Quote from: Damaverick on March 09, 2011, 02:26:05 PM ---
--- Quote from: BlackBird on March 09, 2011, 02:21:00 PM ---Do you get any JS Errors? Can we see the page for analyzing?

--- End quote ---

No JS Errors

URL: http://houston.active-web.nl/heldcreaties

username: test
pw: test

--- End quote ---

No errors is not completely true I see now :P
Because I tested with some stuff I found on the forum here to get jQuery working, I get an error on that .js

code in that js is:

--- Code: ---<script language="JavaScript" type="text/javascript">
var URL = '<?php echo WB_URL ?>';
var WB_URL = '<?php echo WB_URL ?>';
var TEMPLATE_DIR = '<?php echo TEMPLATE_DIR; ?>';
var UTC_TIME = '<?php echo gmdate(&#39;H:i:s&#39;); ?>';
</script>
<script src="<?php echo WB_URL; ?>/include/jquery/jquery-min.js" type="text/javascript"></script>
<script src="<?php echo WB_URL; ?>/include/jquery/jquery-ui-min.js" type="text/javascript"></script>
<script src="<?php echo WB_URL; ?>/include/jquery/jquery-insert.js" type="text/javascript"></script>
--- End code ---

But before I called this .js, the plugin also didn't worked and I didn't got any JS errors

BlackBird:
Firebug says "Fehler: missing ; before statement
Quelldatei: http://houston.active-web.nl/heldcreaties/templates/Held_Creaties/jquery_api.js
Zeile: 7, Spalte: 1

The content of that file is HTML, not JS, so remove it or put the contents into the head directly.

There are also 2 jQuery Core files loaded - 1 by jQueryAdmin, 1 from the include's folder. Remove the second one.

And least, I cannot find the twitterbadge.js in the header. (Only the css.) So check the preset file you created.

Damaverick:

--- Quote from: BlackBird on March 09, 2011, 04:51:28 PM ---Firebug says "Fehler: missing ; before statement
Quelldatei: http://houston.active-web.nl/heldcreaties/templates/Held_Creaties/jquery_api.js
Zeile: 7, Spalte: 1

The content of that file is HTML, not JS, so remove it or put the contents into the head directly.
--- End quote ---

- Removed it, I was trying something out with that js to get it to work, but aperently it didn't and generated this error


--- Quote from: BlackBird on March 09, 2011, 04:51:28 PM ---There are also 2 jQuery Core files loaded - 1 by jQueryAdmin, 1 from the include's folder. Remove the second one.
--- End quote ---

- 1 (the one in the includes folder) I was using for the captionslider, but after installing jQueryAdmin, it became unnecessary, so I removed the second one (and caption slider still worked :P )


--- Quote from: BlackBird on March 09, 2011, 04:51:28 PM ---And least, I cannot find the twitterbadge.js in the header. (Only the css.) So check the preset file you created.

--- End quote ---

The reason for this one is because, there isn't one... I already downloaded the plugin again, but also in the plugin installzip there isn't a .js file present.
al the JS code is in the jquery file that I call on the page.

This is the code within the twitterbadge.jquery file:

--- Code: ---<!-- position: head -->
<link rel="stylesheet" type="text/css" href="{WB_URL}/modules/jqueryadmin/plugins/twitterbadge/twitterbadge.css" media="screen" />

<!-- please edit these vars: -->
<script type="text/javascript">
var twitterdomain = 'http://www.twitter.com/heldcreaties';
var num = '5';
</script>


<!-- position: body -->
<!-- settings below -->
<script type="text/javascript">

$(document).ready(function(){
  var tweeturl = "http://twitter.com/status/user_timeline/"+twitterdomain+".json?count="+num+"&callback=?";
  $.getJSON(tweeturl, function(data){
    $.each(data, function(i, item) {
      var txt = item.text
     .replace(/(https?:\/\/[-a-z0-9._~:\/?#@!$&\'()*+,;=%]+)/ig,'<a href="$1">$1</a>')
     .replace(/@+([_A-Za-z0-9-]+)/ig, '<a href="http://twitter.com/$1">@$1</a>')
     .replace(/#+([_A-Za-z0-9-]+)/ig, '<a href="http://search.twitter.com/search?q=$1">#$1</a>');
   $('<p></p>').addClass(i%2 ? 'even' : 'odd').html(txt).prependTo('#tweet');
 });
  });
});
</script>
--- End code ---

Damaverick:
I solved my problem...

Instead of using the whole URL for "var twitterdomain" I have to use only my twitter ID.

Now it works... thnx for the help!

BlackBird:
Ah! Didn't know that. (Don't know the plugin, anyway.) Nice to hear that you solved your problem. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version