PHP Classes

File: src/Cabin/Bridge/public/page_history_diff.js

Recommend this page to a friend!
  Classes of Scott Arciszewski   CMS Airship   src/Cabin/Bridge/public/page_history_diff.js   Download  
File: src/Cabin/Bridge/public/page_history_diff.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CMS Airship
Content management system with security features
Author: By
Last change: Merge remote-tracking branch 'origin/master'
Date: 6 years ago
Size: 856 bytes
 

Contents

Class file image Download
$(document).ready(function () { var left = $("#diff_src_left").val(); var right = $("#diff_src_right").val(); var diff = JsDiff.diffLines(left, right, { "ignoreWhitespace": true }); var output = ''; var pieces = []; diff.forEach(function(change) { pieces = change.value.split("\n"); for (var i in pieces) { if (change.added) { pieces[i] = '+ ' + Airship.e(pieces[i]); } else if (change.removed) { pieces[i] = '- ' + Airship.e(pieces[i]); } } output += "<div class=\"diff_line" + (change.added ? ' diff_add' : '') + (change.removed ? ' diff_del' : '') + "\">" + pieces.join("<br />") + "</div>"; }); $("#diff_output").html(output); });