Deleting a named div

2017-10-28 Thread jgill
I can do this in BBEdit and I can do it easily with Applescript, because it 
can search backwards for (?s).*? - but how 
can I search backwards with JavaScript? I want to be able to delete the 
last instance of this div on a web page.

Also, can I run JavaScript from within BBEdit on the front window instead 
of AppleScript?

TIA

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-28 Thread Jan Erik Moström

On 28 Oct 2017, at 18:07, jgill wrote:

Also, can I run JavaScript from within BBEdit on the front window 
instead of AppleScript?


Isn't it possible to use JS as an alternative to AS (system wide)? I 
mean I can select AS or JS in the script editor.


= jem

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-29 Thread Greg Raven
First, "class='day_report'" isn't a named div. Second, if you are 
validating to HTML5, you would use ID instead of NAME. Third, using either 
ID or NAME, there should be only one of them on the page.

Per Jan Erik's post, you don't say if you are trying to do this locally on 
files on your hard drive or remotely on files on the server. If you are 
trying to delete on the server after the page is built (!), not being a 
JavaScript guru I would either use jQuery to set the contents of the div to 
nothing, or add a scrap of CSS to kill the display of that div.

On Saturday, October 28, 2017 at 9:07:49 AM UTC-7, jgill wrote:
>
> I can do this in BBEdit and I can do it easily with Applescript, because 
> it can search backwards for (?s).*? - but how 
> can I search backwards with JavaScript? I want to be able to delete the 
> last instance of this div on a web page.
>
> Also, can I run JavaScript from within BBEdit on the front window instead 
> of AppleScript?
>
> TIA
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-29 Thread jgill
On Sunday, October 29, 2017 at 12:09:11 PM UTC, Greg Raven wrote:
>
> First, "class='day_report'" isn't a named div. Second, if you are 
> validating to HTML5, you would use ID instead of NAME. Third, using either 
> ID or NAME, there should be only one of them on the page.
>

But, it's a class not an ID, there are 30 of them on the page and I want to 
search and replace the last instance with ''.

I have worked out how to count the similar div classes on the page, go back 
to the top and count down  and then do a search and replace, but 
this seems clumsy.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-29 Thread Greg Raven
OK. Your "subject" stated that you were trying to delete a named ID, so I 
took you at your word.

On Sunday, October 29, 2017 at 5:34:26 AM UTC-7, jgill wrote:
>
> On Sunday, October 29, 2017 at 12:09:11 PM UTC, Greg Raven wrote:
>>
>> First, "class='day_report'" isn't a named div. Second, if you are 
>> validating to HTML5, you would use ID instead of NAME. Third, using either 
>> ID or NAME, there should be only one of them on the page.
>>
>
> But, it's a class not an ID, there are 30 of them on the page and I want 
> to search and replace the last instance with ''.
>
> I have worked out how to count the similar div classes on the page, go 
> back to the top and count down  and then do a search and replace, 
> but this seems clumsy.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-29 Thread Kerri Hicks
Do you truly need to *delete* it, or do you just want to make it
unavailable to the screen/screen reader?

If the latter, you could use the :last-child pseudo class in CSS, and set
it to display : none.

https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child

--Kerri

On Oct 28, 2017 12:07 PM, "jgill"  wrote:

> I can do this in BBEdit and I can do it easily with Applescript, because
> it can search backwards for (?s).*? - but how
> can I search backwards with JavaScript? I want to be able to delete the
> last instance of this div on a web page.
>
> Also, can I run JavaScript from within BBEdit on the front window instead
> of AppleScript?
>
> TIA
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-30 Thread Dave
divs = document.querySelectorAll();
lastDiv = divs.item(divs.length -1);

I have worked out how to count the similar div classes on the page, go back 
> to the top and count down  and then do a search and replace, but 
> this seems clumsy.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Deleting a named div

2017-10-30 Thread Dave
divs = document.querySelectorAll(".day_report");
lastDiv = divs.item(divs.length -1);


On Sunday, October 29, 2017 at 8:34:26 AM UTC-4, jgill wrote:
>
> I have worked out how to count the similar div classes on the page, go 
> back to the top and count down  and then do a search and replace, 
> but this seems clumsy.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.