Sha256: be5241a5a15c698dd8f5dcb84e60d353d3aa166ef3c90c9a7948fee7d1ba30f7
Contents?: true
Size: 771 Bytes
Versions: 35
Compression:
Stored size: 771 Bytes
Contents
class @Mercury.HistoryBuffer constructor: (@maxLength = 200) -> @index = 0 @stack = [] @markerRegExp = /<em class="mercury-marker"><\/em>/g push: (item) -> if jQuery.type(item) == 'string' return if @stack[@index] && @stack[@index].replace(@markerRegExp, '') == item.replace(@markerRegExp, '') else if jQuery.type(item) == 'object' && item.html return if @stack[@index] && @stack[@index].html == item.html @stack = @stack[0...@index + 1] @stack.push(item) @stack.shift() if @stack.length > @maxLength @index = @stack.length - 1 undo: -> return null if @index < 1 @index -= 1 return @stack[@index] redo: -> return null if @index >= @stack.length - 1 @index += 1 return @stack[@index]
Version data entries
35 entries across 35 versions & 3 rubygems