Approve the Cookies
This website uses cookies to improve your user experience. By using this site, you agree to our use of cookies and our Privacy Policy.
OK
Index  •   • New posts  •   • RTAT  •   • 'Best of'  •   • Gallery  •   • Gear  •   • Reviews
Guest
New posts  •   • RTAT  •   • 'Best of'  •   • Gallery  •   • Gear  •   • Reviews
Register to forums    Log in

 
FORUMS Post Processing, Marketing & Presenting Photos Presentation & Building Galleries 
Thread started 29 Mar 2018 (Thursday) 17:08
Search threadPrev/next
sponsored links
(this ad will go away when you log in as a registered member)

A little code help please

 
Nascar ­ Nut
Senior Member
383 posts
Likes: 10
Joined Feb 2004
     
Mar 29, 2018 17:08 |  #1

I have a personal website full of images. It is a WordPress site that when I click on an image it opens in a lightbox. I am using the nextgenpro plugin. What I want it to do is open up lightbox in fullscreen. Right now it opens in lightbox and then you have to click on full screen. The plugin creator would not tell me how to do this except to look at these two lines (212 & 214) in the nextgen_pro_lightbox.j​s. Shown below are the two lines but I have no idea what to change. My website only has my family and friends that look at it. Can anyone give me some help on this, please?

212 if (this.mobile.browser.a​ny()) {
213 this.fullscreen.enter(​);
214 }




  
  LOG IN TO REPLY
sponsored links
(this ad will go away when you log in as a registered member)
scokar
Goldmember
Avatar
1,072 posts
Gallery: 5 photos
Likes: 16
Joined Oct 2005
Location: Calgary, Canada
     
Mar 29, 2018 18:00 |  #2

without seeing the rest of the code, I would suggest:
a) back up file

b) comment out lines 212, & 214:

// if (this.mobile.browser.a​ny()) {
this.fullscreen.enter(​);
// }




  
  LOG IN TO REPLY
Nascar ­ Nut
THREAD ­ STARTER
Senior Member
383 posts
Likes: 10
Joined Feb 2004
     
Mar 31, 2018 18:51 |  #3

scokar wrote in post #18596614 (external link)
without seeing the rest of the code, I would suggest:
a) back up file

b) comment out lines 212, & 214:

// if (this.mobile.browser.a​ny()) {
this.fullscreen.enter(​);
// }

Thank you for the help. When you say comment out, do you mean delete those two lines?




  
  LOG IN TO REPLY
Left ­ Handed ­ Brisket
That's my line!
Avatar
9,006 posts
Gallery: 11 photos
Likes: 1937
Joined Jun 2011
Location: The Uwharrie Mts, NC
Post edited 7 months ago by Left Handed Brisket. (3 edits in all)
     
Mar 31, 2018 19:06 |  #4

Nascar Nut wrote in post #18597851 (external link)
Thank you for the help. When you say comment out, do you mean delete those two lines?

"Comment out" is a way of keeping the code in place but having it ignored when the PHP/HTML is processed. It is called comment, because it was put in place for making notes as reminders.

You can include basically whatever you want between the open and close of the comment.

Code is put in comments so you can go back and "uncomment" it later. Even still, scokar's point under a) should be headed.

https://www.w3schools.​com (external link)

The resource area ^ usually has enough info to give a good understanding of the tag/element/code/etc


PSA: The above post may contain sarcasm, reply at your own risk | Not in gear database: Auto Sears 50mm 2.0 / 3x CL-360, Nikon SB-28, SunPak auto 322 D, Minolta 20

  
  LOG IN TO REPLY
Nascar ­ Nut
THREAD ­ STARTER
Senior Member
383 posts
Likes: 10
Joined Feb 2004
     
Mar 31, 2018 19:09 |  #5

Left Handed Brisket wrote in post #18597861 (external link)
"Comment out" is a way of keeping the code in place but having it ignored when the PHP/HTML is processed. It is called comment, because it was put in place for making notes as reminders.

You can include basically whatever you want between the open and close of the comment.

https://www.w3schools.​com (external link)

The resource area usually has enough info to give a good understanding of the tag/element/code/etc

Ok, thanks again for the help. I will have a look at the resource link you posted.




  
  LOG IN TO REPLY
Left ­ Handed ­ Brisket
That's my line!
Avatar
9,006 posts
Gallery: 11 photos
Likes: 1937
Joined Jun 2011
Location: The Uwharrie Mts, NC
     
Mar 31, 2018 19:11 |  #6

Word. It is a great place. I edited some things in my post.

Brain tired.

Not functioning at full capacity.


PSA: The above post may contain sarcasm, reply at your own risk | Not in gear database: Auto Sears 50mm 2.0 / 3x CL-360, Nikon SB-28, SunPak auto 322 D, Minolta 20

  
  LOG IN TO REPLY
BigAl007
Cream of the Crop
7,913 posts
Gallery: 542 photos
Best ofs: 1
Likes: 1578
Joined Dec 2010
Location: Repps cum Bastwick, Gt Yarmouth, Norfolk, UK.
     
