<commit_before>{ Tutorial, Step } = require 'zootorial'
translate = require 't7e'

ctx = null

getMaskValue = (e) ->
  position = $('.current .image').position()
  x = e.pageX - position.left
  y = e.pageY - position.top - 10 # Subtract the radius 10 from the coordinate
  
  pixel = ctx.getImageData(x, y, 1, 1)
  return pixel.data[3]

module.exports =
  length: 8
  
  welcome: new Step
    number: 1
    header: translate 'span', 'tutorial.welcome.header'
    details: translate 'span', 'tutorial.welcome.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'what_are_lenses_1'
  
  what_are_lenses_1: new Step
    number: 2
    header: translate 'span', 'tutorial.what_are_lenses_1.header'
    details: translate 'span', 'tutorial.what_are_lenses_1.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'what_are_lenses_2'
  
  what_are_lenses_2: new Step
    number: 3
    header: translate 'span', 'tutorial.what_are_lenses_2.header'
    details: translate 'span', 'tutorial.what_are_lenses_2.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'spotters_guide'
  
  spotters_guide: new Step
    number: 4
    header: translate 'span', 'tutorial.spotters_guide.header'
    details: translate 'span', 'tutorial.spotters_guide.details'
    attachment: 'right center .quick-guide left center'
    block: '.annotation, .controls:first'
    className: 'arrow-right'
    next: 'identify'
  
  identify: new Step
    number: 5
    header: translate 'span', 'tutorial.identify.header'
    details: translate 'span', 'tutorial.identify.details'
    attachment: 'left center .primary 0.7 center'
    block: '.annotation, .controls:first'
    className: 'arrow-left'
    onEnter: ->
      bounding = document.createElementNS('http://www.w3.org/2000/svg', "circle")
      bounding.setAttribute("transform", "translate(#{220}, #{220})")
      bounding.setAttribute("class", "outline")
      bounding.setAttribute("stroke", 'white')
      bounding.setAttribute("stroke-width", 2)
      bounding.setAttribute("r", 50)
      bounding.setAttribute("fill-opacity", 0)
      bounding.setAttribute("opacity", 0.4)
      $("svg.primary")[0].appendChild(bounding)
    next: 'mark'
  
  mark: new Step
    number: 6
    header: translate 'span', 'tutorial.mark.header'
    details: translate 'span', 'tutorial.mark.details'
    attachment: 'left center .primary 0.7 center'
    block: '.controls:first'
    className: 'arrow-left'
    onEnter: (tutorial) ->
      canvas = document.createElement('canvas')
      ctx = canvas.getContext('2d')
      img = new Image()
      img.onload = (e) =>
        viewportSize = 441
        canvas.width = viewportSize
        canvas.height = viewportSize
        ctx.drawImage img, 0, 0, viewportSize, viewportSize
      img.src = $('.current .image img').attr('src')
    next:
      'mouseup .annotation': (e, tutorial, step) ->
        mask = getMaskValue(e)
        return if mask is 255 then 'good_job' else 'try_again'
  
  good_job: new Step
    header: translate 'span', 'tutorial.good_job.header'
    details: translate 'span', 'tutorial.good_job.details'
    attachment: 'left center .primary 0.7 center'
    block: '.controls'
    className: 'arrow-left'
    next: 'training'
    
  try_again: new Step
    header: translate 'span', 'tutorial.try_again.header'
    details: translate 'span', 'tutorial.try_again.details'
    attachment: 'left center .primary 0.7 center'
    className: 'arrow-left'
    blocks: '.controls:first'
    next:
      'mouseup .annotation': (e, tutorial, step) ->
        mask = getMaskValue(e)
        return if mask is 255 then 'good_job' else false
  
  training: new Step
    number: 7
    header: translate 'span', 'tutorial.training.header'
    details: translate 'span', 'tutorial.training.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'thanks'<commit_msg>Consistent treatment of tutorial and training sims rearding mask value - still seem to be getting mask read err (val=0) though<commit_after>{ Tutorial, Step } = require 'zootorial'
translate = require 't7e'

ctx = null

