Angular JS Filtering Fun

A crude but effective base64 and zalgo text generator

by Steven Senkus

HTML

<div ng-app="filterApp">
    <input ng-model="in" />
    <pre>{{in | toBase64 }}</pre>
    <textarea>{{in | zalgo}}</textarea>
</div>

CSS

div {font-size: 15px; height: 400px; width: 500px; border: 2px solid #000; padding: 10px; overflow: hidden; background-color: #000; color: #0f0; }

textarea {
    font-size: 30px;
    padding: 10px;
    background-color: #000; color: #0f0;
    width: 400px;
    height: 300px;
}

JavaScript

var app = angular.module('filterApp', []);

app.filter('toBase64', function () {
    return function (input) {
        return (input !== undefined) ? btoa(input) : '';
    };

});

app.filter('zalgo', function() {
    return function(input) {
        var out = "";
        for(var i = 0, len = input.length; i < len; i++) {
            out +=  rand_zalgo(zalgo_down) + input[i] + rand_zalgo(zalgo_up);
        }
        return out;
    };
});

//============================================================
// ZALGO text script by tchouky
//============================================================

// data set of leet unicode chars
//---------------------------------------------------

//those go UP
var zalgo_up = [
    '\u030d', /*     ̍     */ '\u030e', /*     ̎     */ '\u0304', /*     ̄     */ '\u0305', /*     ̅     */
    '\u033f', /*     ̿     */ '\u0311', /*     ̑     */ '\u0306', /*     ̆     */ '\u0310', /*     ̐     */
    '\u0352', /*     ͒     */ '\u0357', /*     ͗     */ '\u0351', /*     ͑     */ '\u0307', /*     ̇     */
    '\u0308', /*     ̈     */ '\u030a', /*     ̊     */ '\u0342', /*     ͂     */ '\u0343', /*     ̓     */
    '\u0344', /*     ̈́     */ '\u034a', /*     ͊     */ '\u034b', /*     ͋     */ '\u034c', /*     ͌     */
    '\u0303', /*     ̃     */ '\u0302', /*     ̂     */ '\u030c', /*     ̌     */ '\u0350', /*     ͐     */
    '\u0300', /*     ̀     */ '\u0301', /*     ́     */ '\u030b', /*     ̋     */ '\u030f', /*     ̏     */
    '\u0312', /*     ̒     */ '\u0313', /*     ̓     */ '\u0314', /*     ̔     */ '\u033d', /*     ̽     */
    '\u0309', /*     ̉     */ '\u0363', /*     ͣ     */ '\u0364', /*     ͤ     */ '\u0365', /*     ͥ     */
    '\u0366', /*     ͦ     */ '\u0367', /*     ͧ     */ '\u0368', /*     ͨ     */ '\u0369', /*     ͩ     */
    '\u036a', /*     ͪ     */ '\u036b', /*     ͫ     */ '\u036c', /*     ͬ     */ '\u036d', /*     ͭ     */
    '\u036e', /*     ͮ     */ '\u036f', /*     ͯ     */ '\u033e', /*     ̾     */...