This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function highlight($sString, $aWords) { | |
if (!is_array ($aWords) || empty ($aWords) || !is_string ($sString)) { | |
return false; | |
} | |
$sWords = implode ('|', $aWords); | |
return preg_replace ('@\b('.$sWords.')\b@si', '<strong style="background-color:yellow">$1</strong>', $sString); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var button = document.getElementById("copy-button"), | |
contentHolder = document.getElementById("content-holder"); | |
button.addEventListener("click", function() { | |
// We will need a range object and a selection.var range = document.createRange(), | |
selection = window.getSelection(); | |
// Clear selection from any previous data. | |
selection.removeAllRanges(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("a").click( function(event) { | |
event.preventDefault(); | |
}); |
NewerOlder