getMaskValue = (e) ->
  position = $('.current .image').position()
  x = e.pageX - position.left
  y = e.pageY - position.top - 10 # Subtract the radius 10 from the coordinate
  
  pixel = ctx.getImageData(x, y, 1, 1)
  return pixel.data[3]

module.exports =
  length: 8
  
  welcome: new Step
    number: 1
    header: translate 'span', 'tutorial.welcome.header'
    details: translate 'span', 'tutorial.welcome.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'what_are_lenses_1'
  
  what_are_lenses_1: new Step
    number: 2
    header: translate 'span', 'tutorial.what_are_lenses_1.header'
    details: translate 'span', 'tutorial.what_are_lenses_1.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'what_are_lenses_2'
  
  what_are_lenses_2: new Step
    number: 3
    header: translate 'span', 'tutorial.what_are_lenses_2.header'
    details: translate 'span', 'tutorial.what_are_lenses_2.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'spotters_guide'
  
  spotters_guide: new Step
    number: 4
    header: translate 'span', 'tutorial.spotters_guide.header'
    details: translate 'span', 'tutorial.spotters_guide.details'
    attachment: 'right center .quick-guide left center'
    block: '.annotation, .controls:first'
    className: 'arrow-right'
    next: 'identify'
  
  identify: new Step
    number: 5
    header: translate 'span', 'tutorial.identify.header'
    details: translate 'span', 'tutorial.identify.details'
    attachment: 'left center .primary 0.7 center'
    block: '.annotation, .controls:first'
    className: 'arrow-left'
    onEnter: ->
      bounding = document.createElementNS('http://www.w3.org/2000/svg', "circle")
      bounding.setAttribute("transform", "translate(#{220}, #{220})")
      bounding.setAttribute("class", "outline")
      bounding.setAttribute("stroke", 'white')
      bounding.setAttribute("stroke-width", 2)
      bounding.setAttribute("r", 50)
      bounding.setAttribute("fill-opacity", 0)
      bounding.setAttribute("opacity", 0.4)
      $("svg.primary")[0].appendChild(bounding)
    next: 'mark'
  
  mark: new Step
    number: 6
    header: translate 'span', 'tutorial.mark.header'
    details: translate 'span', 'tutorial.mark.details'
    attachment: 'left center .primary 0.7 center'
    block: '.controls:first'
    className: 'arrow-left'
    onEnter: (tutorial) ->
      canvas = document.createElement('canvas')
      ctx = canvas.getContext('2d')
      img = new Image()
      img.onload = (e) =>
        viewportSize = 441
        canvas.width = viewportSize
        canvas.height = viewportSize
        ctx.drawImage img, 0, 0, viewportSize, viewportSize
      img.src = $('.current .image img').attr('src')
    next:
      'mouseup .annotation': (e, tutorial, step) ->
        mask = getMaskValue(e)
        return if mask is 255 then 'good_job' else 'try_again'
  
  good_job: new Step
    header: translate 'span', 'tutorial.good_job.header'
    details: translate 'span', 'tutorial.good_job.details'
    attachment: 'left center .primary 0.7 center'
    block: '.controls'
    className: 'arrow-left'
    next: 'training'
    
  try_again: new Step
    header: translate 'span', 'tutorial.try_again.header'
    details: translate 'span', 'tutorial.try_again.details'
    attachment: 'left center .primary 0.7 center'
    className: 'arrow-left'
    blocks: '.controls:first'
    next:
      'mouseup .annotation': (e, tutorial, step) ->
        mask = getMaskValue(e)
        return if mask is 254 then 'good_job' else false
  
  training: new Step
    number: 7
    header: translate 'span', 'tutorial.training.header'
    details: translate 'span', 'tutorial.training.details'
    attachment: 'center center .current center center'
    block: '.annotation, .controls:first'
    next: 'thanks'
{'fraction_non_alphanumeric': 0.1271913916092371, 'fraction_numerical': 0.015113045580945473, 'mean_word_length': 3.3263598326359833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2241456', 'n_tokens_mistral': 2692, 'n_tokens_neox': 2575, 'n_words': 688}