Script Declaration in Image field

More
12 years 7 months ago #38678 by brandonking
If we set Use Popup to Yes in Image field,
all related js and css files are included if there is image on page..
This sometimes give us some js conflicts.

All my images in Item List View are not set to popup, only for link to its item page.

So, we better to have some restricts,
like Use popup Only for ITEM VIEW/ITEM LIST VIEW/CATEGORY VIEW/MODULE(Multi-Select will be better).
Code:
if ($view=='item'){ $document->addScript(JURI::root().'components/com_flexicontent/librairies/multibox/Scripts/multiBox.js'); }
Code:
if ($view=='item'){ $document->addScriptDeclaration($js); }

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38679 by ggppdk
Hello,
What you describe is done already (but...), please below:

... we have 2 parameters:
usepopup and popupinview

the 'popupinview' is checkboxes and is used to turn off popup in non-selected views:

$popupinview = $field->parameters->get('popupinview', array(FLEXI_ITEMVIEW,'category','backend'));
Code:
$popupinview = FLEXIUtilities::paramToArray($popupinview); if ($view==FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW,$popupinview)) $usepopup = 0; if ($view=='category' && !in_array('category',$popupinview)) $usepopup = 0; if ($isItemsManager && !in_array('backend',$popupinview)) $usepopup = 0;
(but i see the check for view == 'module to be missing:)
Code:
if ($view=='module' && !in_array('module',$popupinview)) $usepopup = 0;

Please check these 2 cases:

a. 'popupinview' does have option for 'module' but in the code it is missing (bug i will add) ... so maybe the problem comes from there? e.g. if you add the image field in custom fields of module then JS code for popup will be added

b. the parameter 'linkto_url' forces the adding of JS code for popup

is a or b your case ?

FOR a, i ll add option for 'module'
(the fields are called with view that can have 3 values: item, category = 'all content lists views', module)
... but image field also uses backend (not the view variable, it calculates variable $isItemsManager inside the code)

FOR b, you think to use parameter 'popupinview' to also turn off 'linkto_url' or add 'linkto_inview'?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38682 by brandonking
In my case is A, as you mentioned, I have universal modules displayed in front page and that's why I see scripts included. I will check for other pages and let you know soon.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38684 by ggppdk
Please find code:
Code:
$popupinview = FLEXIUtilities::paramToArray($popupinview); if ($view==FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW,$popupinview)) $usepopup = 0; if ($view=='category' && !in_array('category',$popupinview)) $usepopup = 0; if ($isItemsManager && !in_array('backend',$popupinview)) $usepopup = 0;

and add after it:
Code:
if ($view=='module' && !in_array('module',$popupinview)) $usepopup = 0;

and also make sure 'module' is not check for parameter "Popup in view"

and test ...

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38702 by brandonking
Yeap, it works.. all the scripts and css are now gone.
Thank you. :)

About

b. the parameter 'linkto_url' forces the adding of JS code for popup


I have tested and had no problem.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38704 by brandonking
You have updated Galleriffic image plugin into latest version in revision 1697 but, in xml file, the Galleriffic option in popuptype is still commented. :)
<!--option value="5">FLEXI_FIELD_IMAGE_GALLERIFFIC_BUILTIN</option-->

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38707 by ggppdk
Hello,

about galleriffic, i wanted
-- to test CSS and make sure that layout is EITHER responsive OR may add one/two parameters for it


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38713 by brandonking
Actually, I tried to use it but there were CSS conflicts in many places.
And I guess HTML structure is not correct somewhere.
I spend an hour to solve but I couldn't.... :)

Anyway, I have found different version in Elasislider. I will test and let you know soon. This one is displaying description as well and it is responsive as well.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38725 by ggppdk
Hello,

just some comments to consider, that adding something to the image field is not trivial

extra things we did:

1. added code to allow multiple instances of elastislide and photoswipe, e.g. you have 2 galleries in a single item, or you want to use the image fields in a content list, the gallery elements need to have unique ids and variables

2. the photoswipe does not require to be placed inside ul li so i removed these , allowing the proper usage of prefix/suffix/separator/etc

3. the elastislide has some mootools / jquery conflicts, had to patch the library

4. the elastislide requires can not use the separator parameter so placed a check to force separator to be empty


Also the "Use popup" parameter was renamed ro:
Thubmnail list type
- Plain list
- Gallery Layout
with description:

Choose to either display a PLAIN thumbnail list or place your thumbnails inside a popup/inline/other Gallery Layout
-- The Gallery Layout will allow opening the thumbnails in a popup or inline (manual or automatic) image slideshow / carousel"


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #38735 by brandonking
About Elasislide, I found a new one, I mean looks nicer and we even can display Tooltip Description. I am sure you will like it.

Demo: tympanus.net/Tutorials/ResponsiveImageGallery/

RESPONSIVE IMAGE GALLERY WITH THUMBNAIL CAROUSEL
tympanus.net/codrops/2011/09/20/responsi...ent-page-1/#comments

The only concern is that we have to place a jQuery template into head tag.
Code:
<script id="img-wrapper-tmpl" type="text/x-jquery-tmpl"> <div class="rg-image-wrapper"> {{if itemsCount > 1}} <div class="rg-image-nav"> [url=#" class="rg-image-nav-prev]Previous Image[/url] [url=#" class="rg-image-nav-next]Next Image[/url] </div> {{/if}} <div class="rg-image"></div> <div class="rg-loading"></div> <div class="rg-caption-wrapper"> <div class="rg-caption" style="display:none;"> <p></p> </div> </div> </div> </script>

If I use "$document->addScriptDeclaration", it won't add <script> tags.
If I use "$document->addScript(JURI::root().'components/com_flexicontent/librairies/elastislide2/js/gallery.js');", I will add "<script language="JavaScript" type="text/javascript">"

But we need to add "<script id="img-wrapper-tmpl" type="text/x-jquery-tmpl">".
Do you have an idea how to add scripts with above tag?

Anyway, I have added them manually into my index.php.
Please see PM.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save