Chrome Devtools, copying over a set of answers - google-chrome

I have to do this repeatedly, so I was wondering if there was a working around....
here is a set of amenities for an apartment, they have to be transferred to a larger list containing those amenities by clicking off multiple choice cirlces. Is there away to edit the script to do it all at once>
example
accessible
air conditioning
dishwasher
garage
hardwood floors
parking
patio / balcony
gym
in unit laundry
cats allowed
dogs allowed
pet friendly
basketball court
bathtub
bbq/grill
bike storage
business center
carpet
ceiling fan
clubhouse
game room
granite counters
microwave
oven
package receiving
playground
pool table
range
refrigerator
stainless steel
walk in closets

I think you want to just checkmark all of the checkboxes on the amenities list so something like this will work:
$('div.whitelist-searchable-amenity input[type=checkbox]').each(function(){
$(this).prop('checked', true);
});
https://jsfiddle.net/r62qgou3/
Edit:
I am not sure of what you mean by "copying text to script" but I modified the script to check if the values that you are looking for are within the document. This should search the values of the checkboxes and then you can use your own script to "copy" the value elsewhere. Just add more values to the array if you need more keywords.
x = [
"accessible",
"air conditioning",
"dishwasher",
"garage",
];
$('div.whitelist-searchable-amenity input[type=checkbox]').each(function(){
if(x.indexOf(this.value) > -1)
{
alert("copy here");
}
});

Related

Google rejecting Facebooks json-ld required tags

I am setting up JSON+LD tags on my product pages for Facebooks "Dynamic Ads & Commerce".
https://developers.facebook.com/docs/marketing-api/catalog/reference/
Two tags it states are required:
id
Required for dynamic ads and commerce.
availability
Required for dynamic ads and commerce.
I've added these, but it causes Google to reject my json+ld markup.
Invalid enum value in field 'availability'
1.
2.
How could I please both parties here? If I am adding json+ld markup, it may as well have all required elements to be valid on Google and Facebook (Catalog).
[
{
"#context":"http:\/\/www.schema.org",
"#type":"Product",
"name":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"title":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"link":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"image":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"image_link":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"description":"The Silentnight Toddler Duvet and Pillow set makes a great first bed set for your little one. The cot bed sized set includes a snuggly duvet and a soft pillow that is specially designed for children. The slim profile of the pillow offers your child just the right amount of support they need. It's important that small children don't overheat in bed, so the light and soft duvet comes in a 4.5 tog weight rating. Both the pillow and duvet are made from a smooth polycotton cover offering breathable comfort. The products are filled with anti-allergy hollowfibre that actively defends against the bacteria and dust mites that can cause allergies providing a cleaner, fresher and altogether a safer option for a good night's sleep. Our anti-allergy fibres are approved by the British Allergy Foundation, which means they have the ultimate seal of approval. Our fibres have been scientifically tested and are proven to reduce or remove allergens from the indoor environment.\nSuitable only for children over 12 months. Both the pillow and duvet are fully machine washable, and thanks to the easy care polycotton covers, the products have great recovery and can be washed time and time again.",
"sku":"506984LS",
"id":17214,
"productID":17214,
"offers":[
{
"#type":"Offer",
"price":"30.99",
"priceCurrency":"GBP",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"gtin":"5012701506984",
"gtin8":"5012701506984",
"condition":"new",
"availability":"in stock",
"inventoryLevel":54
}
],
"brand":"Silentnight"
}
]

space is not showing in html