Apr 01, 2018 13:45 |  #7

I have no experience in programming in JS, but from what programming experience I do have, I can say that the first line is talking about an object, which is the browser that is currently running. It says that if the current browser is any sort of mobile browser, that's the this.mobile.browser.an​y() part of the code, it should do the following string of commands that are within the {}.


The command it should do is set the browser to full screen upon the program entering it. In most languages the bit that starts

this.????
is always referring to the current thing the program is working with, in this case the browser. In this case there is only one command to do if the original IF question was true, so there is only the one line. The last line with the } is just there to tell the program that all of the conditional IF commands have been processed.

By commenting out the first line of the code you remove the conditional question, is this a mobile browser. That question isn't asked, instead the command is applied to all types of browser. The last line is commented out because telling the program that a special section of code is complete, without starting a special section will always get messy. You pretty much always have opening { all over the code. Adding what is effectively a random closing } will stop something early. Sometimes as a programmer getting the opening and closing braces to match correctly is one of the hardest parts of debugging a program.

Adding comments to programs is useful since it can help remind you, or more importantly your replacement 30 years down the road, of what you were thinking when you wrote the code. In most programming languages the // tell the system that everything else on the line after this point is comment. Many languges also allow you to use /* as the start of a multi line comment, and then

on

another line you can use */ to close the block of comment. In a perfect world those three lines of code might look something like this:


if (this.mobile.browser.a​ny()) { //If "this" is a mobile browser do the following
this.fullscreen.enter(​); //Set "this" to full screen on enter
} //End of IF statement

Commenting out whole lines rather than deleting is good because if you got it wrong, and you broke it, repaing it is as simple as removing the comment indicators. But always remember to remove comments at both ends, or you just break it more.

Oh and where I mention what goes wrong when you get adding/removing the comments incorrect comes from long and hard personal experiance.

Alan

My Flickr (external link)
My new Aviation images blog site (external link)

  
  LOG IN TO REPLY
Nascar ­ Nut
THREAD ­ STARTER
Senior Member
383 posts
Likes: 10
Joined Feb 2004
     
Apr 02, 2018 09:51 |  #8

BigAl007 wrote in post #18598335 (external link)
I have no experience in programming in JS, but from what programming experience I do have, I can say that the first line is talking about an object, which is the browser that is currently running. It says that if the current browser is any sort of mobile browser, that's the this.mobile.browser.an​y() part of the code, it should do the following string of commands that are within the {}.


The command it should do is set the browser to full screen upon the program entering it. In most languages the bit that starts
this.????
is always referring to the current thing the program is working with, in this case the browser. In this case there is only one command to do if the original IF question was true, so there is only the one line. The last line with the } is just there to tell the program that all of the conditional IF commands have been processed.

By commenting out the first line of the code you remove the conditional question, is this a mobile browser. That question isn't asked, instead the command is applied to all types of browser. The last line is commented out because telling the program that a special section of code is complete, without starting a special section will always get messy. You pretty much always have opening { all over the code. Adding what is effectively a random closing } will stop something early. Sometimes as a programmer getting the opening and closing braces to match correctly is one of the hardest parts of debugging a program.

Adding comments to programs is useful since it can help remind you, or more importantly your replacement 30 years down the road, of what you were thinking when you wrote the code. In most programming languages the // tell the system that everything else on the line after this point is comment. Many languges also allow you to use /* as the start of a multi line comment, and then

on

another line you can use */ to close the block of comment. In a perfect world those three lines of code might look something like this:


if (this.mobile.browser.a​ny()) { //If "this" is a mobile browser do the following
this.fullscreen.enter(​); //Set "this" to full screen on enter
} //End of IF statement

Commenting out whole lines rather than deleting is good because if you got it wrong, and you broke it, repaing it is as simple as removing the comment indicators. But always remember to remove comments at both ends, or you just break it more.

Oh and where I mention what goes wrong when you get adding/removing the comments incorrect comes from long and hard personal experiance.

Alan

Thanks for all your insight on the code. Every bit helps as I no nothing about it. I have it backed up. So if I mess it up I will be fine.




  
  LOG IN TO REPLY
Nogo
I could have been worse....
7,125 posts
Gallery: 15 photos
Likes: 488
Joined Dec 2013
Location: All Along the Natchez Trace (Clinton, MS)
Post edited 7 months ago by Nogo.
     
Apr 02, 2018 11:41 |  #9

If you have not realized it yet, you can also "change" the code at a browser level rather than at the server level to make sure it works properly. I used to use firebug to do this, but now Firefox has added those functions to the Firefox developers browser.

Things have changed since I have done it so you may want to check around and get more updated information but to me it is much better to debug at browser level first than to do it all at a server level.

Then once it works there, then you just make the same changes to the server that worked in ( the "Firebug" replacement.) Then you have a good start.


Philip
Does the TF actually know about the soda cans and PVC pipe from 30 years ago?

  
  LOG IN TO REPLY
Left ­ Handed ­ Brisket
That's my line!
Avatar
9,006 posts
Gallery: 11 photos
Likes: 1937
Joined Jun 2011
Location: The Uwharrie Mts, NC
Post edited 7 months ago by Left Handed Brisket.
     
Apr 02, 2018 17:02 |  #10

Nogo wrote in post #18598809 (external link)
If you have not realized it yet, you can also "change" the code at a browser level rather than at the server level to make sure it works properly. I used to use firebug to do this, but now Firefox has added those functions to the Firefox developers browser.

Things have changed since I have done it so you may want to check around and get more updated information but to me it is much better to debug at browser level first than to do it all at a server level.

Then once it works there, then you just make the same changes to the server that worked in ( the "Firebug" replacement.) Then you have a good start.

Changing html/CSS is one thing, but does this work with PHP and JavaScript?

Also, I think this.xxx is different in JS.


PSA: The above post may contain sarcasm, reply at your own risk | Not in gear database: Auto Sears 50mm 2.0 / 3x CL-360, Nikon SB-28, SunPak auto 322 D, Minolta 20

  
  LOG IN TO REPLY
Nogo
I could have been worse....
7,125 posts
Gallery: 15 photos
Likes: 488
Joined Dec 2013
Location: All Along the Natchez Trace (Clinton, MS)
     
Apr 03, 2018 00:42 |  #11

Left Handed Brisket wrote in post #18599032 (external link)
Changing html/CSS is one thing, but does this work with PHP and JavaScript?

Also, I think this.xxx is different in JS.

It works with HTML, CSS, and JavaScript. There are addons to help with PHP, but I don't know it those addons work anything like the CSS/HTML/JavaScript debugging methods. Like I said, my experience is mainly with Firebug. Firebug is no longer fully supported and what it does has been merged into the newer Developer Tools which is in a way a browser itself. Chrome has some of the same type of tools built into it as well.

I have used the new tools, but only enough to debug simple problems on websites. For that reason, I will leave it up to others with more experience to expand on this.


Philip
Does the TF actually know about the soda cans and PVC pipe from 30 years ago?

  
  LOG IN TO REPLY
Nascar ­ Nut
THREAD ­ STARTER
Senior Member
383 posts
Likes: 10
Joined Feb 2004
Post edited 7 months ago by Nascar Nut.
     
Apr 18, 2018 16:15 |  #12

scokar wrote in post #18596614 (external link)
without seeing the rest of the code, I would suggest:
a) back up file

b) comment out lines 212, & 214:

// if (this.mobile.browser.a​ny()) {
this.fullscreen.enter(​);
// }

I finally got around to trying this out. My site still didn't go full screen so their must be more to it than that.




  
  LOG IN TO REPLY
Pekka
El General Moderator
Avatar
17,644 posts
Gallery: 35 photos
Best ofs: 7
Likes: 1415
Joined Mar 2001
Location: Hellsinki, Finland
     
Apr 18, 2018 17:10 |  #13

I spent few minutes to Google on this, and that plugin apparently uses javascript fullscreen API which needs an event handler:

https://developer.mozi​lla.org …cs/Web/API/Full​screen_API (external link)
"Fullscreen requests need to be called from within an event handler or otherwise they will be denied."

Under paragraph "When a fullscreen request fails" there is more info on these security measures. Putting a site to fullscreen mode without user request may be very confusing and unwanted, all user interface controls disappear and this may be a big problem for some people and devices.

You can perhaps trigger the fullscreen mode on page load event handler.
https://stackoverflow.​com …script-event-to-page-load (external link)


The Forum Boss, El General Moderator
AMASS 2.1 Changelog (installed here now)

  
  LOG IN TO REPLY
sponsored links
(this ad will go away when you log in as a registered member)

1,021 views & 7 likes for this thread
A little code help please
FORUMS Post Processing, Marketing & Presenting Photos Presentation & Building Galleries 
AAA
x 1600
y 1600

Jump to forum...   •  Rules   •  Index   •  New posts   •  RTAT   •  'Best of'   •  Gallery   •  Gear   •  Reviews   •  Member list   •  Polls   •  Image rules   •  Search   •  Password reset

Not a member yet?
Register to forums
Registered members may log in to forums and access all the features: full search, image upload, follow forums, own gear list and ratings, likes, more forums, private messaging, thread follow, notifications, own gallery, all settings, view hosted photos, own reviews, see more and do more... and all is free. Don't be a stranger - register now and start posting!


COOKIES DISCLAIMER: This website uses cookies to improve your user experience. By using this site, you agree to our use of cookies and to our privacy policy.
Privacy policy and cookie usage info.


POWERED BY AMASS forum software 2.1forum software
version 2.1 /
code and design
by Pekka Saarinen ©
for photography-on-the.net

Latest registered member is hermant
800 guests, 380 members online
Simultaneous users record so far is 6430, that happened on Dec 03, 2017

Photography-on-the.net Digital Photography Forums is the website for photographers and all who love great photos, camera and post processing techniques, gear talk, discussion and sharing. Professionals, hobbyists, newbies and those who don't even own a camera -- all are welcome regardless of skill, favourite brand, gear, gender or age. Registering and usage is free.