lib/hatemile/implementation/accessible_event_implementation.rb
##
# Include the scripts used by solutions.
#
# @return [void]
Include the scripts used by solutions.
Include the scripts used by solutions .
def generate_main_scripts
        head = @parser.find('head').first_result
        unless head.nil?
          common_functions_script = @parser.find(
            "##{ID_SCRIPT_COMMON_FUNCTIONS}"
          ).first_result
          if common_functions_script.nil?
            common_functions_script = @parser.create_element('script')
            common_functions_script.set_attribute(
              'id',
              ID_SCRIPT_COMMON_FUNCTIONS
            )
            common_functions_script.set_attribute('type', 'text/javascript')
            common_functions_script.append_text(
              File.read(
                File.join(
                  File.dirname(File.dirname(File.dirname(__FILE__))),
                  'js',
                  'common.js'
                )
              )
            )
            head.prepend_element(common_functions_script)
          end
          if @parser.find("##{ID_SCRIPT_EVENT_LISTENER}").first_result.nil?
            script = @parser.create_element('script')
            script.set_attribute('id', ID_SCRIPT_EVENT_LISTENER)
            script.set_attribute('type', 'text/javascript')
            script.append_text(
              File.read(
                File.join(
                  File.dirname(File.dirname(File.dirname(__FILE__))),
                  'js',
                  'eventlistener.js'
                )
              )
            )
            common_functions_script.insert_after(script)
          end
        end
        local = @parser.find('body').first_result
        unless local.nil?
          @script_list = @parser.find("##{ID_LIST_IDS_SCRIPT}").first_result
          if @script_list.nil?
            @script_list = @parser.create_element('script')
            @script_list.set_attribute('id', ID_LIST_IDS_SCRIPT)
            @script_list.set_attribute('type', 'text/javascript')
            @script_list.append_text('var activeElements = [];')
            @script_list.append_text('var hoverElements = [];')
            @script_list.append_text('var dragElements = [];')
            @script_list.append_text('var dropElements = [];')
            local.append_element(@script_list)
          end
          if @parser.find("##{ID_FUNCTION_SCRIPT_FIX}").first_result.nil?
            script_function = @parser.create_element('script')
            script_function.set_attribute('id', ID_FUNCTION_SCRIPT_FIX)
            script_function.set_attribute('type', 'text/javascript')
            script_function.append_text(
              File.read(
                File.join(
                  File.dirname(File.dirname(File.dirname(__FILE__))),
                  'js',
                  'include.js'
                )
              )
            )
            local.append_element(script_function)
          end
        end
        @main_script_added = true
      end
def generate_main_scripts head = @parser . find ( 'head' ) . first_result unless head . nil? common_functions_script = @parser . find ( "##{ID_SCRIPT_COMMON_FUNCTIONS}" ) . first_result if common_functions_script . nil? common_functions_script = @parser . create_element ( 'script' ) common_functions_script . set_attribute ( 'id' , ID_SCRIPT_COMMON_FUNCTIONS ) common_functions_script . set_attribute ( 'type' , 'text/javascript' ) common_functions_script . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'common.js' ) ) ) head . prepend_element ( common_functions_script ) end if @parser . find ( "##{ID_SCRIPT_EVENT_LISTENER}" ) . first_result . nil? script = @parser . create_element ( 'script' ) script . set_attribute ( 'id' , ID_SCRIPT_EVENT_LISTENER ) script . set_attribute ( 'type' , 'text/javascript' ) script . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'eventlistener.js' ) ) ) common_functions_script . insert_after ( script ) end end local = @parser . find ( 'body' ) . first_result unless local . nil? @script_list = @parser . find ( "##{ID_LIST_IDS_SCRIPT}" ) . first_result if @script_list . nil? @script_list = @parser . create_element ( 'script' ) @script_list . set_attribute ( 'id' , ID_LIST_IDS_SCRIPT ) @script_list . set_attribute ( 'type' , 'text/javascript' ) @script_list . append_text ( 'var activeElements = [];' ) @script_list . append_text ( 'var hoverElements = [];' ) @script_list . append_text ( 'var dragElements = [];' ) @script_list . append_text ( 'var dropElements = [];' ) local . append_element ( @script_list ) end if @parser . find ( "##{ID_FUNCTION_SCRIPT_FIX}" ) . first_result . nil? script_function = @parser . create_element ( 'script' ) script_function . set_attribute ( 'id' , ID_FUNCTION_SCRIPT_FIX ) script_function . set_attribute ( 'type' , 'text/javascript' ) script_function . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'include.js' ) ) ) local . append_element ( script_function ) end end @main_script_added = true end
Include the scripts used by solutions.
Include the scripts used by solutions .
None
void