Posts by: juergen

Posts: 1425
Post: 11602
Topic: TOTALLY IMPRESSED - But......I need a lil help.
I believe he solved it by using the "Cajón Scss" theme which supports more than 2 menu levels in the main nav.
1 month ago
Post: 11601
Topic: What haven't I done??? WHERE is the Gallery?

Gallery is a section type you can add using the editor's 'Page' mode:

1 month ago
Post: 11596
Topic: Blank-Space above post! How do get rid of.

I think it's this rule:

#gpx_content > .GPAREA:not(.gpSlideWrapper):not(.filetype-responsive_image):not(.filetype-parallax_image):not(.no-padding),
#gpx_content > .blog_post,
#gpx_content > .post_list_item,
.gpAfterContent:not(:empty) {
    padding: 45px 60px;
    padding: calc(15px + 5vw) calc(15px + 7vw);
}

You can overrule it via Layout Editor -> Scss panel

2 months ago
Post: 11588
Topic: Adding script to title

@mabu:

if( \gp\tool::LoggedIn() ){      ---   and  ---  if( common::LoggedIn() )  {

there is no practical difference.
 

\gp\tool\Some::Thing is the more recent way to access our functions / variables / objects. See PHP namespacing

The older way using e.g. common::LoadComponents('fontawesome'), gpOutput::GetHead(), etc might become deprecated or even removed some time. But there is no hurry yet.

 

Edited: 2 months ago
Post: 11587
Topic: Adding script to title

I wondered about the variable if(isadmin)

I removed the if condition from the last versions because the .navbar-brand element is nothing that can be edited on-page so it's safe to execute the script while logged-in.

isadmin is a global JavaScript boolean variable defined by Typesetter.

The PHP side doesn't have an equivalent variable but you can always call the method \gp\tool::LoggedIn() which will return true or false.

2 months ago
Post: 11585
Topic: Adding script to title

Sometimes I should really read more carefully when the always excellent MDN says…

The Date.now() method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

… which means, when read carefully, since 1970/01/01 UTC *and not* since 1970/01/01 in UTC.

Other docs, namely the official specs rather put it this way:

Date.now();

The now function return a Number value that is the time value designating the UTC date and time of the occurrence of the call to now.

It is hard to bear in which enchanting beauty this sentence shines! Grrr ....

So, javascript's Date.now() gives the local time (in milliseconds) while PHP's time() gives the current UTC time (in microseconds).
Completely logical, isn't it? I'm pretty sure I got it once and for all. Well, at least until tomorrow morning.

Conclusion:
Spending too much time in a just UTC+1 time zone may convey a false sense of security, javascript-date-wise.

2 months ago
Post: 11584
Topic: Adding script to title
date_default_timezone_set("Pacific/Auckland");

That's for PHP only, it will have no influence on client-side JavaScript at all.

When I paste my latest version into the JS console on your site, it appears to work.I get my local time + 13 hours which only seems to work.
When I paste your version, I get my local time (currently ~ 22:30) and so do you (~ 10:30)

But we're getting closer…

<?php
$page->jQueryCode .= '

  CallAlistair = function(){

      var where_to_write = ".navbar-brand";

      var utc_time = Date.now();
      var utc_date = new Date(utc_time);
      var tz_offset = new Date(utc_time).getTimezoneOffset();
      var auckland_time = utc_time + (60000 * tz_offset) + (3600000 * 13);
      var auckland_date = new Date(auckland_time);
      var auckland_hours = auckland_date.getHours();
      // console.log(auckland_hours);

      if( auckland_hours > 8 && auckland_hours < 18 ){
          $(where_to_write).html(
            "TheHomeNZ Waihi Beach - "
            + "Call Alistair mobile +64211748741"
          );
        }else{
          $(where_to_write).html(
            "TheHomeNZ Waihi Beach - "
            + "Local Time: "
            + auckland_hours
            + ":"
            + (auckland_date.getMinutes() < 10 ? '0' : '')
            + auckland_date.getMinutes()
          );
        }
    };
  CallAlistair(); // immediate call
  setInterval(CallAlistair, 900000); // repeat every 15 minutes

';
?>

I can feel it ;)

Edited: 2 months ago
Post: 11582
Topic: Adding script to title

OK, I just debugged it on-site and changed a few things.

Please use this code:

<?php $page->jQueryCode .= '

  CallAlistair = function(){

      var where_to_write = ".navbar-brand";

      var utc_time = Date.now();
      var auckland_time = utc_time + (3600000 * 13);
      var auckland_date = new Date(auckland_time);
      var auckland_hours = auckland_date.getHours();
      // console.log(auckland_hours);

      if( auckland_hours > 8 && auckland_hours < 18 ){
          $(where_to_write).html(
            "TheHomeNZ Waihi Beach - "
            + "Call Alistair mobile +64211748741"
          );
        }else{
          $(where_to_write).html(
            "TheHomeNZ Waihi Beach - "
            + "Local Time: "
            + auckland_hours
            + ":"
            + (auckland_date.getMinutes() < 10 ? '0' : '') 
            + auckland_date.getMinutes()
          );
        }
    };
  CallAlistair(); // immediate call
  setInterval(CallAlistair, 900000); // repeat every 15 minutes

'; 
?>

 

FYI:

    $(where_to_write).html(
      "Local Time: ".auckland_hours);
    }

In JavaScript, the concatenation operator is + (plus) while in in PHP it is . (dot)
In JS the dot operator is the "object property accessor".

Certainly the most common error when switching between PHP and JS.

2 months ago
Post: 11579
Topic: Adding script to title

Tried that ".navbar-brand" and ".title" and "title"

Too bad. With '.navbar-brand' and Bootswatch themes you should actually have seen a change. Hard to tell what went wrong.

… found under Settings/Config/General/Title

Well ... that's the server-side configuration value - we really should not change that value dynamically.
If we did, Googlebot and other crawlers could add it to their index based on their visit time. Then your phone number would appear very prominently in the search result lists. I think that's not what you want.


 

2 months ago
Post: 11577
Topic: Adding script to title
Try using '.navbar-brand' as selector string. But don't use the <a href=\'tel:+...>   </a> parts because this element is already a link.
2 months ago

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register