I don't know whether it is a basic question, but I need to ask.
Here is my problem. when a wrote a simple HTML code for showing a paragraph,
but its not getting in the correct format that i wish.
I am adding code below.
<p>
Eosinophil count - absolute
An absolute eosinophil count is a blood test that measures the number of white blood cells called eosinophils.
Eosinophils become active when you have certain allergic diseases, infections, and other medical conditions.
How the Test is Performed
Most of the time blood is drawn from a vein on the inside of the elbow or the back of the hand. The site is cleaned with an antiseptic.
The health care provider wraps an elastic band around your upper arm to make the vein swell with blood.
Next, the provider gently inserts a needle into the vein. The blood collects into an airtight tube attached to the needle.
The elastic band is removed from your arm. The needle is then removed and the site is covered to stop bleeding.
Things to Know
In infants or young children, a sharp tool called a lancet may be used to prick the skin.
The blood collects in a small glass tube, or onto a slide or test strip. A bandage is put on the spot to stop bleeding.
Reference Range
The serum reference ranges of eosinophils are as follows:
Eosinophils blood (%): 0.0-6.0 (This range may vary slightly in different laboratories.)
Eosinophil blood count (absolute): 30-350. The percentage of eosinophils is multiplied by the white blood cell count to
give the absolute eosinophil count. This range may vary slightly in different laboratories.
ANTIGEN SUSPENSION SERUM DILUTION
. 1:30 1:60 1:120 1:240
--------------------------------------------------------------------------------
Salmonella Typhi "O" : -- -- -- --
Salmonella Typhi "H" : -- -- -- --
Salmonella Para Typhi "AH" : -- -- -- --
Salmonella Para Typhi "BH" : -- -- -- --
</p>
But in output all the spaces are truncated.
How to get the exact text as output?
Check white-space: pre; property in css here
p {
white-space: pre;
}
<p>
Eosinophil count - absolute
An absolute eosinophil count is a blood test that measures the number of white blood cells called eosinophils.
Eosinophils become active when you have certain allergic diseases, infections, and other medical conditions.
How the Test is Performed
Most of the time blood is drawn from a vein on the inside of the elbow or the back of the hand. The site is cleaned with an antiseptic.
The health care provider wraps an elastic band around your upper arm to make the vein swell with blood.
Next, the provider gently inserts a needle into the vein. The blood collects into an airtight tube attached to the needle.
The elastic band is removed from your arm. The needle is then removed and the site is covered to stop bleeding.
Things to Know
In infants or young children, a sharp tool called a lancet may be used to prick the skin.
The blood collects in a small glass tube, or onto a slide or test strip. A bandage is put on the spot to stop bleeding.
Reference Range
The serum reference ranges of eosinophils are as follows:
Eosinophils blood (%): 0.0-6.0 (This range may vary slightly in different laboratories.)
Eosinophil blood count (absolute): 30-350. The percentage of eosinophils is multiplied by the white blood cell count to
give the absolute eosinophil count. This range may vary slightly in different laboratories.
ANTIGEN SUSPENSION SERUM DILUTION
. 1:30 1:60 1:120 1:240
--------------------------------------------------------------------------------
Salmonella Typhi "O" : -- -- -- --
Salmonella Typhi "H" : -- -- -- --
Salmonella Para Typhi "AH" : -- -- -- --
Salmonella Para Typhi "BH" : -- -- -- --
</p>
use &nbsp for space in HTML
In HTML, multiple spaces are automatically replaced by only one space except if your text is surrounded with <pre> tag.
If you want your spaces in another type of tag (e.g. <p>) you need to use HTML entities. The HTML entity for a normal space is and for a tab character it's &tab;. There's a lot of HTML entities like those. Here is a good reference to find the HTML entities you need: HTML entities reference chart

What's stopping these variable's from being defined in my code?

