Yesterdayโs Javascript Array Prototype Method Tutorial allowed โฆ
- non-mobile platforms to successfully combine the (albeit quite disparate) aims of โฆ
- parent div contenteditable=true content editing element โฆ hosting โฆ
- clickable โaโ links that we want the โonclickโ logic of, adhered to
โฆ and, yes, for non-mobile this works โฆ whereas โฆ
- we started our working day testing the click of just such an โaโ link on an iPad with the Safari web browser and got a mobile keyboard appearing down the bottom โฆ
โฆ of the iPad screen, it tweaking with us five minutes later after playing around with the idea of changing โaโ links to โbuttonโ elements (after all, the button element is better than input type=button for the consistency of [divElement].innerText usage) and seeing the same behaviour
On the way of getting to the (quite counterintuitive) breakthrough links below โฆ
setting contenteditable=false within parent with contenteditable=true ... led us to ...
contenteditable=false inside contenteditable=true block is still editable in IE8
โฆ we tried a series of attempts to โget in beforeโ the โaโ or โbuttonโ โonclickโ event and modify as per โฆ
document.getElementById('workon').setAttribute('contenteditable', false); // turn off the div element editability
document.getElementById('workon').setAttribute('contenteditable', true); // turn (back) on the div element editability
โฆ but our lack of success makes us think, as we have read on occasions, that there is a problem cross-platform, regarding being able to dynamically make these editability adjustments. Weโve left some of those attempts in the code! Huh?! Yes, we add โ data-โ as a prefix to an event name in the HTML as per โฆ
<div onkeypress="nogo=false;" data-ontouchdown="this.setAttribute('contenteditable',true);" onblur="youreval((this.innerText || this.contentWindow || this.contentDocument).replace('vJUNKar ',''));" contenteditable=true data-rows=25 id=workon>var names = ['Blaire', 'Ash', 'Coco', 'Dean', 'Georgia']; // </div>
โฆ and Javascript โฆ
var asp='<a';
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
asp='<button';
}
newrelbit=newrelbit.replace(", ", asp + " contenteditable=true data-ontouchdown=\"document.getElementById('workon').setAttribute('contenteditable',false);\" class=asplice onfocus=spliceit(event,this,1); onclick=spliceit(event,this,0); data-namepos=" + bcount + " id=" + acount + " style='text-decoration:none;cursor:pointer;text-weight:bold;' title='Splice here'>,</" + asp.substring(1) + "> ");
function spliceit(evt,ao,isf) {
// Other code starts
// ...
// Other code ends
if (isf == 1 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
evt.preventDefault(); //evt.stopProgagation();
evt.stopProgagation();
}
}
โฆ examples, the โglobal data attributing kludgeโ helping us with revisits down the line should the browsers eventually allow the dynamism above, one day.
Yet again, you can try such scenarios with ourchanged inhouse HTML/CSS/Javascript client side array_workhtml live
run.
Previous relevant Javascript Array Prototype Method Tutorial is shown below.
Yesterdayโs Javascript Array Method Splice Tutorial involved โฆ
- one โpositional memberโ array method called โspliceโ and the Javascript prompt window is a quick way to code for such a scenario โฆ but โฆ
- once there are more than one bits of functionality (ours being seven (including a (titular) โprototypeโ method (to supplement โthe positionalโ splice, slice and copyWithin, as well as โthe overallโ sort, reverse and concat) whereby a user can code their own array โprototypeโ method, and have it be applied to an array object, dynamically), now) funnelling into the same coding place
โฆ it is tempting to think of a jQuery modal dialog box or another modal idea to funnel the new arrangements into. But we donโt often see the restrictiveness of a modal anything a big advantage, especially if it stops a user accessing other functionality on the webpage theyโre maybe disadvantaged from reaching because of this modality. No, we have room above our table element for another table element nestled within an HTML div element โฆ
<div id=commaform></div>
โฆ that can disappear when not needed (for a while, again) via the simple โฆ
document.getElementById('commaform').innerHTML='';
โฆ Javascript DOM codeline. The end result feels like a form, but in reality we donโt navigate anywhere so settle for <input type=button onclick=commawork(this); value=[ArrayMethodVerb]></input> means to functionalmethodological ends.
The result of this extra functionality was that our webpage โabove the foldโ feel can be lost to a need for vertical scrolling, not the best user experience, but can be mollified somewhat via โฆ
- hashtag (#) navigation logic โฆ helped out by โฆ
- details (and summary) element reveal functionalities to protect that prime โabove the foldโ real estate (via its โscrunchingโ capabilities)
- horizontal rule (<hr>) clarity
- title attribute clarity allowing an onmouseover event show the command that led to the hovered over result
Again, you can try such scenarios with ourchanged inhouse HTML/CSS/Javascript client side array_workhtml live
run link available for an online play, also, below โฆ
Previous relevant Javascript Array Method Splice Tutorial is shown below.
Up to yesterdayโs Javascript Array Method Stack and Queue Tutorialโs progress with Javascript (client side) array methods weโd been concentrating on โฆ
- the โends of arrayโ push and pop and shift and unshift โฆ but we are here to share the information that โฆ
- splice Javascript array method can manipulate data within the array, both to โฆ
- add array members at a position โฆ and/or โฆ
- delete array members at a position
We felt compelled to start down the road of allowing for array data that is โฆ
- totally numerical (at any one point) โฆ and so โฆ
- allow the use to have data that recognizes numerical data for what it is (ie. not necessarily needing string โ nor โ delimitation)
โฆ for those intrepid users who have figured out that HTML div contenteditable=true is so much fun, and a modification your โspreadsheet houndsโ out there will be all too familiar with. In our defence of how complicated this got, is that delimitation you could โhang your hat onโ (ie. everything โ or โ delimited) is lost, (and weโre doomed), and so code becomes far more problematic for our new array โspliceโ work โฆ
- in the way above โฆ and โฆ
- regarding the possibility a user will enter (even) character data containing a comma (the scenario for which we can have the HTML Entity , come to our rescue)
โฆ preparatory to us trying to turn the apt commas into โaโ link elements that when clicked use a Javascript prompt popup window to ask the user for their array โsplicingโ requirements.
You can try such scenarios with ourchanged inhouse HTML/CSS/Javascipt client side array_workhtml live
run link available for an online play, also, below โฆ
Previous relevant Javascript Array Method Stack and Queue Tutorial is shown below.
The arrays involved in yesterdayโs Javascript Array Method Solar System Planets Game Tutorial can represent โorderโ where once there was none. And in inventory control, how you organize inventory pricing can use arrays in a โฆ
- FIFO way โฆ like a queue โฆ First In, First Out
- LIFO way โฆ like a stack โฆ Last In, First Out
โฆ and we demonstrate some such scenarios with ourchanged inhouse HTML/CSS/Javascipt client side array_workhtml live
run link you can try, also, below, as โฆ
Number Queue scenario (where Ticket Number creation uses push and Ticket Service uses shift) โฆ |
---|
Card Stack scenario (where Card shuffling uses unshift and Card dealing uses shift) โฆ |
โฆ hopefully to get your โimagination juicesโ flowing!
Previous relevant Javascript Array Method Solar System Planets Game Tutorial is shown below.
You learn something, then you apply it in a game. Sounds good, huh?
There is nothing like applying your knowledge close to when you learn it, for that information to take hold. And for it to be instinctual, perhaps a game where โฆ
- Number of goes โฆ and โฆ
- Number of seconds elapsed
โฆ can help cement that knowledge in your brain. We think so. And so we have a โSolar System Planets Gameโ part to our web application of yesterdayโs Javascript Array Method Primer Tutorial for you to try, optionally that is.
The game goes โฆ
- you are presented with an initial โWork onโ names array such as โฆ
โฆ
var names = ["Neptune", "Venus", "Uranus"]; - and you use your skills with โฆ
โฆ
- to turn that into a
sowโs earnames array that look like โฆ
โฆ
names = ["Mercury", "Venus", "Earth","Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"]; - to assess your โGoes / Timeโ score against previous attempts if that is how you roll?!
Ourchanged inhouse HTML/CSS/Javascipt client side array_workhtml Solar Systems Planet Game link you can try, also, below โฆ
Previous relevant Javascript Array Method Primer Tutorial is shown below.
If you are interested in writing your own web applications, on the โclientโ side of the work, there are three major categories of skills, those being โฆ
- HTML (design)
- CSS (style)
- Javascript (workings)
โฆ and a subcategory of โJavascript (workings)โ skills would definitely be โฆ
- the use of arrays โฆ and โฆ
- array โmethodsโ
โฆ โmethodsโ being an object oriented idea of โactions applied to objectsโ (that is that slightly bit of a different result to โfunctionsโ overseeing and changing web application โworkingsโ ignoring โobjectsโ as such). Maybe think of โmethodsโ as an โadjectival wayโ to change a โnounโ whereas โfunctionsโ are like โverbsโ acting on the โwebpage contentโ.
In this context, we stumbled upon a great link called JavaScript Array Push, Pop, Shift and Unshift Methods with Examples that inspired me to construct a proof of concept web application to help a user who likes โhands onโ approaches to learning, learn about array (object) โmethodsโ โฆ
โฆ in our inhouse HTML/CSS/Javascipt client side array_workhtml live
run link you can try, also, below โฆ
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.