Jump to content

iwato

Members
  • Content count

    1,111
  • Joined

  • Last visited

Everything posted by iwato

  1. GENERAL: One of my colleagues claims that no one likes CSS. But surely, someone does, else it would not exist. Unfortunately, I am not one of those who is very fond of it. Probably because I do not understand it. Dsonesuk once told me that id takes precedence over class. The furtive fox told me to insert my stylesheet dynamically, so that I would be sure that the needed CSS would be present when my dynamically HTML was in need of it. I have accommodated my CSS specification in both of these ways, but still it does not work. Rather, when I visit the Inspector menu of my web-console, it looks like a graffiti-board that someone was too lazy too clean and on which he simply crossed out everything that he did not like. SPECIFIC: I am trying to get my referral URL to break when it gets to the end of the div block in which it is contained. In order to achieve this I entered the following piece of code in my stylesheet. The url does not wrap. Although the inspector of my web console indicates the presence of my specification, it also shows that the rule has been cancelled. Truly I do not get it. #yp_container #current_referral_url { overflow-wrap: normal; } SOURCE: Please open to the mainpage of the Grammar Captive website and click on the phrase Your Data and You under the heading Visitor Profile in the navigation bar. Look for the term Referral URL and note, if you are able, that the URL exceeds the size of the fieldset and div in which the value of the URL is contained . QUESTION: What more must I do to achieve my goal?
  2. PROBLEM: The following script is purported to add a select number of zeros to the left of a numerical value. Although it appears logically correct, I do not know how to call the function thus created. The SCRIPT Number.prototype.pad = function(size) { var s = String(this); while (s.length < (size || 2)) {s = "0" + s;} return s; } REQUEST: Could someone please give an example of how I could convert the number 2 to appear as 002 using the above script. Roddy
  3. iwato

    How to Prepend Zeros to a Numerical Value

    Dsonesuk. thank you, but I am only unclear about that part of the implementation that encloses the number 2 in parentheses. Why is the number two enclosed in parentheses? Roddy
  4. DILEMMA: I have a fairly complex JSON object that is introduced via an AJAX call. Unfortunately, my control panel tells me that it is undefined. Is this because it has no value? Or, is it because I do not know how to read the value properly? {"lastVisits"[{"firstVisit":{"prettyDate":"Monday, May 14, 2018"}}]} The name of the variable into which it is read is visitor_data. Am I reading the value of correctly? visitor_data.lastVisits[0].firstVisit.prettyDate Roddy
  5. iwato

    How to Prepend Zeros to a Numerical Value

    Great! But ... I still do not understand it. What pray-tell is the meaning of the numbers enclosed in parentheses. Do the parentheses convert the number number into an object? Roddy
  6. OK. I have fixed the problem. I am now able to get prettyDate to appear. Clearly I misunderstood the structure of the object read by the $.ajax( ) success function. My having misinterpreted the structure of this object was no casual error, however. For, the object consists of nearly 2000 lines of comma separated property-value pairs, nested array-like structures, and the like. As a result, I am of the firm conviction that similar errors will occur in the future until I learn how to traverse and display the content of the object that I am dealing with. Visual inspection, something that I can now do, is not enough, as I have no means of collapsing the various sub-elements of the object. This said, surely there is a formal methodology for parsing the structure of a complex, many layered JSON object with Javascript. Can this be achieved through a single, highly flexible, recursive function? Or, must it be achieved one layer at a time through painstaking trial and error? Still this latter would be better than what I am doing now. Could someone, please, point me to a tutorial about how to parse and display such an object. Roddy
  7. DILEMMA: Visitors to the mainpage of my website can fill the middle section of the page from the page's navigation bar in either of two ways. Both ways employ Javascript: one, copy a div already on the page into another div on the same page; and two, copy the contents of a div on a another page into same. What I would like to do now is to copy the contents of a div already on the page with a call from the contents of a div that was previously on another page. QUESTION: How does one get a div to replace its own content when the div whose contents needs to be replaced has been filled with content from another page? Roddy
  8. OK, Team, your confusion helped me to unravel my own confusion, and I was able to achieve the task with overwhelming success. SUCCESS: The following code replaces the current content of <div id='main'> with the content of another called <div id='legal_div'>. It also propels the user to the top of the hosting div -- namely, <div id='main'> after the new content is in place. This task is achieved with a Javascript file that was imported when the old content was set. My confusion was three-fold: 1) how to select the #main div 2) where to place the Javascript, and 3) how to select the <h2> element called #data_analysis $("#make_invisible").click(function() { var replacement = $("#legal_div").html(); $("#main").html(replacement); $('body, html').animate({scrollTop: $('#main').find('#data_analysis').offset().top},800); }); In any case, the problem is now resolved. Roddy
  9. OK. Let us assume that how the content was inserted and the content itself do not matter. How does one go about replacing the content of a div from inside the div whose content is to be replaced? This should be a much easier question to understand. Roddy
  10. The DILEMMA: Recently I discovered how to enable responsive design on my website's main page. Although the page itself is now responsive, the splash panels that are associated with it are largely dysfunctional. Having experimented in various ways to make these latter responsive as well, I have decided to simply eliminate them on mobile devices. What is the best way to do this? Already I have combined PHP and Javascript to suppress the splash panels in the same session. So, my question is what is the best way to recognize any mobile device? Roddy
  11. iwato

    Disable $.colorbox for Mobile Devices

    With the exception of the American public, not everyone is intentionally stupid. I try not to punish people for their ignorance. Nature will do that on its own accord. In any case, it appears that I have resolved the need for zoom by setting the minimum width of the acceptable viewport to wider than the height of the viewport of the smallest smartphone. This pretty much insures that enough of the splash panel will be made visible so that it can be easily eliminated, if it gets in the way. Roddy
  12. iwato

    Improperly Displayed Submit Button

    BACKGROUND: Now that I have finally got my responsive design to function properly. I did a little exploration of my site from my new iPhone 5 that a colleague gave me.to replace my broken "obsolete" iPhone 4. What I discovered was the unusual appearance of one of my form input controls. Although the submit button appears correctly on my still functioning "obsolete" MacBook, it does not appear correct on my new, not yet "obsolete" iPhone. When I investigate the matter with Firebug I am told that there is event bubbling. Now, I am not at all sure that this is the source of the problem. Neither, am I clear about how the bubbling is being created. This is the first time that I have encountered such an issue. TROUBLED DOCUMENT: 1) Open the Grammar Captive mainpage in your smartphone. 2) Find the text Weekly Podcasts under the Products subtitle in the navigation bar on your left and click on it. 3) Scroll to the bottom of the form located toward the bottom of the page and discover that the value of the button -- namely, Discover! -- is partially hidden. The width of the button is clearly not wide enough to display the entire value of the value attribute. QUESTION ONE: Why does the value attribute display correctly in my browser window on my "obsolete" MacBook, but not on my not yet "obsolete" iPhone? QUESTION TWO: If bubbling is the source of the problem, what must I do to fix it? Roddy
  13. iwato

    Improperly Displayed Submit Button

    I still have not discovered a solution for my submit buttons. By way of example, go to the Grammar Captive mainpage, find the phrase Weekly Podcasts in the navigation bar on your left, and click. When the panel opens scroll down to the bottom of the page. Only when my phone is turned horizontal will the button at the bottom of the form appear as it should. Roddy
  14. GREETING: One more quick question before the weekend begins. BACKGROUND: Until now, it has been easy to see the results of AJAX calls in the files that produce them. Until now, cURL was never an explicit part of my web-application. I am now making a dual call, however, and am unable to see the final result. The first call stipulates no method as nothing is sent. The second call is based on the result of the first call and uses the POST method to make the request. Although I can see the contents of the first request, I cannot see the contents of the second. Both files use identical cURL routines and both perform exactly as expected, as AJAX returns everything that is requested. Only the query statements of the URL are different. Even the specified AJAX dataType is the same for both calls -- namely, JSON. Please find below the code that produces the output that I wish to see, but cannot. The PHP for the 2ND AJAX CALL ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); if (!empty($_POST['ip_addr'])) { $ip_addr = filter_var($_POST['ip_addr'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); $url = 'https://.../matomo/index.php?module=API&action=index&visitIp=' . $ip_addr . '&idSite=1&period=week&date=today&method=Live.getVisitorProfile&format=json&expanded=0&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); } QUESTION; What must I do to make the output of the cURL call visible in the file that produces it without disrupting the AJAX call that retrieves the output that I cannot see. Or, am I missing the whole point of cURL and the data is tranferred directly to the AJAX? But, why would I be able to see it in the first request, but not the second. Roddy
  15. This is cool. I did not know that you could do this. I will surely keep it in mind, as it could prove very useful down the line. I am much better at mannipulating data with PHP than I am with Javascript even when it is written in JSON. I do not know how to send POST data via a link. Is it even possible? I recall Dsonesuk teaching me how to format POST data within an AJAX call, but this is all that I can remember. Roddy
  16. iwato

    Improperly Displayed Submit Button

    Nope. I tried the following three things and refreshed the browser page of iPhone each time. 1) Placed the -webkit setting before the rule. 2) Eliminated the -webkit setting altogether. 3) With the setting eliminated introduced the suggest CSS script. All of these failed. I do believe you are correct about it having something to do with the OS's button styles. As other buttons on other filler pages are also distorted. Any suggestions about where to go to obtain more insight into the resolution of the problem. A Google search for the problem suggested the same as you.
  17. I have found another way to achieve my task. I copied the file, changed the POST variable to GET and accessed the copied file with query statement thus circumventing AJAX. I am asking myself, however, your suggested method works. For, if I assign the contents of the curl_exec() statement to a variable. How will AJAX no where to get the variable's contents? Roddy
  18. iwato

    Disable $.colorbox for Mobile Devices

    Yes, I will do it with jQuery. I found these two rather simple jQuery methods: $(window).width() and $(window).height(). According to the jQuery manual, however these methods do not account for zoom effects. This suggests that the user could made the window much larger than the viewport and deceive my code into believing that the viewport is bigger than it is. Do you have a suggestion to get around this problem? Roddy
  19. No, I already tried that. It does not work according to the manual. AJAX likes both of the following, but neither satisfies my desire the entire outcome en gros. curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 0); curl_exec($curl_request); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); echo curl_exec($curl_request); In order to iterate through the complex JSON object that results I must be able to see the whole thing JSON string! Roddy
  20. iwato

    Disable $.colorbox for Mobile Devices

    OK. I do not worry about the nature of the device, only the screen resolution, but how do I obtain the screen resolution? From the $_SERVER variable. I could surely obtain it from Matomo, but I do not wish to make the actual functioning of my site dependent on Matomo for anything that is not directly related to Matomo. Mind you, Colorbox is Javascript, and the contents of my splash panels are spread across many webpages. It is a complex design that is repeated many times. Unless Javascript can be triggered by an @media rule I have no idea how I would go from CSS to disabling Colorbox. Roddy
  21. iwato

    Responsive Design Dysfunction

    Problem resolved. Hooray! Hooray! Hooray! Roddy
  22. iwato

    Responsive Design Dysfunction

    BACKGROUND: Within two weeks of my iMac hard disk failure I also lost my iPhone due to a failed power socket. People simply do not service what Apple calls "obsolete" equipment. Although I have yet to replace my iMac, one of my colleagues had an iPhone 5 that he was no longer using and gave it to me. With his new phone in hand I went straight to the Grammar Captive website only to discover that what worked well in a device simulator does not work well at all in the real-life device. Now, my website is divided into five parts: a banner, a navigation bar, the main content section, a side bar with RSS feeds, and a footer. When the viewport is small, the aforementioned divisions are supposed to build a five tier column: banner, navigation bar, main content, side-bar, and footer. If you own an iPhone 5 compare the results for podcast_hostpage.php and with those of overview.html and see the difference. The former displays correctly, the latter does not. QUESTION: What must I do to restore the five-tier nature of overview.html? Roddy
  23. iwato

    Send email on file date time condition

    You will likely find your answer under PHP Other Services. See PHP Event. Roddy P.S. If this helps pass your cursor over the heart and click the trophy.
  24. iwato

    Text Misalignment in a Flexbox Item

    BACKGROUND: Recently I designed a filler page that is called with AJAX. When the AJAX call is made a css style sheet is called in addition to the filler. For the most part the style-sheet appears to work. Even the styling for the flex-box that is included in the filler works in part. Simply, it appears to be breaking on inheritance, and I do not know how to override it. The HTML <div id='yp_container'> <div class='yp_item'> <div class='yp_param'>Visitor ID:</div> <div id='current_visitorId' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>IP Address:</div> <div id='current_visitIp' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>Total Visits:</div> <div id='current_totalVisits' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>City:</div> <div id='current_cities' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>Referral URL:</div> <div id='current_referral_url' class='yp_value'></div> </div><!-- end div.line_item --> </div><!-- end div#yp_container --> CSS Style-Sheet (Relevant Code Only) /*************************************************** Visitor Info (Flexbox) ***************************************************/ #yp_container { display: -webkit-flex; display: flex; flex-direction: column; width:100%; } .yp_item { display: -webkit-flex; display: flex; flex-direction: row; justiy-content: space-between; } .yp_param { text-align: -webkit-right; text-align: -moz-right; padding-right: 2em; } .yp_value { text-align: -webkit-left; text-align: -moz-left; } You may observe the result by clicking on the words Your Profile under the sub-heading User Profile in the Grammar Captive navigation bar. Roddy
  25. iwato

    Text Misalignment in a Flexbox Item

    This problem has been resolved with the realization that I was viewing flexbox in MacOS 10.7.5 Firefox and Chrome environments. Fortunately, I made good use of my frustration and made the CSS code more robust by "overspecifying" the various flex-items. I do have another question about CSS, but unrelated to this one that I will post in a different entry. Roddy
×