updated sharethis plugin is not working on ajax - sharethis

Recently sharethis plugin is updated. i have successfully installed and it was working fine. but i am unable to load the buttons on ajax calls.
I have added this script
<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=propertystring&product=inline-share-buttons"></script>
Old code using the following
stButtons.locateElements();
is not working any more.
Please note i am using custom share button.

I actually found the solution for this, at least it worked for me. Run this after the template has loaded:
__sharethis__.initialize()

Related

JasperSoft ReportServer - Visualize.js integration issues

I am testing out the visualize.js integration from jasper reportserver pro edition. It does not work because my application also has its jquery/require modules and visualize.js also tries to load it's own version of jquery/require modules. The overwriting of my frameworks libraries creates many uncertain and unpredictable issues.
Is there a way to tell jaspersoft to not load jquery/require libraries?
Thanks!
You can make use of the jQuery.noConflict() to handle multiple versions of it on the same page. See here
Maybe it is too late now, but in the past we faced with the similar issues, and the solution was to insert this before your script:
<script type="text/javascript">
var j$ = jQuery.noConflict();
</script>
And afterwards in your script, change all $ to the j$
That is what solved our problem with multiple jQuery libraries on the same page. Hope it helps you too.

Wicket AjaxLink generates no JavaScript

I started experimenting with Wicket AJAX functionality and wanted to implement an AjaxLink.
This is the associated markup/java-code:
<a wicket:id="testlink"></a>
---
AjaxLink<Component> link = new AjaxLink<Component>("testlink") {
#Override
public void onClick(AjaxRequestTarget target) {
System.out.println("called");
}
};
add(link);
But the onClick-method is never called, I guess because the generated HTML looks like this:
<a wicket:id="testlink" id="testlink7" href="javascript:;"></a>
Any ideas on what I am doing wrong?
This href="javascript:;" works because Wicket 6 uses JavaScript Event registration. Look at your webpage in some browser dev tool like in firefox. Point the inspector to the link and read it's id, then go the the head section and expand one of the <script type= text/javascript></script> tags. There you should find the id of the link and see that there is an line where a click event is attached to the id of the link. The URL there is executed when you click the link.
Thanks Robert for clarifying the ajax mechanisms of Wicket 6 - I'm rather new to this topic and the insights you gave me helped solve the problem.
Actually it was caused by some jQuery inconsistency I still haven't fully untangled, apparently coworkers used different jQuery-versions within different of our Wicket modules and somehow Wicket used not the one it was shipped with but a wrong one when trying to attach the event listener to the component.
When removing the unneccessary old jQuery libraries Wicket started to work fine - now I just have to get the components depending on the other jQuery libraries working again, but thats a different story :)
In my situation, I removed the following onload on body tag and the AjaxLink onclick function worked again.
<body onLoad="MM_preloadImages('template-image/searchbto.png');">

Calling GWT from jsp page

I am totally new to GWT concept and JSP. Right now i need to call a gwt application from my login.jsp .
So how can i achieve this. I am building a gwt-java project using eclipse and compiling it.
Now what all i need to do is just call a .nocache file(which is obtained from gwt compilation) from my login.jsp..
I found one link based on this but i was totally confused
http://code.google.com/p/google-web-toolkit/issues/detail?id=7609
can any one help me in how to do this...
Thanks in advance:)
After login form submission you can dispatch the page(gwtDispatcher.jsp) in your LoginServlet.
request.getRequestDispatcher("/gwtDispatcher.jsp").forward(request, response);
if you want to debug the code in development mode you have to add the query parameter
request.getRequestDispatcher("/gwtDispatcher.jsp?gwt.codesvr=127.0.0.1:9997")
.forward(request, response);
In your gwtDispatcher.jsp by adding the line
<script language="javascript" src="../yourAppName.nocache.js"></script>//make sure of the path,you can dispatch the gwt program.
I guess https://developers.google.com/web-toolkit/articles/dynamic_host_page will answer all your questions.

Nancy.SassAndCoffee: Trouble Getting Started

I am brand new to NancyFX and currently enthralled by its low-ceremony approach to web application development. Throwing myself in at the deep-end, I also want to use CoffeeScript and investigate the benefits of Sass.
The Set-Up
To enable this combination I have created a new Empty Web Application using the VS2010 template (found in the Nancy Accessories project). I have then used the VS PackageManager to Nancify my application and add the SassAndCoffee support:
PM> Install-Package Nancy
PM> Install-Package Nancy.SassAndCoffee
So far so good. I then created an ~/Content/scripts folder and in there I have placed a file called home.coffee containing the following line of CoffeeScript.
alert "Hello Nancy!"
Now things start to get a bit fuzzy. I want to run this script on the client so I create an view called ~/Views/home.sshtml (and associated NancyModule with Get["/"] route - not shown). The view's html looks like this:
<head>
<title>Hello Nancy</title>
<script type="text/javascript" src="/content/scripts/home.js"></script>
</head>
<body>
<p>Hello #Model.User</p>
</body>
</html>
The view works just fine but the link to the home.js file just returns a 404: Not Found.
I am hoping that somehow Nancy will magically work out that I need my CoffeeScript compiled to JavaScript when it looks for the referenced home.js file and finds the home.coffee instead. This didn't work - so much for inspired guesswork.
If I change the script tag above to point to the existing home.coffee instead then the file is found but processed as a normal JavaScript file giving errors concerning the lack of tiresome ceremony namely: "unexpected string"
The Question
Now you know my set-up and simple requirements, here then is my question:
How do I get CoffeeScript to 'just work' using the NancyFX framework?
Thank you
Update
Steven Robbins (below) has answered this question by pointing to the demo code. But just in case you don't want to pull MBs of source from GitHub, here are the lines required to get things going. First add a class called Bootstrapper.cs to your project. Now add the following code (it worked like a charm for me):
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
StaticConfiguration.DisableErrorTraces = false;
Hooks.Enable(pipelines, new InMemoryCache(), container.Resolve<IRootPathProvider>());
}
}
The SassAndCoffee project doesn't hook into the static content bit in Nancy, it (or something similar) may in the future, but at the moment it's just a separate pipeline hook.
If you take a look at the sample project on github:
https://github.com/NancyFx/Nancy.SassAndCoffee/tree/master/src/Nancy.SassAndCoffee.Demo
That should show you how to get it going.

Enqueueing scripts for use within a tinyMCE plugin in Wordpress

I have a tinyMCE plugin (for the post/page editor) that I am loading from my Wordpress plugin that needs to have several external javascript files loaded in order for my tinyMCE plugin to work.
In Wordpress 3.3.1 I can just register and enqueue the scripts from the mce_external_plugins filter but any Wordpress version below that doesn't load the scripts.
Anybody have experience in this?
The method that I found to work with my problem is by hooking to after_wp_tiny_mce and then in the callback, calling wp_print_scripts directly. It still handles all the dependencies of the scripts.
Also, because wp_localize_script won't work with this method due to the scripts not being enqueued, I am echoing my objects directly above my calls to wp_print_scripts like this:
<script type="text/javascript">
/* <![CDATA[ */
var MyLocalizedData = {"foo": "barito"};
/* ]]> */
</script>
EDIT :
This fix will only work in Wordpress >= 3.2