I've been designing this game, and Ive come across a weird problem. Now maybe it's just something simple I've missed or some way I formatted it. When I run my code I get these errors that suggest that none of the variables I've been defining are being declared/defined. On top of that none of the functions seem to run... Should I define text1, button1Name, etc... as Global variable? or is their a better way?
##Project 1 v4
##Structure whole program with base functionality
##Begin with an outline then fill in functions and windows from V2, and V3.
import Tkinter
import random
inventory=[]
playCount=0
def startGame():
##adds name
##button that calls StoryCard
text1="Welcome to Treasure Quest!! The Game that allows you to pick your own destiny! Treasure quest is a very simple game. The story will display on the screen until it reaches an event. At each event you will be shown two choices. Each decision may cause you to leave with more treasure or to die a horrible death... Still like any true or false question on a final exam, you only have a 50/50 chance of ruining your entire life if you do not know! Now that you know how to play, please click the button below to start the game!"
button1= introCard()
button1Name="Play"
button2= win.destroy
button2Name="Quit"
def introCard():
text1="You are the bravest knight in the service of the great kingdom Universitas! The kingdom has long been an icon throughout the world, but now it faces great peril. The king of Universitas has foolishly spent the entirety of the kingdoms fortune shopping online. The only hope for the kingdom, is to find the money to pay off it's debts. Luckily recently some scrolls have been found that describe the locations of hidden treasures. You have been selected to find these treasures. Do you except?"
button1=winCard()
outcome1="You embark upon your quest!"
button1Name="Accept!"
button2=lossCard()
outcome2="The kingdom falls into debt and you die of dysentary... Nice going Oregon Trail..."
button2Name="Decline!"
def storyCard(n):##This function will randomly select a story chunk
##recieves a random int
##tests for true int w/ if then else line
##Story blurbs for these are stored in V2 copy them!
if n ==1:
text1="You come across a dark cave... A dragon is said to lurk within... You enter and see the Holy Sword... How do you take it?"
button1=lossCard()
outcome1="The dragon bakes you to a crisp... Sorry!"
button1Name="Bargain for it!"
button2=winCard()
outcome2="Victory! You sneak past the dragon and make off with the sword!"
button2Name="Steal it!"
#get="Holy Sword"
elif n==2:
text1="You come across a mummys tomb... You see two doors. Take the front entrance or the hidden entrance?"
button1=winCard()
outcome1="The mummy is awake and glad for company! He feeds you tea and sets you on your way with gifts!"
button1Name="Front"
#get="A beautiful glass vase!"
button2=lossCard()
outcome2="The mummy sees you! It screams thief! and shivs you..."
button2Name="Hidden"
elif n==3:
text1="You come across a magic tree inhabited by elves. They ask you to climb up and see their beautiful home."
button1=lossCard()
outcome1="You climb high but slip off a branch and fall to your death. The elves laugh."
button1Name="Climb"
button2=winCard()
outcome2="The elves are perplexed as to why you do not want to see them. They come down and give you a new couch to show off their things."
button2Name="Stay"
#get="A rad couch"
elif n==4:
text1="You come across a cave filled with strange lights! A troll stands guard."
button1=winCard()
outcome1="This is a hip and happening new dwarven nightclub! The troll lets you in because you seem cool! The dwarves give you some rare cave mushrooms. It seems lame but they said the kings a regular and they will go over well. You have a fun night... You drink to much ale and get a late start the next morning though..."
button1Name="Strut in!"
#get="Rare Mushrooms"
button2=winCard()
outcome2="This is actually a hip new dwarven nightclub! The bouncer troll won't let you in though... Oh well! dwarves are hipsters anyways! Gratefull for your company the troll gives you an amulet!"
button2Name="Wait in line."
#get="Sweet Amulet"
elif n==5:
text1="You come across a hut in the woods! Its owned by Merlin! The great wizard starts up conversation and invites you inside!"
button1=lossCard()
outcome1="Insulted, Merlin kills you with an axe... you would have expected magic... but no, Merlin is a psychopath and prefers to murder with axes."
button1Name="Leave"
button2=winCard()
outcome2="He talks about his GOD DAMNED GRANDKIDS FOR FOUR HOURS... He is grateful for you company however and lets you leave with his staff."
button2Name="Enter"
#get="A sweet Staff"
## each if, elif, ect must contain
##Text blurb
##Button 1 function def
##Button 2 function def
##button 1 name
##button 2 name
##Outcome 1 Text
##Outcome 2 Text
def winGame():
text1="CONGRATULATIONS!! You have collected enough treasure to pay off the kingdoms debts! You will forever be known to the people as a great knight! The king is in your debt!"
button1Name="Hooray!"
button1=win.destroy
button2Name="Huzzah!"
button2=win.destroy
def winCard():##Describes how event played out
#inventory.append[get]
playCount+=1
text1= outcome1 or outcome2
if playCount == 5:
button1Name="Onward!"
button1=winGame()
button2Name="Go Forth!"
button2=winGame()
else:
button1Name="Onward!"
button1=storyCard(random.randint(1,5))
button2Name="Go Forth!"
button2=storyCard(random.randint(1,5))
def lossCard():
text1=outcome1 or outcome2
button1Name="Game Over"
button1= win.destroy
button2Name="Game Over"
button2= win.destroy
startGame()
win=Tkinter.Tk()
win.title("TREASURE QUEST!!")
Textlabel=Tkinter.Label(win,text = text1,font=('Times New Roman',12),justify=LEFT,)
Textlabel.pack()
Row2=Tkinter.Frame(win)
Btn1=Tkinter.Button\
(Row2, text=button1Name, command=button1,font=('Times New Roman',12))
Btn2=Tkinter.Button\
(Row2, text=button2Name, command=button2, font=('Times New Roman',12))
Btn1.pack(side='left')
Btn2.pack(side='left')
Row2.pack()
win.mainloop()
When I run the code I get these errors:
Traceback (most recent call last):
File "C:/Users/Logan/Desktop/Project#1V4.py", line 141, in <module>
startGame()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 17, in startGame
button1= introCard()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 26, in introCard
button1=winCard()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 116, in winCard
playCount+=1
UnboundLocalError: local variable 'playCount' referenced before assignment
If you want to change a global variable in a function, you need to use the keyword global as follows -
def winCard():##Describes how event played out
global playCount
#inventory.append[get]
playCount+=1

