Blockly: Pull out and use values below a block - javascript

Is it possible to make a Blockly block with blocks/variables that return values which I can pull out and use below the hat block? That way, the thing that's firing the hat block can show the inputs.
E.g., something like this:
https://usercontent.irccloud-cdn.com/file/RNYcEn9x/image.png
I want something users can drag out of the block which is only in that scope, not a global. Is this possible?
We've consulted the documentation and searched online. I don't see any way to do this.

Related

Loading different EDGE compositions dynamically

I'm trying to build a test-system for edge-animate composition, so I can load different compositions and test if they display correctly, change their customizable fields and so on. I tried the Edge Commons' EC.loadComposition function, but I have a problem with passing the composition-name from the outer html.
I've got the Main Composition that contains the field, where the external comps will be loaded. I managed to run the "Composition Loader" example (http://edgedocks.com/content/2013/12/nesting-animate-compositions-composition-loader-edge-commons), but I would love to give the user a chance to name a composition to load, from browser-level.
I guess it's going to have somthing in common with Bootstrapping the Compositions, but I'm fairly new to html/JS/Edge and I can't make it work as I want to.
Do you know any solutions, or directions to look at?
Thanks!
Ok, I found a workaround:
In the Bootstrap callback, I call AdobeEdge.Symbol.bindElementAction() and then bind a loading function to a symbol, that works as a button. With this approach, I can use JS or PHP to fill the composition-name argument of that function.
My Code is totally cramped, because I copied it from the edge-generated .js file, but it looks like this:
AdobeEdge.bootstrapCallback(function(compId) {
comp = AdobeEdge.getComposition(compId);
AdobeEdge.Symbol.bindElementAction(compId, 'stage', "${Button1}", "click", function(sym,e){
var loadedComp=EC.loadComposition(document.getElementById('idCard').value ,sym.$("Content"));loadedComp.done(function(comp)
{ loadedStage=comp.getStage();});});});
Sorry for the mess, but it contains so much nested definitions that I'm unable to format it to look good ;(
If you find any better way to solve this, let me know!

What does this do in javascript?

I came across the function below in one of the SharePoint system javascript files.
function RTE_InsertImage(strBaseElementID)
{ULS1Lu:;
//A bunch of javascript
}
I have never seen something like ULS1Lu:; in any of the javascript code I have worked with before. Does anyone know what this is doing?
Sorry the weak title on the question. I wasn't sure how else to phrase it.
Its a code label, technically they don't need the semicolon, but in javascript it shouldn't hurt. The label will allow a break or continue statement to jump the code back to it.
Most people consider that instead of labels it is better to use function calls whenever possible.
Seems like they are just creating a Label. Possibly, as a marker or for some infamous use. Of course such labels owe a large part of their fame to goto statements.

How to add a resizable, dragable overlay to a webpage?

I'd like to make a userscript that can put an resizable, dragable overlay over a browser game. Only I don't have a clue how to start.
It'd basically have to be a div with some styling and javascript applied to it, containing an <iframe>. I'd also like to pass a string displayed in the game screen (HTML5, not Flash) to the iFrame, but this can happen through the use of $_POST and $_GET parameters, as it probably wouldn't be possible otherwise due to some kind of "cross domain policy".
Can someone get me on my way, with an example of a basic Chrome userscript, that would allow me to inject some HTML code for the overlay div into the game?
Why not use something like an existing Javascript framework (gotta love em')? I know this has been done again and again and again before. I feel like doing this sort of Javascript yourself may not really be worth your time. Usually when I see things like this, I offer the help of a framework. Couldn't hurt to check one of them one, you may end up saving yourself a lot of time coding something that's been done before and tested through time.

What does JpegMini use to animate the image comparison on the homepage?

Hopefully the title is clear. I'm talking about the large image comparison slider on the homepage of JpegMini.
I've managed to identify it as needing three core files (written as they are named on the site):
jquery.min.js
jquery-ui-1.8.14.min.js
scripts-0135.min.js
It's this last one I'm unable to find any information about so it may hold the secrets but I don't know.
Anyone got any ideas?
The .imagePairs elements have a mousemove event bound:
$('.imagePairs').data('events').mousemove[0].handler
is a function.
The code is apparent inside scripts-0135.min.js, but it is minified.
What you can do is parsing it through jsbeautifier and see if you can make something out of it. It will still have variable names which make no sense, so it will not be easy.
Looking at the code, it seems like they initialize it with $('.imagePairs').myBeforeAfter, which is most probably the function that handles the effect.
I never was able to determine the script used, in the end I searched the web and found a suitable alternative which came with good documentation. http://www.catchmyfame.com/2009/06/25/jquery-beforeafter-plugin/

is there an easy way to track a javascript variable with firefox?

I am looking for an easy way to track the many changed of a variable in firefox.
I am looking for something that will not require me to add reduntant code, like alert, or console.log, but rather way to tell firefox to report each time a JS var is changed
am I dreaming?
firebug allows you to watch variables.
http://getfirebug.com/wiki/index.php/Script_Panel
You can add it to the "Watch" tab under the "Script" tab in Firebug. This will always show you the current value of a watched item, even if it's out of scope and null. Mix that in with break points and you can get what you want I think.
Additionally, console.log isn't redundant. You could set a global variable that would turn on the logs, something like:
if (debugging) {
console.log("var test is set at " + test);
}
That way they'd act more like trace points that you could trigger. For a bigger app this overhead pays for itself quite quickly.
It sounds like you are looking for Firebug. Check it out.

Categories