Theming D7 Nice Menus Subchildren by Taxonomy Term - menu

I have been pondering on how to modify the default output of Nice Menus' list elements and make each <li> group a list of nodes by taxonomy term. This is the default output of a sub-menu:
<ul>
<li>Test 1</li>
<li>Test 2</li>
<li>Parent
<ul>
<li>Sub 1</li>
<li>Sub 2</li>
<li>Sub 3</li>
<li>Sub 4</li>
<li>Sub 5</li>
<li>Sub 6</li>
</ul>
</li>
<li>Test 3</li>
</ul>
My goal is to group sub-children based on a taxonomy term such as:
<ul>
<li>Test 1</li>
<li>Test 2</li>
<li>Parent
<ul>
<li>
<h3>Term 1</h3>
Sub 1
Sub 2
Sub 3
</li>
<li>
<h3>Term 2</h3>
Sub 4
Sub 5
Sub 6
</li>
</ul>
</li>
<li>Test 3</li>
</ul>
How can I customize this on template.php?

there's some nice hook code in here which allow you to alter menu links and menu tree

Related

beautiful soup td class name is same and I need to get the value from 1st to 4th value by text

I want to study crawling with selenium and beautiful soup.
I did successfully accessing the website and logged in.
And I tried to get some value by text but it doesn't work.
This is the code that I made.
all3=soup.find("td",{"class": " text-right txt-r"}).text
print(all3)
all4=soup.find("td",{"class": " text-right txt-r"}).text
print(all4)
This is the website coding as follows. I want to get the value from 1st to 4th values by text. However, td class name is same, so I don't know how to get parsing the date with soup.
<td class=" text-right txt-r">7,730</td>
<td class=" text-right txt-r">33,500</td>
<td class=" text-right txt-r">72.8</td>
<td class=" text-right txt-r">88</td>
<td class=" text-right txt-r">0.72%</td>
<td class=" text-right txt-r">0.22%</td>
<td class=" text-center txt-c">높음</td>
<td class=" text-right txt-r">15</td>
I want to make the result as follows.
Print(all3)
Print(all4)
Print(all5)
Print(all6)
7,730, 33,500, 72.8, 88

BeautifulSoup get element inside list except one

I want to get all link value inside a list except one of them.
This is my list:
<ul>
<li>
<a class="link" href="consept link 1">
<svg class="consept" preserveAspectRatio="xMinYMin meet" viewBox="0 0 22 22"><use xlink:href="link"></use></svg>
<h2>Consept title 1</h2>
</a></li>
<li>
<a class="link" href="consept link 2">
<svg class="consept" preserveAspectRatio="xMinYMin meet" viewBox="0 0 22 22"><use xlink:href="link"></use></svg>
<h2>Consept title 2</h2>
</a></li>
<li>
<a class="link" href="consept link 3">
<svg class="consept" preserveAspectRatio="xMinYMin meet" viewBox="0 0 22 22"><use xlink:href="link"></use></svg>
<h2>Consept title 3</h2>
</a></li>
<li>
<a class="link" href="video link">
<svg class="video" preserveAspectRatio="xMinYMin meet" viewBox="0 0 22 22"><use xlink:href="link"></use></svg>
<h2>video title</h2>
</a></li>
</ul>
I want to get link address of parent <svg class="consept"> I mean the a tag but not svg with class video.
expected result:
consept link 1
consept link 2
consept link 3
This worked thanks to a friend.
def _get_all_links(self):
consepts = self.section_bs4.select('consept')
for video_index, post in enumerate(consepts):
consept_url = post.find_parent('a')['href']

Is there a way to apply clip-path to a div without CSS?

I'm trying to clip a div with svg clip-path, because css rule clip-path: url(#foo) have poor support. So I thought may be i can attach svg clip-path to a div with html attribute clip-path="#foo". Like in the example here - link. But it doesn't work.
This is my svg element and div.
<svg class="svg-graphic">
<defs>
<clippath id="hexagonal-mask">
<polygon points="130,0 0,160 0,485 270,645 560,485 560,160" />
</clippath>
</defs>
<div class="element" clip-path="#hexagonal-mask">
<div class="content">
<h2>How it works</h2>
<p>
Download<span class="icon"></span>
</p>
<p>
Watch video and Play games<span class="icon"></span>
</p>
<p>
Choose your <span class="icon"></span>
</p>
</div>
</div>
</svg>
When i open an element inspector, i see that my div somehow appears outside of the svg element.
http://prntscr.com/ay7kxt
And clip-path doesn't apply.
Am i doing something wrong or is this aproach just doesnt work with divs, only with shapes like , ?

Make correct layout for TextView and ImageView

What Layouts need use for make this?
HTML
<h1>Title</h1>
<div id="itemWrapper">
<div class="item">
<div class="png">
<img src="xxx.png">
</div>
<div class="text">
text text text text text text text text text text
</div>
</div>
<div class="item">
<div class="png">
<img src="xxx.png">
</div>
<div class="text">
text text text text text text text text text text
</div>
</div>
<div class="item">
<div class="png">
<img src="xxx.png">
</div>
<div class="text">
text text text text text text text text text text
</div>
</div>
<div class="item">
<div class="png">
<img src="xxx.png">
</div>
<div class="text">
text text text text text text text text text text
</div>
</div>
</div>
CSS
.item{clear:both;}
.item .png{float:left;height:50px}
.item .text{float:left;height:50px}
h1{text-align:center}

How to click random links one by one inside a table

