scripts[] = js/jquery.validate.min.js
* This source code was highlighted with Source Code Highlighter .
$().ready(function() {
$( "#comment-form" ).validate();
});
</pre>
* This source code was highlighted with Source Code Highlighter .
$().ready(function() {
$( "#comment-form, #user-register" ).validate();
});
* This source code was highlighted with Source Code Highlighter .
$(function(){
$( '._blank a' ).click(function(){
window.open( this .href);
return false ;
});
});
* This source code was highlighted with Source Code Highlighter .
< span class =" _blank >< a href ="http://habrahabr.ru" > Habrahabr </ a ></ span >
* This source code was highlighted with Source Code Highlighter .
< div class ="content _blank" >
< p >
< a href ="http://www.lipsum.com/" > Lorem ipsum </ a > dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. < a href ="http://www.lipsum.com/" > Excepteur </ a > sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</ p >
</ div >
* This source code was highlighted with Source Code Highlighter .
// Wrap span tags around the anchor text in the primary menu.
$(document).ready(function(){
$("#primary li a")
.wrapInner(" < span > " + " </ span > ");
});
* This source code was highlighted with Source Code Highlighter .
/**
* Override the theme_links function
*
* We use this to insert <span></span> tags around anchor text in the
* primary and secondary links. We need these to support Internet Explorer
* when building sliding door tabs with hover effects.
*/
function __links($links, $attributes = array( 'class' => 'links' )) {
$output = '' ;
if (count($links) > 0) {
$output = '<ul' . drupal_attributes($attributes) . '>' ;
$num_links = count($links);
$i = 1;
foreach ($links as $key => $link) {
$ class = $key;
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$ class .= ' first' ;
}
if ($i == $num_links) {
$ class .= ' last' ;
}
if (isset($link[ 'href' ]) && ($link[ 'href' ] == $_GET[ 'q' ] || ($link[ 'href' ] == '<front>' && drupal_is_front_page()))) {
$ class .= ' active' ;
}
$output .= '<li' . drupal_attributes(array( 'class' => $ class )) . '>' ;
// wrap <span>'s around the anchor text
if (isset($link[ 'href' ])) {
$link[ 'title' ] = '<span>' . check_plain($link[ 'title' ]) . '</span>' ;
$link[ 'html' ] = TRUE;
// Pass in $link as $options, they share the same keys.
$output .= l($link[ 'title' ], $link[ 'href' ], $link);
}
else if (!empty($link[ 'title' ])) {
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (empty($link[ 'html' ])) {
$link[ 'title' ] = check_plain($link[ 'title' ]);
}
$span_attributes = '' ;
if (isset($link[ 'attributes' ])) {
$span_attributes = drupal_attributes($link[ 'attributes' ]);
}
$output .= '<span' . $span_attributes . '>' . $link[ 'title' ] . '</span>' ;
}
$i++;
$output .= "</li>\n" ;
}
$output .= '</ul>' ;
}
return $output;
}
* This source code was highlighted with Source Code Highlighter .
$( document ).ready( function (){
// do some fancy stuff
});
* This source code was highlighted with Source Code Highlighter .
Drupal.behaviors.myModuleBehavior = function (context) {
//do some fancy stuff
};
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/80565/
All Articles