1
0

CLR.js 667 B

123456789101112131415161718192021
  1. setup.CLR = function(){
  2. var passage = $('.passage');
  3. var marker = $('#CLR_marker');
  4. if (marker.length) {
  5. // Create a flag to start removing nodes
  6. var remove = true;
  7. // Iterate over all child nodes within the #passage element
  8. passage.contents().each(function() {
  9. if (this === marker[0]) {
  10. // Stop removing after the CLS_marker is found and removed
  11. remove = false;
  12. this.remove();
  13. } else if (remove) {
  14. // Remove all nodes (including text nodes) before the CLS_marker
  15. this.remove();
  16. }
  17. });
  18. }
  19. };