Having a hard time getting Javascript to work in a post - posts

I'm trying to get this script to work on the test post. The goal is to have the links below the video jump to certain spots in the video. It works fine in the jsfiddle demo, but not on my post.
In my header.php, I load that script and the script it refers to:
<head>
<script type="text/javascript" src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<script type="text/javascript" src="http://wcportal.acbaldwin.info/js/vimeochapters.js"></script>
</head>
In the post that I want to use, I inserted this markup in text-only view:
<iframe width="540" height="304" frameborder="0" src="http://player.vimeo.com/video/7100569?api=1&player_id=player_1" id="player_1">
</iframe>
<h2>Chapters</h2>
<ul class="chapterLinks">
<li><a class="seek" href="#" name="15">Seek to 15</a></li>
<li><a class="seek" href="#" name="30">Seek to 30</a></li>
<li><a class="seek" href="#" name="60">Seek to 60</a></li>
</ul>
Here's the test page
I'm sure I'm calling something incorrectly, but I don't know where. I'm not sure I saved the .js file correctly or if there need to be additional tags within the .js file.
I know there are more optimized and wordpress friendly ways to integrate JS, but I just need quick, dirty, and functioning for a demo. Thanks for any help!

Got the solution here from a redditor:
http://www.reddit.com/r/webdev/comments/1dn0j6/im_having_a_hard_time_getting_javascript_to_work/c9rwy85
Turns out the script needed to be in the footer. (Either that or I had a lucky coincidence while fixing an ajax issue!)

It looks like you are missing an ending } on the vimeofunction(); in the vimeochapters.js file.

Related

Web pages accessible by multiple URLs for SEO reasons

I have a bunch of pages with the following structure:
<html>
<body>
<div id="summary">
</div>
<div id="promotions">
</div>
</body>
</html>
I want these pages to be accessible by both:
/items/one
/items/two
/items/three
And:
/promotional-offers/2014/february/one
/promotional-offers/2014/february/two
/promotional-offers/2014/february/three
/items/... should just open the page. /promotional-offers/2014/february/... should open the page /items/... and go to the anchor #promotions (scroll down to the appropriate div).
/items/one/#promotions
/items/two/#promotions
/items/three/#promotions
I'm not sure though how to set up rewrite rules in web.config to help search engines with indexing my pages and avoid having 'duplicate content'.
I would add a Canonical tag to completely avoid duplicate content, so It won't matter from which page you are showing the same content.
<!--url /promotional-offers/2014/february/one-->
<link rel="canonical" href="http://www.example.com/items/one" />

Customizing Addthis Plugin - passing url using classic asp

I am having lots of problems while coming up with a solution.
I have a website that share text or image greetings( text greeting only at this time) on facebook or twitter etc. I planed to use Addthis.
So I created a function like this
<%
Function DisplayShareDiv(surl, sT, sSummary)
%>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
addthis:url="<%=surl%>"
addthis:title="<%=sT %>"
id="addthis_container"
addthis:Description="<%=sSummary%>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript">var addthis_config = { "data_track_addressbar": true };</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=###################3"></script>
<!-- AddThis Button END -->
<%
end function
%>
Now problem is that title appears when click on facebook or twitter but url doesn't. I also want to add the description to it. I have og tags too but they need to be dynamic too and i am having problems with fb not picking up that info either. Even though i have run it through debugger. I am at it for 2 days and it is now all a mish mash. I would really appreciate if someone can please help me!!
Now I'm getting this. Is that as you require?
I think facebook was picking up an old version of your page.
The text it picked up were from the OG and description meta tags on your home page.
If you run your page through their debugging tool, that forces it to scrape the latest version of your page. Plus you might get some useful info too. https://developers.facebook.com/tools/debug/

facebook share buttuon image not working properly

i don't know english very well and sorry about this. then i try to explan my problem
i want to add facebook share attribute to my site. code below
head tag
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
body tag
<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php">
<img src="img/pFace.png" alt="Share on Facebook" /></a>
then test my code link doesnt work but when delete img tag share work properly.
where is the mistake?
I discover that actually issue is facebook share link is not loaded or delay.
In your view what is possible problem?
The share button is depreceated. It's preferable to use the 'like' button. See https://developers.facebook.com/docs/reference/plugins/like/

How to load dojo into html file in order to call dojox.mobile functions?

