Trigger featherlight.js by clicking image without <a> element - featherlight.js

Is there a way to get featherlight.js to trigger on an image itself, as opposed to a surrounding link?
For example, I'm trying this:
$('img.pop').featherlight($(this));
But getting an error:
a.cloneNode is not a function

Should not be a problem. The problem is probably what is this in your code above. That's why my advice to anyone ever reporting a problem is to produce a working example.

Related

Get screen size in EJS

I'm working in an EJS template and I need to determine the screen size. I'm using Grunt & Browserfy to compile (apologies if this is the wrong terminology). Using window.screen.width or window.matchMedia returns an error that window is not defined. What would be the best way to access this information?
Answering my own question: I understand now that EJS is rendered on the server so there is no screen to reference. I ended up using Javascript to accomplish what I needed since it's rendered in the browser. It's messier than I wanted but works nonetheless.
Try just using screen.width without the "window" in front.

How can a slider be linked to a parameter during runtime?

I currently try to solve the following problem: I create a slider and a parameter during runtime inside of an agent. Now I would like to link the slider to the parameter. However, I am not able to find API code to solve this in a straightforward manner. I`ve looked through the Java interface. It seems that I need to add this function manually as a function executeShapeControlAction(). I try to avoid writing code directy in the JAVA interface. So I am curious about the easiest ways to connect a during runtime created slider with an already existing parameter.
Thank you!
Every parameter generates a "set_" function for you. Assume your parameter is called myParam. Then you can change it at runtime by calling set_myParam(somevalue).
Use that in your slider action as set_myParam(value) and your slider value will change the parameter.
cheers

Unity not allowing me to use Screen.safeArea

I am trying to adjust the UI in my game to properly fit on the screen of an iPhone X.
In my code I am attempting to code the line return Screen.safeArea
However 'safeArea' is highlighted red and when I hover over the error with my cursor a message is displayed saying "error CS0117: 'UnityEngine.Screen' does not contain a definition for 'safeArea'".
I dont understand why I'm getting this error because according to Unity's documentation UnityEngine.Screen does contain a definition for safeArea.
Any inclination or idea as to why I am running into this error?
Also, I am working with Unity 2017.2.0f3
As per comments bellow, code as been asked for.
private Screen ReturnSafeArea(){return Screen.safeArea}
as I tried saying, the code has nothing to do with it. Even in this simplistic instance of the use of Screen.safeArea, safeArea is listed as not a definition of UnityEngine.Screen.
Hovering over safeArea displays the following message
"'Screen' does not contain a definition for 'safeArea"
Screen.screenArea is of type Rect and your method is defined as returning a value of type Screen
https://docs.unity3d.com/ScriptReference/Screen-safeArea.html
One way to correct this:
private Rect ReturnSafeArea(){
return Screen.safeArea;
}
Additionally, the field was added in 2017.2.0p1 (Nov 6) and you're on 2017.2.0f3 (Oct 3). Link is for 0.2, but 0.f3 does not have its own page, so likely was made either the same day or very shortly after.
I believe Screen.safeArea was added in a minor release of 2017.2, so 2017.2.0f3 would not have it. Try your code in 2017.2.1 and newer to confirm. It's too bad the documentation doesn't specify that.

File Upload not working after moving form field

I have a large form with a image upload field working ok.
Field is defined in model as:
$this->add('filestore/Field_Image','thumbnail_id');
Then I created two tabs inside form:
$tabs=$form->add('Tabs');
$main=$tabs->addTab('General');
$design=$tabs->addTab('Design');
And moved image field to design tab:
$design->add($form->getElement('thumbnail_id'));
Now I can't upload files. When I try I get the following javascript error
Error: cannot call methods on atk4_form prior to initialization; attempted to call method 'submitPlain
Is there any other way to move the field or have upload working again after moving it?
I was trying to use the same method ($design->add($form->getElement('my_element'));) to move a slider into another place on the page. That didn't work - I think it was because the slider input field is not placed on the page the same way as other input fields.
So I tried with the jQuery appendTo-method (I found the hint in a comment from romanish in a documentation page). That worked. But then I experienced the same problem as you - and in the end I gave up and solved the problem by editing the slider-class page.
So I can't help you, sorry, but I guess this points out that there is a general problem related to getting input from moved form elements.

TinyMCE get form content without using submit button

I'm trying to put TinyMCE on my website. I figured out how to get it to show up, but I'm lost on how to process the content. In their example, they just have a link that references the top of the page and clicking on it somehow magically causes their dump.php script to execute. I don't understand what's going on here. Here is the link:
http://www.tinymce.com/tryit/basic.php
The "Submit" button at the bottom is really a link in a span element with href="#". The form action is dump.php. I want to know how they configured this to run without an actual submit button. Any help in understanding this is greatly appreciated!
To Get Content From Tinymce You Can Use GetContent Method of Currently ActiveEditor Instance
tinyMCE.activeEditor.getContent();
method is used to getting Content .. to Set The Content
tinyMCE.activeEditor.setContent("I Want Text To Be in Tinymce");
to find a perticular element in tinymce get body and find element
var body = tinyMCE.activeEditor.getBody();
$(body).find("#elem_id")
to get a full html
tinyMCE.activeEditor.getDoc().documentElement.innerHTML
hope that helps ..
Since I use PHP, I found this which is also useful:
http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_TinyMCE_in_PHP