JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<section>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
<p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of <b>Lorem Ipsum</b>.</p>
<a href="https://en.wikipedia.org/wiki/Lorem_ipsum">Lorem Ipsum Wikipedia Link</a>
</section>
<section>
<p>This <span class="small-u">lorem ipsum</span> should not be hilighted.</p>
</section>
<ul>
<li>A Lorem Ipsum List</li>
<li>More Elements Here</li>
</ul>
<p class="notification"></p>
body {
font-family: 'Dosis';
font-size: 1.3em;
width: 600px;
text-align: justify;
line-height: 1.8em;
}
.match-section {
background: #9F6;
border-radius: 3px;
padding: 2px;
}
.match-link {
background: #F96;
border-radius: 3px;
padding: 2px;
}
.notification{
border-radius: 3px;
background: rgba(0,0,0,0.9);
color: #fff;
padding: 4px;
position: fixed;
bottom: 0;
}
(function($) {
$.fn.findReplace = function(options) {
var settings = $.extend({
findText: null,
replaceText: "",
customClass: "",
completeCallback: null
}, options);
return this.each(function() {
var StringToFind = settings.findText;
var regExpression = new RegExp(StringToFind, "g");
var replacement = "<span class='" + settings.customClass + "'>" + settings.replaceText + "</span>";
$(this).html(
$(this).html().replace(regExpression, replacement)
);
if ($.isFunction(settings.completeCallback)) {
settings.completeCallback.call(this);
}
});
};
}(jQuery));
$("a").findReplace({
findText: "Lorem Ipsum",
replaceText: "I was replaced too!",
customClass: "match-link",
completeCallback: function() {
$('.notification').text('Executed the plugin on all links').fadeOut(5000);
}
});
$("section").findReplace({
findText: "Lorem Ipsum",
replaceText: "Ipsum Lorem",
customClass: "match-section"
});
$("ul").findReplace({
findText: "Lorem",
replaceText: "Replaced"
});
Also see: Tab Triggers