I am automating a site in which I want to click on the links inside a table.
In UI, the table showing like this:
Action Contract Line Item Number Product Product Code
Edit | Del CLI-757042 OpenTable System (Guest Center) SYS010
Edit | Del CLI-757043 Guests Seated from Online GC
I want to click the links CLI-757042,CLI-757043,CLI-757044 one by one. The numbers are random.
Below is the html code:
<!-- WrappingClass -->
<div class="listRelatedObject customnotabBlock"><div class="bPageBlock brandSecondaryBrd secondaryPalette"><div class="pbHeader"> … </div><div id="800f00000006cQt_00Na000000ASdVK_body" class="pbBody"><table class="list" cellspacing="0" cellpadding="0" border="0"><tbody><tr class="headerRow"> … </tr>
<!-- ListRow -->
<tr class="dataRow even first" onmouseover="if (window.hiOn){hiOn(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}"><td class="actionColumn"> … </td><th class=" dataCell " scope="row"><a href="/a1if0000000ZfEv">
CLI-757042
</a></th><td class=" dataCell "> … </td><td class=" dataCell "> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell "> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell numericalColumn"> … </td><td class=" dataCell numericalColumn"> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell "> … </td></tr>
<!-- ListRow -->
<tr class="dataRow odd" onmouseover="if (window.hiOn){hiOn(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}"><td class="actionColumn"> … </td><th class=" dataCell " scope="row"> … </th><td class=" dataCell "> … </td><td class=" dataCell "> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell "> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell numericalColumn"> … </td><td class=" dataCell numericalColumn"> … </td><td class=" dataCell CurrencyElement"> … </td><td class=" dataCell "> … </td></tr>
<!-- ListRow -->
<tr class="dataRow even" onmouseover="if (window.hiOn){hiOn(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}"> … </tr>
<!-- ListRow -->
<tr class="dataRow odd" onmouseover="if (window.hiOn){hiOn(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}"> … </tr>
<!-- ListRow -->
<tr class="dataRow even last" onmouseover="if (window.hiOn){hiOn(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}"> … </tr></tbody></table><div class="pShowMore"> … </div></div><div class="pbFooter secondaryPalette"> … </div></div></div><div class="listElementBottomNav"></div><script> … </script>
<!-- End ListElement -->
</div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_00Na000000ASdVM" class="bRelatedList"><a name="800f00000006cQt_00Na000000ASdVM_target"></a>
<!-- Begin ListElement -->
<!-- motif: Contract -->
<!-- WrappingClass -->
<div class="listRelatedObject Custom18Block"><div class="bPageBlock brandSecondaryBrd secondaryPalette"><div class="pbHeader"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td class="pbTitle"><img class="minWidth" width="1" height="1" title="" alt="" src="/s.gif"></img><img class="relatedListIcon" title="Order" alt="Order" src="/s.gif"></img><h3 id="800f00000006cQt_00Na000000ASdVM_title"> … </h3></td><td class="pbButton"> … </td><td class="pbHelp"> … </td></tr></tbody></table></div><div id="800f00000006cQt_00Na000000ASdVM_body" class="pbBody"> … </div><div class="pbFooter secondaryPalette"> … </div></div></div><div class="listElementBottomNav"></div><script> … </script>
<!-- End ListElement -->
</div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_00Na000000ASdVR" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_RelatedActivityList" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_RelatedHistoryList" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_00Na000000AT3VB" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_RelatedNoteList" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_00N3000000A6gu9" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<!-- Begin RelatedListElement -->
<div id="800f00000006cQt_RelatedEntityHistoryList" class="bRelatedList"> … </div>
<!-- End RelatedListElement -->
<div class="fewerMore"> … </div><script> … </script>
<!-- Body events -->
<script type="text/javascript"> … </script><div id="datePicker" class="datePicker"> … </div>
<!-- End page content -->
</td></tr></tbody></table></div><div class="bPageFooter noTableFooter"> … </div><div></div></div><script> … </script><script src="/jslibrary/1402506602000/sfdc/ChatterDefer.js" defer="true"></script><script src="/jslibrary/1404472812000/sfdc/Zen.js" defer="true"></script><script> … </script><script async="" defer="" src="/jslibrary/1400606638000/sfdc/SfdcSessionBase190.js"></script><iframe title="sessionserver" style="position: absolute; top: -999px; left: -999px;" src="https://test.salesforce.com/login/sessionserver190.html"></iframe><div id="devSlide" style="display: block;"> … </div><div id="InlineEditDialog" class="overlayDialog cssDialog inlineEditDialog" role="dialog" aria-live="assertive" aria-describedby="InlineEditDialogTitle" style="margin-top: 0px; margin-left: 0px;"> … </div>
When I inspect element in the 1st link it shows table with class=datacell. But there are 2-3 more tables in the page with same class name.
You can use the links method to collect the links and then iterate through the link collection.
Here's a contrived table as an example:
<table class="foo"><tr>
<td>one</td>
<td>two</td>
</tr></table>
<table class="foo"><tr>
<td>three</td>
<td>four</td>
</tr></table>
<table class="bar"><tr>
<td>five</td>
<td>six</td>
</tr></table>
You can collect all the links on the page or target a specific table based on its class attribute or index position.
# print the text attribute for all links
b.links.each { |link| puts link.text}
#=> one
#=> two
#=> three
#=> four
#=> five
#=> six
# print the text attribute for links in the table with a class attribute of "foo"
b.table(:class => "foo").links.each { |link| puts link.text}
#=> one
#=> two
# print the text attribute for links in the table with a index position of 1
b.table(:index => 1).links.each { |link| puts link.text}
#=> three
#=> four
# print the text attribute for links in the table with a class attribute of "bar"
b.table(:class => "bar").links.each { |link| puts link.text}
#=> five
#=> six
In theory--once you've collected the appropriate set of links--you can iterate through the links and click them (although I find this prone to StaleElementReferenceError errors).

Resources