Welcome to TalkGraphics.com
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    Took me a while but I got it to work, including the European date format and in Dutch. Very happy with that. However, the code doesn't seem to work in the mobile variant. I also tried it out in two Xara templates but nothing shows on the mobile sites.

  2. #12
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Which CSS to add?

    This works on my Android and iPhone4:

    <p id="updated"></p>

    <script>
    var d = new Date();

    var monthed = d.getMonth();
    var dayed = d.getDay();
    var dated = d.getDate();
    var yeared = d.getFullYear();
    var title = "Todays Date is ";

    var dayArray = ["Sunday ","Monday ", "Tuesday ", "Wednesday ", " Thursday ", "Friday ", "Saturday "];
    dayed = dayArray[dayed];

    var dateArray = ["st ","nd ", "rd ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","th ","st ","nd ","rd ","th ","th ","th ","th ","th ","th ","th ","st "];
    var ending= dated-1;
    var ending = dateArray[ending]

    var monthArray =["January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December "];
    monthed = monthArray[monthed];
    var total = title + dayed + " " + dated +ending + " " + monthed + " " + yeared;

    document.getElementById("updated").innerHTML = total.fontsize(5);
    updated.style.color = "Red";
    </script>
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  3. #13
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: Which CSS to add?

    Quote Originally Posted by Boy View Post
    Took me a while but I got it to work, including the European date format and in Dutch. Very happy with that. However, the code doesn't seem to work in the mobile variant. I also tried it out in two Xara templates but nothing shows on the mobile sites.
    You probably have to add the detail manually as otherwise there will be two blocks of text with the same ID and only the first one will fire. Stop sharing with variant; copy the text across to the variant; change the Name and Placeholder code. [Afternote: the variant Name seems to need a fudged Name of a prefix "Xxr_v2_"]

    Acorn
    Last edited by Acorn; 08 August 2016 at 04:48 PM.
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #14
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: Which CSS to add?

    Quote Originally Posted by Egg Bramhill View Post
    This works on my Android and iPhone4:
    ... but it is a pain to change language.

    I think I have addressed the variant issue.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #15
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: Which CSS to add?

    The final code I can offer does not need to account for the variant:
    <script>var options = {weekday: "long", year: "numeric", month: "long", day: "numeric"};
    var updateDate = new Date(document.lastModified);
    document.querySelector('[id$="petraVariant2"]').innerHTML = updateDate.toLocaleString("de-DE", options);
    </script>
    The querySelector('[id$="petraVariant2"]') part simply has to match the Name (here, petraVariant2) that you include for the textline.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  6. #16
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    Quote Originally Posted by Egg Bramhill View Post
    This works on my Android and iPhone4:
    Thanks Egg. It looks a bit like the code I used earlier and Acorn is right that it's a pain to change the language.

  7. #17
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    Quote Originally Posted by Acorn View Post
    The final code I can offer does not need to account for the variant:

    The querySelector('[id$="petraVariant2"]') part simply has to match the Name (here, petraVariant2) that you include for the textline.

    Acorn
    I couldn't get it to work with the prefix you mentioned in post #13 but this one works like a charm, Acorn. Thanks!

  8. #18
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Which CSS to add?

    One question Boy, is why are you using todays date as the last updated date?
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  9. #19
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Which CSS to add?

    What do you mean, Egg? I need the date of the last date that I made changes in Xara and published them to the website. Isn't that what Acorn came up with?

  10. #20
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Which CSS to add?

    Sorry Boy, my bad. I never noticed he was using:
    new Date(document.lastModified);
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •