Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. And then, if you want to replace each \n with a space, you simply write: var output = str.replace(/\n/g, " "); element.innerHTML = output; Roddy
  2. Hi, smus! Is your goal to detect the line breaks in str, replace each with a space, and reassign the resulting string to str? Also, are you certain about the nature of the linebreaks? Do you know with certainty that they are created with /n? Roddy
  3. Yes, indeed. In my effort to fix the Free Consultation panel, I have destroyed the color formatting for nearly every subsequent insert on the mainpage. Roddy
  4. Hi, Funce! I am glad to learn that you cannot find any misalignment. What device are you using to view the mainpage and inserted panels? Please compare the following two screen shots taken from an iPhone 5. Both of these panels are inserted from menu options under the heading Introduction in the mainpage navigation bar. There are two things wrong with what you see. 1) The alignment of the two panels appears different. The second (freeconsultation.png) overrides the left margin. The first (disclaimer.png) does not. 2) The color of the first panel changes from light to dark, if the second panel is opened before the first. This color change is then inherited in all subsequently opened panels under the Introduction section and likely elsewhere as well. The first panel is supposed to have a light background. Roddy
  5. BACKGROUND: In my most recent effort to fix the alignment problems associated with the responsive design of my site's mainpage I have managed to overcome several important hurdles. There does remain one problem, however, that I cannot seem to fix. This has to do with the rendering of inserted div elements in my site's mainpage. By way of example 1) Open Grammar Captive's mainpage in a smartphone -- preferably iPhone, for this is where I have detected the problem. 2) Click on the About option under Introduction in the navigation bar. The insert appears correct. No background color has been set. 3) Click on the Free Consultation option under Introduction where the background color has been set and notice the alignment failure in the left margin. Now, follow the same three steps, but with any browser on a normal computer, but achieve the affect by narrowing your browser window. The alignment problem does not occur. By the way, when I turn my phone sideways, the problem goes away. QUESTION: What might be causing the above described inconsistency? Roddy
  6. I now believe that the problem lies in the way that the Japanese language is parsed. A little additional research and reflection has reminded that I had set aside the introduction of the MeCAB and NGRAM full-text, MySQL plugins when I first built the search engines. Overtime I forgot. Matomo has more or less dominated my development activity for the past two and one half months. Indeed, if it were not so powerful, and my persistence had not paid off, however incrementally, I would have abandoned Matomo long ago. Roddy
  7. The mainpage splash panel was designed to server as a smooth transition between the simple, harsh, nearly rude landing page and the much softer, far more complex mainpage. Placing the splash panel where you suggest would destroy this transition. What is more, if you inspect the Splash Panel stats displayed in the Sponsor Profile menu in the mainpage navigation bar, you will find that people are making good use of the splash panel in its current position. Therefore I must decline your suggestion. Truly, if you are so disturbed by the two extra clicks that it takes to get to the mainpage, then I will not bother you anymore. Simply, you appear to be the most well-versed mentor in CSS at W3Schools, so I thought that I should address this ticket to you. My gosh, once you have opened the mainpage and clicked twice to remove the splash panel, you are good to go so long as you remain in the same session, are you not? Roddy
  8. As a matter of general knowledge what percentage of the people on the internet, do you think, clear their browser history on exit? I should think that it is quite small, but then I am only guessing, as I have never thought to clean my browser history expect for the purpose of development. In any case, what would you recommend as an alternative to localStorage? This was recommended to me by one of your fellow mentors, and it took some doing to implement it. I have several ways to turn off my splash screen, and for a long moment I did not know how to combine them into one statement. This has now been achieved. Roddy
  9. In order to make the pop-up disappear you must load the page twice. Once for your browser to recognize you as a previous user, and once to experience the effect of that recognition. It is the way window.localStorage property works. It came after you, not before you. It is something that a person with your development knowledge should not only understand, but should have understood. I know longer experience the pop-up, and neither should you. Roddy
  10. BACKGROUND: Recently I had occasion to make a search on my own website using the Newsletter search engine. What I discovered was the most bizarre of behaviors. I could perform one search in Japanese and then no more. In other languages such as French, German, and English I could perform as many searches as I liked -- even repeating the same words more than once -- and I always I was able to produce the expected result. Mind you, this bizarre one-find-stop--all-further-finds behavior in the Japanese language was not the case when I first installed my search engines. Now, I have checked my PHP error.log file and found nothing related to this problem. I have also checked that the parameter value of the AJAX call is being properly passed; here too there is no unusual behavior. This bizarre behavior was not always the case. It appears to have begun taking place all of its own. Any ideas? Roddy
  11. OK, Dsonesuk. I believed that I have followed your directions well. This can be easily seen by opening to the Grammar Captive mainpage in a computer or smartphone browser window. Where my CSS structure breaks down is with my #middle column inserts -- not all mind you, but certain ones in particular. Open, by way of example, the Free Consultation panel under the About section in the mainpage navigation bar. Do this first in your browser window and then with your Smartphone. For me, it performs well in the former (Firefox), but poorly in the latter (Safari) unless I turn my iPhone laterally. Please advise. Roddy
  12. I have now recoded the main style sheet for the overview.html webpage, and have sought with all my might to recode the overview.css and freewebinar_filler.css style sheets in a manner that will cause the freewebinar.html page to appear properly in the context into which it is written. I have failed. As I have performed this work in the context of an online development folder, I do not wish to expose its whereabouts to an anonymous general public. In contrast, I would be willing to share its location with a W3-Schools mentor via private mail. Surely we can discuss the problem here in the general forum; simply, others will not be able to view the pages directly. If there is a W3Schools mentor who is well-versed in CSS and willing, please make yourself known, and I will send you the link to the folder and webpage with your express promise not to share it with others. Roddy
  13. As I built my responsive design by copying what someone else had pioneered, I was not thorough in my understanding of how it worked. For, after all, it worked! Well, at least until I began adding my own content. Now, I am paying the price for my failure to understand as well as I should have at the outset. Accordingly, my first question in retrospect is the likely intended purpose of assigning the value of auto to the left and right margins in the page's wrapper. #pagewrap { padding: 5px; width: 960px; margin: 20px auto; } Roddy
  14. So, if I have understood properly, if one wishes to align content differently in different columns, the margin and padding spacing should be assigned to the column's content and not the column's wrapper. Is this correct? Roddy
  15. The following line of code does not make any sense: Response.Write( “before”+ recnum +") datamessage = ["+ datamessage +"] <br>" ); Write the desired outcome please, and then we can figure out how to obtain it. Roddy
  16. Alas, I finally have found a moment to respond. All notes for this entry are taken from the following document: Grammar Captive Template. Please be patient with me as we walk through the restructuring of my webpage one step at a time. I would like very much that we are always "on the same page" so-to-speak at every step of the way. I will experiment with each suggestion inside my development folder until I can make it work with the intended result, whereupon I will introduce it on the actual page in question -- namely, www.grammarcaptive.com/overview.html. I would like to begin by describing the general layout of the page before any media queries are made. As my webdesign consists of a header, footer, and three middle columns, it is somewhat complex. QUESTION ONE: When you speak of column containers are you referring to only the #content, #middle, and #sidebar div-elements, or are you referring to these in addition to the #header and #footer elements? I am assuming that the #pagewrap element will have no effect on what we are about to do. Roddy
  17. Or, if you use jQuery you can wrap your code in the $(document).ready() { ... }; function. In this way, the Javascript will not be run until the full document has been loaded. Roddy
  18. Alas, I was inadvertently clearing the window.localStorage property in a statement of a prior routine that illustrates the use of the window.localStorage.clear() function. Please go to the Grammar Captive mainpage and confirm or disconfirm whether return visitors are compelled to view the Grammar Captive splash panel. If no, click on Roddy's image to insure that the splash panel is still available to return visitors at their own request. Hopefully, visitors are compelled to view the splash panel only once, but are still able to view it as many times as they wish thereafter. Roddy
  19. Yes, the HTML was placed before the Javascript. Roddy
  20. BACKGROUND: I am baffled by the failure of this code to display "Return User" when the browser page is refreshed or the browser page is closed and then reopened. The vslue of the console.log(localStorage) displays: Storage { return_user: "true", length: 1 } CODE: const output = document.querySelector('.output'); if (typeof localStorage !== "undefined") { var localStorage = window.localStorage; if(localStorage.getItem("return_user")) { output.innerHTML = "Return User"; } else { output.innerHTML = "New User"; localStorage.setItem("return_user", true); console.log(localStorage); } } else { output.innerHTML = "Sorry, local storage is not supported."; } QUESTION: Any ideas? Roddy
  21. JSG: Actually there is still another function that is included in the countValueFrequency() function that converts the objects of the resulting array of the countOccurrence() function into arrays. I just needed to know whether this is an acceptable procedure, and it appears that it is. Thank you. Roddy
  22. ~Code&Anime~: I am not familiar with your syntax, and it is therefore difficult for me to comment on it, but it does appear to oversimplify the task. Please correct me, if I am wrong. The countOccurrence() function receives as input an array that appears as something akin to the following: Array [ "キャップチブ", "proposition", "Grammar Captive", "proposition", "文法", "Grammar Captive", "proposition", "Grammar Captive", "proposition", "文法" ] The elements of this array are the values of a property called target found in each of the objects of the initial inputArr of the external function named countValueFrequency(). The countOccurrence() function counts the number of times that each of these values occurs in newly formed array and returns the result in the following format. Array [ Object, Object, Object, Object ] for which each object is of the following form: count: 1 value: "キャップチブ" count: 4 value: 'proposition' etc. Although somewhat awkward, these resulting objects must then be converted into arrays, so that they can be fed into the wordcloud2.js script for the creation of a word cloud. Roddy
  23. BACKGROUND: I have created two functions of which the return value of one becomes the input value of the other. This other then returns a value that is the desire goal of the two functional procedures. So long as I run these functions separately, they produce the desired output. When I attempt to combine them, however, I inevitably fail. Please find below the successful procedure. I will not bother you with my unsuccessful attempts. INPUT ARRAY: var searchItems = [{category:'Search Podcast',count:'1',target:'キャップチブ'},{category:'Search Newsletter',count:'3',target:'proposition'},{category:'Search Podcast',count:'0',target:'Grammar Captive'},{category:'Search Podcast',count:'1',target:'proposition'},{category:'Search Podcast',count:'1',target:'文法'},{category:'Search Newsletter',count:'1',target:'Grammar Captive'},{category:'Search Podcast',count:'2',target:'proposition'},{category:'Search Podcast',count:'0',target:'Grammar Captive'},{category:'Search Podcast',count:'1',target:'proposition'},{category:'Search Podcast',count:'1',target:'文法'}]; The selectAndList( ) Function function selectAndList(propertyName, inputArr) { var propertyArr = []; inputArr.map(function(item) { propertyArr.push(item[propertyName]); }); return propertyArr; } The countOccurrence( ) Function function countOccurrence(inputArr) { var occurrenceArr = []; var copy = inputArr.slice(0); for (var i = 0; i < inputArr.length; i++) { var myCount = 0; for (var w = 0; w < copy.length; w++) { if (inputArr[i] == copy[w]) { myCount++; delete copy[w]; } } if (myCount > 0) { var a = new Object(); a.value = inputArr[i]; a.count = myCount; occurrenceArr.push(a); } } return occurrenceArr; }; Independent Calls Procedure: var selectedPropertyArr = selectAndList('target', searchItems); var occurrenceArr = countOccurrence(selectedPropertyArr); console.log(occurrenceArr); The result is an array with four objects each containing two properties (count and value) with their respective values. Indeed, it is the desired outcome. QUESTION: How to I combine the above two functions into a single function called countValueFrequency( ) with two arguments including propertyName and inputArr? OK. The following works, but is this the most efficient way of achieving the desired result? function countValueFrequency(propertyName, inputArr) { var propertyArr = []; inputArr.map(function(item) { propertyArr.push(item[propertyName]); }); function countOccurrence(inputArr) { var occurrenceArr = []; var copy = inputArr.slice(0); for (var i = 0; i < inputArr.length; i++) { var myCount = 0; for (var w = 0; w < copy.length; w++) { if (inputArr[i] == copy[w]) { myCount++; delete copy[w]; } } if (myCount > 0) { var a = new Object(); a.value = inputArr[i]; a.count = myCount; occurrenceArr.push(a); } } return occurrenceArr; }; return countOccurrence(propertyArr); } var newSelectedPropertyArr = countValueFrequency('target', searchItems); Roddy
×
×
  • Create New...