how to display data in html

In my project, I am retrieving an address from the database and displaying this address on page. The issue or problem that I am facing is the the way the retrieved address is being displayed.
Basically this is the way the address is being displayed:
Address: 1 Kings Street Kilmarnock East Berkshire Scotland KA1 UIT
I would like the address to be displayed like so:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
How can I do this in HTML or css? I am currently using twitter bootstrap , and I don't if there is anyway to do using it.
Oh.. It's hard but let me try... ;)
<div>Address: 1 Kings Street<br> Kilmarnock <br>East Berkshire<br> Scotland <br>KA1 UIT</div>
Your Expected Output:
Address: 1 Kings Street
Kilmarnock
East Berkshire
Scotland
KA1 UIT
Working Demo
Note: This is just simplest and basic way.. But if Data is coming from any database dynamically then at-least you should explain in details from where it comes and by which object it can be accessible.. Then you can apply JS or regex functions... I hope you understand what I mean..
If you edited the data in your database, and used a comma between each line, you might be able to split the data. (your question doesn't state what language you are writing in (mvc/how data is being received).
However, once you have the string, you can use the String.split method (available in most languages), and hence could adapt your view accordingly.
So,
Address: 1 Kings Street, Kilmarnock, East Berkshire, Scotland, KA1 UIT
would become
{1 Kings Street}{ Kilmarnock}{ East Berkshire}{ Scotland}{ KA1 UIT}
which you could then do a foreach block, displaying them onto the screen as you requested
A possible alternative (although probably not easy), would be to extract the postcode, and call a google maps API call to receive the address - but again, this would be quite difficult.
At present, I cannot see how you would be able to expect a program to decide where to split the address into separate lines (unless you place them into different fields which was described in the comments).
You can add <p> to each line, or put <br> at the end of each lines.
But
If your retrieving the data from a database through a php variable you cannot do that with pure html / css, you'll need string manipulation with PHP.

How to display two or more markers on the same location?

I have a question about the GOOGLE MAP API. If you have more than two data that share similar address, how do you show the Pins Drop on the same address?
Example
You have data such as the following:
Name=>Ray | Address=>Melon Park, California, USA ;
Name=>John | Address=>Melon Park, California, USA ;
Name=>Steve | Address=>Melon Park, California, USA
You want to display 3 Pins Drop for the similar address on Google Map.
The post linked above has some good advice. Your options are really:
Offset the markers slightly, so instead of displaying them all on the same they are all on really close to each other. Just add add or subtract small delta to each of them.
Use different icons for each location. If you know the maximum number of markers that could overlap (like 4?) at the same location, you could make your own rotated icons, so instead of pointing "down" in the typical teardrop shape they could point left, right, or up.
Handle the data overlap in your infowindow / UI.
Adding small delta will work like this (this script is written in PHP):
$random_num_lat = .00065 * mt_rand(1, 10); // delta to the lat value added
$random_num_lng = .00065 * mt_rand(1, 10); // delta to the lon value added
$lat=$row['lat']+$random_num_lat;
$lon=$row['lon']+$random_num_lng;
//now in loop it will be three `enter code here`marker display seperate to each other
while ($row = mysql_fetch_array($query)) {
echo ("addMarker($lat, $lon,'<b>$name</b><br/>$desc1');\n");
}
I achieved this using a "spiderfier" to "spiderfy".
There is a GoogleMaps v3 Spidifier available here (demo).
Leaflet.js can also load GoogleMaps v3 and has a beautiful clustering spidifier available here (demo).
Note: Following is a more of hack than a solution:
Write an algorithm that checks for repeated coordinates in array.
When a duplicate is found, add a small value such as 0.000001 to the found coordinates.
Note that the smaller the value the more you have zoom in to see the difference.