Ok so I'm fairly new to dojo and I'm trying to make a really simple sample mobile app. I'm using eclipse to run the code which uses an android emulator to install/run the app. The problem I'm having is that I keep getting Uncaught Reference Errors for either "require is not defined" or "dojo is not defined", causing my app to appear as plain text instead of formatted like an android app using dojox.mobile widgets.
Here is my code:
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,
minimum-scale=1,user-scalable=no"/>
<title>PhoneGap</title>
<!-- DOJO -->
<script src="/assets/www/lib/dojo/dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad:true">
</script>
<link rel="stylesheet" href="/assets/www/lib/dojo/dojox/mobile/themes/android/android.css"
type="text/css" media="screen" title="no title" charset="utf-8">
<script type="text/javascript" charset="utf-8" src="/assets/www/cordova-1.6.0.js"></script>
<script>
require(["dojo"], function(dojo) {
dojo.require("dojox/mobile")
dojo.require("dojox/mobile/parser")
});
</script>
</head>
<!-- END DOJO -->
<body>
<!-- ACCIDENT TOOLKIT PAGE -->
<div data-dojo-type="dojox.mobile.View" id="accHelp" selected="true">
<h1 data-dojo-type="dojox.mobile.Heading">Accident</h1>
<div class="text">If you are in an accident, you should first move to a safe
location. Below are some additional actions you can take:</div>
<ul data-dojo-type="dojox.mobile.RoundRectList">
<li data-dojo-type="dojox.mobile.ListItem"
onclick="window.location='geo:0,0?q=police';">Call the Police</li>
<li data-dojo-type="dojox.mobile.ListItem"
onclick="window.location='geo:0,0?q=towing';">Call for a Tow Truck</li>
<li data-dojo-type="dojox.mobile.ListItem" moveTo="accInfo" transition="slide"
onClick="itemClicked();">Exchange Driver Info</li>
<li data-dojo-type="dojox.mobile.ListItem" moveTo="accInfo" transition="slide"
onClick="itemClicked();">Record Accident Location</li>
<li data-dojo-type="dojox.mobile.ListItem" moveTo="accInfo" transition="slide"
onClick="itemClicked();">Take Photos of Accident</li>
</ul>
</div>
<!-- EXCHANGE DRIVER INFO PAGE -->
<div data-dojo-type="dojox.mobile.View" id="accInfo">
<h1 data-dojo-type="dojox.mobile.Heading" back="Accident" moveTo="accHelp"
onClick="console.log('Going back');">Driver</h1>
<h2 data-dojo-type="dojox.mobile.RoundRectCategory">Other Driver Info</h2>
</div>
<script>
function itemClicked() {
console.log("itemClicked()");
}
</script>
</body>
</html>
Does anything appear wrong with the code itself? Especially where I'm using the script scr... to point to the dojo.js and where I'm using require to call the dojo.mobile functions. I was under the impression that as long as the src pointed to the right location in the package tree, it didn't much matter where I copied the file in.
I have tried using the Google CDN to call dojo.js, but the emulator throws errors when I do so, possibly because it doesn't utilize an internet connection?
Any help would be great!
Try removing /assets/www/ from your local URLs
Your require statement looks like this:
require(["dojo"], function(dojo) {
dojo.require("dojox/mobile")
dojo.require("dojox/mobile/parser")
});
And it should look something like this:
require([
"dojo/mobile",
"dojo/mobile/parser"
],
function(mobile, parser) {
// your code here;
});

facebook xid doesn't work

i need separate comment thread for each post on my website, so i followed instructions at http://developers.facebook.com/blog/post/472, ie i inserted the code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="www.mysite.com" xid="postPOST_ID_HERE"></fb:comments>
under each post.
but it doesn't work and there is SAME comments thread under each post.
if i try this code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="http://www.mysite.com/news.php?id=POST_ID_HERE"></fb:comments>
it seems to work, ie i get separate comment thread per post. but according to facebook instructions href parameter needs to be canonical url. am i doing something wrong in the first case or is the second example way to go (even if against facebook manual)?
I don't think you need to use both the href and the xid variables. I think the href variable is the newer version according to Facebook Developer Blog this is the new code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>
It also says "If you already have the original Comments Box installed, include the parameter migrated="1" to keep existing comments" and shows this as an example:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments xid="YOUR_XID" migrated="1"></fb:comments>
I am using the first version I posted here, but using addresses like you mentioned, and it works. So I'd say go with the second version even if it goes slightly against what they say. It works properly for me.
Plugin doesn't work on my 2 sites on different servers from yesterday, but on http://www.vesti.ru/doc.html?id=442871 plugin works normally