<commit_before>/**
 * Created by Christian on 29.06.2014.
 */

var gulp = require('gulp');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var mainBowerFiles = require('main-bower-files');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var less = require('gulp-less');
var rename = require('gulp-rename');
var watch = require('gulp-watch');
var html2js = require('gulp-ng-html2js');
var minifyhtml = require('gulp-minify-html');
var inject = require('gulp-inject');
var appendRev = require('./gulp-append-rev.js').appendRev;
var appendAppInfo = require('./gulp-append-rev.js').appendAppInfo;
var angularFileSort = require('gulp-angular-filesort');
var pkg = require('./package.json');
var gulpif = require('gulp-if');
var argv = require('yargs').argv;
var header = require('gulp-header');
var cssmin = require('gulp-minify-css');
var path = require('path');

var release = argv.release;

var paths = {
    "filenames": {
        "app": pkg.name + ".js",
        "css": pkg.name + ".css",
        "template": pkg.name + ".templates.js",
        "vendor": pkg.name + ".vendor.js",
        "img": 'site.png'
    },
    "src": {
        "fonts": 'src/assets/fonts/*.*',
        "img": ['src/assets/images/*.png', 'src/assets/images/*.jpg'],
        "app": ['src/**/*.js'],
        "template": ['src/app/**/*.html', 'src/common/**/*.html'],
        "css": 'src/assets/main.less',
        "index": 'src/index.html'
        //"bootstrap": 'src/assets/bootstrap.less'
    },
    "name": pkg.name,
    "build": "build/",
    "templatemodule": pkg.name + ".templates"
};

function watchFilesAndStartTask(filesGlob, task) {
    watch(filesGlob, function (files) {
        gulp.start(task);
    });
}

gulp.task('changelog', function () {
    require('conventional-changelog')({
        repository: 'https://github.com/Opiskull/one4all',
        version: require('./package.json').version,
        file: '../CHANGELOG.md'
    }, function (err, log) {
        require('fs').writeFile('../CHANGELOG.md', log);
    });
});

gulp.task('default', ['build'], function () {
    gulp.start('watch');
});

gulp.task('build', ['clean'], function () {
    gulp.start('fonts');
    gulp.start('images');
    gulp.start('index');
});

gulp.task('watch', function () {
    gulp.start('watch:fonts', 'watch:images', 'watch:app', 'watch:templates', 'watch:vendor', 'watch:css', 'watch:index');
});

gulp.task('clean', function () {
    return gulp.src(paths.build, {read: false})
        .pipe(clean());
});

gulp.task('index', ['app', 'templates', 'vendor', 'css'], function () {
    return gulp.src('./src/index.html')
        .pipe(
        inject(
            gulp.src([
                paths.build + paths.filenames.vendor,
                paths.build + paths.filenames.app,
                paths.build + paths.filenames.css,
                paths.build + paths.filenames.template
            ], {read: false}),
            {
                ignorePath: paths.build, addRootSlash: false
            }
        )
    )
        .pipe(appendRev())
        .pipe(appendAppInfo())
        .pipe(gulp.dest(paths.build));
});

gulp.task('fonts', function () {
    return gulp.src(paths.src.fonts)
        .pipe(gulp.dest('build/fonts'));
});

gulp.task('images', function () {
    return gulp.src(paths.src.img)
        .pipe(gulp.dest(paths.build + "/images/"));
});

gulp.task('app', function () {
    return gulp.src(paths.src.app)
        .pipe(angularFileSort())
        .pipe(concat(paths.filenames.app))
        .pipe(gulpif(release, uglify()))
        .pipe(gulp.dest(paths.build));
});

gulp.task('templates', function () {
    return gulp.src(paths.src.template)
        .pipe(gulpif(release, minifyhtml({
            empty: true,
            spare: true,
            quotes: true
        })))
        .pipe(html2js({
            moduleName: paths.templatemodule,
            declareModule: false
        }))
        .pipe(concat(paths.filenames.template))
        .pipe(gulpif(release, uglify()))
        .pipe(header("angular.module('<%= moduleName %>',[]);\n",{moduleName: paths.templatemodule}))
        .pipe(gulp.dest(paths.build));
});

gulp.task('vendor', function () {
    return gulp.src(mainBowerFiles())
        .pipe(concat(paths.filenames.vendor))
        .pipe(gulpif(release, uglify()))
        .pipe(gulp.dest(paths.build))
        .on('error', gutil.log);
});

gulp.task('css', function () {
    return gulp.src(paths.src.css)
        .pipe(less())
        .pipe(gulpif(release,cssmin()))
        .pipe(rename(paths.filenames.css))
        .pipe(gulp.dest(paths.build));
});

gulp.task('watch:fonts', function () {
    watchFilesAndStartTask(paths.src.fonts, 'fonts');
});

gulp.task('watch:images', function () {
    watchFilesAndStartTask(paths.src.img, 'images');
});

gulp.task('watch:app', function () {
    watchFilesAndStartTask(paths.src.app, 'app');
});

gulp.task('watch:templates', function () {
    watchFilesAndStartTask(paths.src.template, 'templates');
});

gulp.task('watch:vendor', function () {
    watchFilesAndStartTask('bower_components/**/*.js', 'vendor');
});

gulp.task('watch:css', function () {
    watchFilesAndStartTask('src/assets/**/*.less', 'css');
});

gulp.task('watch:index', function () {
    watchFilesAndStartTask(paths.src.index, 'index');
});<commit_msg>fix(client-gulpfile): watch doesn't restart task<commit_after>/**
 * Created by Christian on 29.06.2014.
 */

var gulp = require('gulp');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var mainBowerFiles = require('main-bower-files');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var less = require('gulp-less');
var rename = require('gulp-rename');
var watch = require('gulp-watch');
var html2js = require('gulp-ng-html2js');
var minifyhtml = require('gulp-minify-html');
var inject = require('gulp-inject');
var appendRev = require('./gulp-append-rev.js').appendRev;
var appendAppInfo = require('./gulp-append-rev.js').appendAppInfo;
var angularFileSort = require('gulp-angular-filesort');
var pkg = require('./package.json');
var gulpif = require('gulp-if');
var argv = require('yargs').argv;
var header = require('gulp-header');
var cssmin = require('gulp-minify-css');
var path = require('path');

var release = argv.release;

var paths = {
    "filenames": {
        "app": pkg.name + ".js",
        "css": pkg.name + ".css",
        "template": pkg.name + ".templates.js",
        "vendor": pkg.name + ".vendor.js",
        "img": 'site.png'
    },
    "src": {
        "fonts": 'src/assets/fonts/*.*',
        "img": ['src/assets/images/*.png', 'src/assets/images/*.jpg'],
        "app": ['src/**/*.js'],
        "template": ['src/app/**/*.html', 'src/common/**/*.html'],
        "css": 'src/assets/main.less',
        "index": 'src/index.html'
        //"bootstrap": 'src/assets/bootstrap.less'
    },
    "name": pkg.name,
    "build": "build/",
    "templatemodule": pkg.name + ".templates"
};

function watchFilesAndStartTask(filesGlob, task) {
    console.log(filesGlob);
    console.log(task);
    watch(filesGlob, function (files, cb) {
        gulp.start(task, cb);
    });
}

gulp.task('changelog', function () {
    require('conventional-changelog')({
        repository: 'https://github.com/Opiskull/one4all',
        version: require('./package.json').version,
        file: '../CHANGELOG.md'
    }, function (err, log) {
        require('fs').writeFile('../CHANGELOG.md', log);
    });
});

gulp.task('default', ['build'], function () {
    gulp.start('watch');
});

gulp.task('build', ['clean'], function () {
    gulp.start('fonts');
    gulp.start('images');
    gulp.start('index');
});

gulp.task('watch', function () {
    gulp.start('watch:fonts', 'watch:images', 'watch:app', 'watch:templates', 'watch:vendor', 'watch:css', 'watch:index');
});

gulp.task('clean', function () {
    return gulp.src(paths.build, {read: false})
        .pipe(clean());
});

gulp.task('index', ['app', 'templates', 'vendor', 'css'], function () {
    return gulp.src('./src/index.html')
        .pipe(
        inject(
            gulp.src([
                paths.build + paths.filenames.vendor,
                paths.build + paths.filenames.app,
                paths.build + paths.filenames.css,
                paths.build + paths.filenames.template
            ], {read: false}),
            {
                ignorePath: paths.build, addRootSlash: false
            }
        )
    )
        .pipe(appendRev())
        .pipe(appendAppInfo())
        .pipe(gulp.dest(paths.build));
});

gulp.task('fonts', function () {
    return gulp.src(paths.src.fonts)
        .pipe(gulp.dest('build/fonts'));
});

gulp.task('images', function () {
    return gulp.src(paths.src.img)
        .pipe(gulp.dest(paths.build + "/images/"));
});

gulp.task('app', function () {
    return gulp.src(paths.src.app)
        .pipe(angularFileSort())
        .pipe(concat(paths.filenames.app))
        .pipe(gulpif(release, uglify()))
        .pipe(gulp.dest(paths.build));
});

gulp.task('templates', function () {
    return gulp.src(paths.src.template)
        .pipe(gulpif(release, minifyhtml({
            empty: true,
            spare: true,
            quotes: true
        })))
        .pipe(html2js({
            moduleName: paths.templatemodule,
            declareModule: false
        }))
        .pipe(concat(paths.filenames.template))
        .pipe(gulpif(release, uglify()))
        .pipe(header("angular.module('<%= moduleName %>',[]);\n",{moduleName: paths.templatemodule}))
        .pipe(gulp.dest(paths.build));
});

gulp.task('vendor', function () {
    return gulp.src(mainBowerFiles())
        .pipe(concat(paths.filenames.vendor))
        .pipe(gulpif(release, uglify()))
        .pipe(gulp.dest(paths.build))
        .on('error', gutil.log);
});

gulp.task('css', function () {
    return gulp.src(paths.src.css)
        .pipe(less())
        .pipe(gulpif(release,cssmin()))
        .pipe(rename(paths.filenames.css))
        .pipe(gulp.dest(paths.build));
});

gulp.task('watch:fonts', function () {
    watchFilesAndStartTask(paths.src.fonts, 'fonts');
});

gulp.task('watch:images', function () {
    watchFilesAndStartTask(paths.src.img, 'images');
});

gulp.task('watch:app', function () {
    watchFilesAndStartTask(paths.src.app, 'app');
});

gulp.task('watch:templates', function () {
    watchFilesAndStartTask(paths.src.template, 'templates');
});

gulp.task('watch:vendor', function () {
    watchFilesAndStartTask('bower_components/**/*.js', 'vendor');
});

gulp.task('watch:css', function () {
    watchFilesAndStartTask('src/assets/**/*.less', 'css');
});

gulp.task('watch:index', function () {
    watchFilesAndStartTask(paths.src.index, 'index');
});<|endoftext|>


<commit_before><commit_msg>removed default axes labelling<commit_after><|endoftext|>


<commit_before>/* jshint browser: true, jquery: true */
/* global Panel:false, console:false, server:false, addWidget:false */

function addPanel(panel) {
  sendAddPanel(panel);
}

function updatePanel(panel) {
  sendUpdatePanel(panel);
}

function processPanelMessages(server, id, content) {
  var processed = false;

  switch (id) {
    case Panel.MESSAGE_PANELS:
      receivedPanels(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_ADD_PANEL:
      receivedAddPanel(server, new Panel(content));
      processed = true;
      break;

    case Panel.MESSAGE_DELETE_PANEL:
      receivedDeletePanel(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_UPDATE_PANEL:
      receivedUpdatePanel(server, new Panel(content));
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_UP:
      console.log("content: " + content);
      receivedMovePanelUp(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_DOWN:
      receivedMovePanelDown(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_LEFT:
      receivedMovePanelLeft(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_RIGHT:
      receivedMovePanelRight(server, content);
      processed = true;
      break;
  }

  return processed;
}

function isPanelAddMode() {
  // TODO: addPanelMode is global (refer main.js), not really happy about this
  return addPanelMode;
}

function receivedAddPanel(server, d) {
  addPanelToDom(d, isPanelAddMode());
}

function receivedDeletePanel(server, id) {
  deletePanel(id);
}

function receivedMovePanelUp(server, id) {
  movePanelUp(id);
}

function receivedMovePanelDown(server, id) {
  movePanelDown(id);
}

function receivedMovePanelLeft(server, panel) {
  changePanelColumn(panel);
}

function receivedMovePanelRight(server, panel) {
  changePanelColumn(panel);
}

function receivedUpdatePanel(server, panel) {
  // get current data
  var currentPanelElement = $('#panel' + panel.id);

  var currentPanel = new Panel(currentPanelElement.data());

  console.log("current data for " + panel.id + " is: " + JSON.stringify(currentPanel, null, " "));

  // apply changes to DOM
  if(currentPanel.name !== panel.name) {
    $('#panelName' + panel.id).text(panel.name);
  }

// ignore this for now, presume that only via move left/right that this can happen
//  if(currentPanel.column !== panel.column) {
//
//  }

  if(currentPanel.iconName !== panel.iconName) {
    $('panelIcon' + panel.id).removeClass(currentPanel.iconName).addclass(panel.iconName);
  }

  // TODO: not sure we need to persist data attributes, trust the server to hold these?
  // update data attributes for id

}

function receivedPanels(server, d) {
  // TODO: logic to handle resend of panels
  // $(".panelRow").remove();

  var buttonsVisible = isPanelAddMode();

  var panelsArray = [];

  for (var item in d) {
   panelsArray.push(new Panel(d[item]));
  }

  panelsArray.sort(function (a, b) {
      if (a.row  b.row) {
          return 1;
      }
      return 0;
  });

  panelsArray.forEach(function (p) {
    addPanelToDom(p, buttonsVisible);
  });
}

function sendAddPanel(panel) {
  server.sendMessage(Panel.MESSAGE_ADD_PANEL, panel);
}

function sendDeletePanel(id) {
  server.sendMessage(Panel.MESSAGE_DELETE_PANEL, id);
}

function sendUpdatePanel(panel) {
  server.sendMessage(Panel.MESSAGE_UPDATE_PANEL, panel);
}

function sendMovePanelUp(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_UP, id);
}

function sendMovePanelDown(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_DOWN, id);
}

function sendMovePanelLeft(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_LEFT, id);
}

function sendMovePanelRight(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_RIGHT, id);
}

function addPanelToDom(panel, buttonsVisible) {
  var displayButtonClass = buttonsVisible ? "displayButton" : "";
  var displayStyle = buttonsVisible ? "block" : "none";

  $("#columnContainer" + panel.column).append(
    '
' +
    '
' +
    '
' +
    '        <button id="panelBtnAddWidget' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnRemoveWidget' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnDelete' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveDown' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveUp' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveLeft' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveRight' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnModify' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '
' +
    '     ' + panel.name + '' +
    '
' +
    '
' +
    '
' +
    '
'
  );

  $('#panel' + panel.id).hide().fadeIn('slow');

  $('#panelBtnAddWidget' + panel.id).on('click', function() {
    // addWidget('#panel' + panel.id);
    addWidget(panel.id);
  });

  $('#panelBtnRemoveWidget' + panel.id).on('click', function() {
  });

  $('#panelBtnDelete' + panel.id).on('click', function() {
    sendDeletePanel(panel.id);
  });

  $('#panelBtnMoveDown' + panel.id).on('click', function() {
    sendMovePanelDown(panel.id);
  });

  $('#panelBtnMoveUp' + panel.id).on('click', function() {
    sendMovePanelUp(panel.id);
  });

  $('#panelBtnMoveLeft' + panel.id).on('click', function() {
    sendMovePanelLeft(panel.id);
  });

  $('#panelBtnMoveRight' + panel.id).on('click', function() {
    sendMovePanelRight(panel.id);
  });

  $('#panelBtnModify' + panel.id).on('click', function() {
    displayPanelDialog('update', panel);
  });
}

function deletePanel(id) {
  $('#panel' + id)
    .animate({height: 0, padding: 0, margin: 0}, {easing: "linear", duration: "slow", queue: false})
    .fadeOut('slow', function() {
    this.remove();
  });
}

function movePanelDown(id) {
  var panelList = getPanelList(id);

  if(panelList['panel' + id].position < (Object.keys(panelList).length - 1)) {
    // move down
    swapPanelVertically(panelList['panel' + id].id, panelList['panel' + id].nextId);
  }
}

function movePanelUp(id) {
  var panelList = getPanelList(id);

  if(panelList['panel' + id].position > 0) {
    // move up
    swapPanelVertically(panelList['panel' + id].id, panelList['panel' + id].prevId);
  }
}

function changePanelColumn(panelData) {
  var panel = $('#panel' + panelData.id);

  $('#panel' + panelData.id)
    .animate({height: 0, padding: 0, margin: 0}, {easing: "linear", duration: "fast", queue: false})
    .fadeOut('fast', function() {
      panel
        .appendTo("#columnContainer" + panelData.column)
        .hide()
        .css('height', '')
        .css('padding', '')
        .css('margin', '')
        .fadeIn('fast');

  });
}

function getPanelList(id) {
  var prevPanel = null;
  var nextPanel = null;
  var counter = 0;
  var panelList = {};

  $('#panel' + id).parent().children().each(function() {
    panelList[$(this).attr('id')] = {
      id: $(this).attr('id'),
      position: counter++,
      value: this,
      prevId: null,
      nextId: null
    };

    if(prevPanel !== null) {
      panelList[$(this).attr('id')].prevId = prevPanel.id;
      prevPanel.nextId = $(this).attr('id');
    }

    prevPanel = panelList[$(this).attr('id')];
  });

  return panelList;
}

function swapPanelVertically(a, b){
    a = $('#' + a)[0];
    b = $('#' + b)[0];

    var t = a.parentNode.insertBefore(document.createTextNode(''), a);

    b.parentNode.insertBefore(a, b);
    t.parentNode.insertBefore(b, t);
    t.parentNode.removeChild(t);
}

<commit_msg>Now calls viewWidgetWizard instead of addWidget<commit_after>/* jshint browser: true, jquery: true */
/* global Panel:false, console:false, server:false, addWidget:false */

function addPanel(panel) {
  sendAddPanel(panel);
}

function updatePanel(panel) {
  sendUpdatePanel(panel);
}

function processPanelMessages(server, id, content) {
  var processed = false;

  switch (id) {
    case Panel.MESSAGE_PANELS:
      receivedPanels(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_ADD_PANEL:
      receivedAddPanel(server, new Panel(content));
      processed = true;
      break;

    case Panel.MESSAGE_DELETE_PANEL:
      receivedDeletePanel(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_UPDATE_PANEL:
      receivedUpdatePanel(server, new Panel(content));
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_UP:
      console.log("content: " + content);
      receivedMovePanelUp(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_DOWN:
      receivedMovePanelDown(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_LEFT:
      receivedMovePanelLeft(server, content);
      processed = true;
      break;

    case Panel.MESSAGE_MOVE_PANEL_RIGHT:
      receivedMovePanelRight(server, content);
      processed = true;
      break;
  }

  return processed;
}

function isPanelAddMode() {
  // TODO: addPanelMode is global (refer main.js), not really happy about this
  return addPanelMode;
}

function receivedAddPanel(server, d) {
  addPanelToDom(d, isPanelAddMode());
}

function receivedDeletePanel(server, id) {
  deletePanel(id);
}

function receivedMovePanelUp(server, id) {
  movePanelUp(id);
}

function receivedMovePanelDown(server, id) {
  movePanelDown(id);
}

function receivedMovePanelLeft(server, panel) {
  changePanelColumn(panel);
}

function receivedMovePanelRight(server, panel) {
  changePanelColumn(panel);
}

function receivedUpdatePanel(server, panel) {
  // get current data
  var currentPanelElement = $('#panel' + panel.id);

  var currentPanel = new Panel(currentPanelElement.data());

  console.log("current data for " + panel.id + " is: " + JSON.stringify(currentPanel, null, " "));

  // apply changes to DOM
  if(currentPanel.name !== panel.name) {
    $('#panelName' + panel.id).text(panel.name);
  }

// ignore this for now, presume that only via move left/right that this can happen
//  if(currentPanel.column !== panel.column) {
//
//  }

  if(currentPanel.iconName !== panel.iconName) {
    $('panelIcon' + panel.id).removeClass(currentPanel.iconName).addclass(panel.iconName);
  }

  // TODO: not sure we need to persist data attributes, trust the server to hold these?
  // update data attributes for id

}

function receivedPanels(server, d) {
  // TODO: logic to handle resend of panels
  // $(".panelRow").remove();

  var buttonsVisible = isPanelAddMode();

  var panelsArray = [];

  for (var item in d) {
   panelsArray.push(new Panel(d[item]));
  }

  panelsArray.sort(function (a, b) {
      if (a.row  b.row) {
          return 1;
      }
      return 0;
  });

  panelsArray.forEach(function (p) {
    addPanelToDom(p, buttonsVisible);
  });
}

function sendAddPanel(panel) {
  server.sendMessage(Panel.MESSAGE_ADD_PANEL, panel);
}

function sendDeletePanel(id) {
  server.sendMessage(Panel.MESSAGE_DELETE_PANEL, id);
}

function sendUpdatePanel(panel) {
  server.sendMessage(Panel.MESSAGE_UPDATE_PANEL, panel);
}

function sendMovePanelUp(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_UP, id);
}

function sendMovePanelDown(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_DOWN, id);
}

function sendMovePanelLeft(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_LEFT, id);
}

function sendMovePanelRight(id) {
  server.sendMessage(Panel.MESSAGE_MOVE_PANEL_RIGHT, id);
}

function addPanelToDom(panel, buttonsVisible) {
  var displayButtonClass = buttonsVisible ? "displayButton" : "";
  var displayStyle = buttonsVisible ? "block" : "none";

  $("#columnContainer" + panel.column).append(
    '
' +
    '
' +
    '
' +
    '        <button id="panelBtnAddWidget' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnRemoveWidget' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnDelete' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveDown' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveUp' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveLeft' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnMoveRight' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '        <button id="panelBtnModify' + panel.id + '" type="button" class="configButtons btn btn-default btn-sml ' + displayButtonClass + '" style="display: ' + displayStyle + ';">' +
    '          ' +
    '        </button>' +
    '
' +
    '     ' + panel.name + '' +
    '
' +
    '
' +
    '
' +
    '
'
  );

  $('#panel' + panel.id).hide().fadeIn('slow');

  $('#panelBtnAddWidget' + panel.id).on('click', function() {
    viewWidgetWizard(panel.id, 'add');
  });

  $('#panelBtnRemoveWidget' + panel.id).on('click', function() {
  });

  $('#panelBtnDelete' + panel.id).on('click', function() {
    sendDeletePanel(panel.id);
  });

  $('#panelBtnMoveDown' + panel.id).on('click', function() {
    sendMovePanelDown(panel.id);
  });

  $('#panelBtnMoveUp' + panel.id).on('click', function() {
    sendMovePanelUp(panel.id);
  });

  $('#panelBtnMoveLeft' + panel.id).on('click', function() {
    sendMovePanelLeft(panel.id);
  });

  $('#panelBtnMoveRight' + panel.id).on('click', function() {
    sendMovePanelRight(panel.id);
  });

  $('#panelBtnModify' + panel.id).on('click', function() {
    displayPanelDialog('update', panel);
  });
}

function deletePanel(id) {
  $('#panel' + id)
    .animate({height: 0, padding: 0, margin: 0}, {easing: "linear", duration: "slow", queue: false})
    .fadeOut('slow', function() {
    this.remove();
  });
}

function movePanelDown(id) {
  var panelList = getPanelList(id);

  if(panelList['panel' + id].position < (Object.keys(panelList).length - 1)) {
    // move down
    swapPanelVertically(panelList['panel' + id].id, panelList['panel' + id].nextId);
  }
}

function movePanelUp(id) {
  var panelList = getPanelList(id);

  if(panelList['panel' + id].position > 0) {
    // move up
    swapPanelVertically(panelList['panel' + id].id, panelList['panel' + id].prevId);
  }
}

function changePanelColumn(panelData) {
  var panel = $('#panel' + panelData.id);

  $('#panel' + panelData.id)
    .animate({height: 0, padding: 0, margin: 0}, {easing: "linear", duration: "fast", queue: false})
    .fadeOut('fast', function() {
      panel
        .appendTo("#columnContainer" + panelData.column)
        .hide()
        .css('height', '')
        .css('padding', '')
        .css('margin', '')
        .fadeIn('fast');

  });
}

function getPanelList(id) {
  var prevPanel = null;
  var nextPanel = null;
  var counter = 0;
  var panelList = {};

  $('#panel' + id).parent().children().each(function() {
    panelList[$(this).attr('id')] = {
      id: $(this).attr('id'),
      position: counter++,
      value: this,
      prevId: null,
      nextId: null
    };

    if(prevPanel !== null) {
      panelList[$(this).attr('id')].prevId = prevPanel.id;
      prevPanel.nextId = $(this).attr('id');
    }

    prevPanel = panelList[$(this).attr('id')];
  });

  return panelList;
}

function swapPanelVertically(a, b){
    a = $('#' + a)[0];
    b = $('#' + b)[0];

    var t = a.parentNode.insertBefore(document.createTextNode(''), a);

    b.parentNode.insertBefore(a, b);
    t.parentNode.insertBefore(b, t);
    t.parentNode.removeChild(t);
}

<|endoftext|>


<commit_before>dojo.provide("dojox.mobile.tests.doh.module");

try{
	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/Button.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/Button_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.DatePickerIso", dojo.moduleUrl("dojox.mobile", "tests/doh/DatePickerIso.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeCategory", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeCategory.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeStoreList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeStoreList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer3.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/View.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Progress-indicator", dojo.moduleUrl("dojox.mobile", "tests/doh/progress-indicator.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRect", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRect", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectStoreList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectStoreList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/Switch.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/Switch_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBar.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBar_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButton.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButton_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButtonSetter.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View3_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View-demo.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.URLProperty", dojo.moduleUrl("dojox.mobile", "tests/doh/TestURLProp.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.URLProperty", dojo.moduleUrl("dojox.mobile", "tests/doh/TestURLProp2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.SpinWheel", dojo.moduleUrl("dojox.mobile", "tests/doh/SpinWheel_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.SpinWheelDatePicker", dojo.moduleUrl("dojox.mobile", "tests/doh/SpinWheelDatePicker.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ValuePickerDatePicker", dojo.moduleUrl("dojox.mobile", "tests/doh/ValuePickerDatePicker.html"),999999);

	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/ButtonTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.CheckBox", dojo.moduleUrl("dojox.mobile", "tests/doh/CheckBoxTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ComboBoxTests", dojo.moduleUrl("dojox.mobile", "tests/doh/ComboBoxTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.ContentPane", dojo.moduleUrl("dojox.mobile", "tests/doh/ContentPaneTests.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataListTests.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeCategory", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeCategoryTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ExpandingTextArea", dojo.moduleUrl("dojox.mobile", "tests/doh/ExpandingTextAreaTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests3.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/HeadingTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainerTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItemTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItemTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests3.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataListTests.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.RadioButton", dojo.moduleUrl("dojox.mobile", "tests/doh/RadioButtonTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TextArea", dojo.moduleUrl("dojox.mobile", "tests/doh/TextAreaTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TextBox", dojo.moduleUrl("dojox.mobile", "tests/doh/TextBoxTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBarTests.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests3.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.Slider", dojo.moduleUrl("dojox.mobile", "tests/doh/SliderTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/SwitchTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.FilteredListTests", dojo.moduleUrl("dojox.mobile", "tests/doh/FilteredListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.MBLCSS3TransitionTests", dojo.moduleUrl("dojox.mobile", "tests/doh/MBLCSS3TransitionTests.html"),999999);
}catch(e){
	doh.debug(e);
}

<commit_msg>refs #14088. Fix test ref. Thanks Sebastien Brunot (IBM, CCLA).<commit_after>dojo.provide("dojox.mobile.tests.doh.module");

try{
	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/Button.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/Button_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.DatePickerIso", dojo.moduleUrl("dojox.mobile", "tests/doh/DatePickerIso.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeCategory", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeCategory.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeStoreList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeStoreList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/Heading2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer3.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainer_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/View.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItem2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Progress-indicator", dojo.moduleUrl("dojox.mobile", "tests/doh/progress-indicator.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRect", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRect", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRect_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectStoreList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectStoreList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectStoreList_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectList.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/Switch.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/Switch_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBar.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBar_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButton.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButton_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ToolBarButton", dojo.moduleUrl("dojox.mobile", "tests/doh/ToolBarButtonSetter.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View2_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View3_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.View", dojo.moduleUrl("dojox.mobile", "tests/doh/View-demo.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.URLProperty", dojo.moduleUrl("dojox.mobile", "tests/doh/TestURLProp.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.URLProperty", dojo.moduleUrl("dojox.mobile", "tests/doh/TestURLProp2.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.SpinWheel", dojo.moduleUrl("dojox.mobile", "tests/doh/SpinWheel_Programmatic.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.SpinWheelDatePicker", dojo.moduleUrl("dojox.mobile", "tests/doh/SpinWheelDatePicker.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ValuePickerDatePicker", dojo.moduleUrl("dojox.mobile", "tests/doh/ValuePickerDatePicker.html"),999999);

	doh.registerUrl("dojox.mobile.tests.doh.Button", dojo.moduleUrl("dojox.mobile", "tests/doh/ButtonTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.CheckBox", dojo.moduleUrl("dojox.mobile", "tests/doh/CheckBoxTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ComboBoxTests", dojo.moduleUrl("dojox.mobile", "tests/doh/ComboBoxTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.ContentPane", dojo.moduleUrl("dojox.mobile", "tests/doh/ContentPaneTests.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeDataListTests.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeCategory", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeCategoryTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.EdgeToEdgeList", dojo.moduleUrl("dojox.mobile", "tests/doh/EdgeToEdgeListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.ExpandingTextArea", dojo.moduleUrl("dojox.mobile", "tests/doh/ExpandingTextAreaTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.FixedSplitter", dojo.moduleUrl("dojox.mobile", "tests/doh/FixedSplitterTests3.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.Heading", dojo.moduleUrl("dojox.mobile", "tests/doh/HeadingTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.IconContainer", dojo.moduleUrl("dojox.mobile", "tests/doh/IconContainerTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItemTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.ListItem", dojo.moduleUrl("dojox.mobile", "tests/doh/ListItemTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.PageIndicator", dojo.moduleUrl("dojox.mobile", "tests/doh/PageIndicatorTests3.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.RoundRectDataList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectDataListTests.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.RadioButton", dojo.moduleUrl("dojox.mobile", "tests/doh/RadioButtonTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.RoundRectList", dojo.moduleUrl("dojox.mobile", "tests/doh/RoundRectListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TextArea", dojo.moduleUrl("dojox.mobile", "tests/doh/TextAreaTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.TextBox", dojo.moduleUrl("dojox.mobile", "tests/doh/TextBoxTests.html"),999999);
	if(!dojo.isIE){
		doh.registerUrl("dojox.mobile.tests.doh.TabBar", dojo.moduleUrl("dojox.mobile", "tests/doh/TabBarTests.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests1.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests2.html"),999999);
		doh.registerUrl("dojox.mobile.tests.doh.SwapView", dojo.moduleUrl("dojox.mobile", "tests/doh/SwapViewTests3.html"),999999);
	}
	doh.registerUrl("dojox.mobile.tests.doh.Slider", dojo.moduleUrl("dojox.mobile", "tests/doh/SliderTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.Switch", dojo.moduleUrl("dojox.mobile", "tests/doh/SwitchTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.FilteredListTests", dojo.moduleUrl("dojox.mobile", "tests/doh/FilteredListTests.html"),999999);
	doh.registerUrl("dojox.mobile.tests.doh.MblCSS3TransitionTests", dojo.moduleUrl("dojox.mobile", "tests/doh/MBLCSS3TransitionTests.html"),999999);
}catch(e){
	doh.debug(e);
}

<|endoftext|>


<commit_before>const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
const es = require('event-stream');
const print = require('gulp-print');

const bowerFiles = require('main-bower-files');
const bowerFilesManual = [
    'bower_components/socket.io-client/dist/socket.io.slim.min.js'
];

let devMode = process.env.RPNOW_PRODUCTION !== 'production';

const paths = {
    scripts: './app/**/*.js',
    cssStyles: './app/**/*.css',
    sassStyles: './app/**/*.scss',
    assets: './app/assets/**/*',
    index: './app/index.html',
    partials: ['./app/**/*.html', '!./app/index.html'],
    mdPartials: './app/**/*.md',
    assets: ['./app/**/*.*', '!./**/*.html', '!./**/*.css', '!./**/*.scss', '!./**/*.js', '!./**/*.md'],
    distDev: './dist.dev',
    distProd: './dist.prod',
    distVendorDev: './dist.dev/vendor',
    distScriptsProd: './dist.prod/scripts',
    distStylesProd: './dist.prod/styles'
};

let pipes = {};

pipes.orderedVendorScripts = () => plugins.order(['jquery.js', 'angular.js'])
pipes.orderedAppScripts = () => plugins.angularFilesort()

pipes.minifiedFileName = () => plugins.rename(path=>path.extname = '.min' + path.extname)

pipes.mdToHtmlPartials = () => gulp.src(paths.mdPartials)
    .pipe(plugins.markdown())
    .pipe(plugins.rename(path=>path.extname = '.html'))

pipes.partials = () =>
    es.merge(gulp.src(paths.partials), pipes.mdToHtmlPartials())

pipes.validatedPartials = () => pipes.partials()
    // .pipe(plugins.htmlhint({'doctype-first': false}))
    // .pipe(plugins.htmlhint.reporter())

pipes.builtPartialsDev = () => pipes.validatedPartials()
    .pipe(gulp.dest(paths.distDev))

pipes.scriptedPartials = () => pipes.validatedPartials()
    // .pipe(plugins.htmlhint.failReporter())
    .pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
    .pipe(plugins.ngHtml2js({moduleName: "rpnow", prefix: "/", declareModule: false}))

pipes.validatedAppScripts = () => gulp.src(paths.scripts)
    .pipe(plugins.babel({ presets: ['env'] }))
    // .pipe(plugins.jshint())
    // .pipe(plugins.jshint.reporter('jshint-stylish'))

pipes.builtAppScriptsDev = () => pipes.validatedAppScripts()
    .pipe(gulp.dest(paths.distDev))

pipes.builtAppScriptsProd = () =>
    es.merge(pipes.scriptedPartials(), pipes.validatedAppScripts())
    .pipe(pipes.orderedAppScripts())
    .pipe(plugins.concat('app.min.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest(paths.distScriptsProd))

pipes.appStyles = () =>
    es.merge(
        gulp.src(paths.cssStyles),
        gulp.src(paths.sassStyles).pipe(plugins.sass())
    )

pipes.builtAppStylesDev = () => pipes.appStyles()
    .pipe(gulp.dest(paths.distDev))

pipes.builtAppStylesProd = () => pipes.appStyles()
    .pipe(plugins.minifyCss())
    .pipe(plugins.concat('app.min.css'))
    .pipe(gulp.dest(paths.distStylesProd));

pipes.vendorScripts = () => gulp.src([...bowerFiles('**/*.js'), ...bowerFilesManual])

pipes.builtVendorScriptsDev = () => pipes.vendorScripts()
    .pipe(gulp.dest(paths.distVendorDev))

pipes.builtVendorScriptsProd = () => pipes.vendorScripts()
    .pipe(pipes.orderedVendorScripts())
    .pipe(plugins.concat('vendor.min.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest(paths.distScriptsProd))

pipes.vendorStyles = () => gulp.src(bowerFiles('**/*.css'))

pipes.builtVendorStylesDev = () =>  pipes.vendorStyles()
    .pipe(gulp.dest(paths.distVendorDev))

pipes.builtVendorStylesProd = () => pipes.vendorStyles()
    .pipe(plugins.minifyCss())
    .pipe(plugins.concat('vendor.min.css'))
    .pipe(gulp.dest(paths.distStylesProd));

pipes.validatedIndex = () => gulp.src(paths.index)
    // .pipe(plugins.htmlhint())
    // .pipe(plugins.htmlhint.reporter())

pipes.builtIndexDev = () => pipes.validatedIndex()
    .pipe(gulp.dest(paths.distDev)) // write first to get relative path for inject
    .pipe(plugins.inject(
        pipes.builtVendorScriptsDev().pipe(pipes.orderedVendorScripts()),
        {relative: true, name: 'bower'}))
    .pipe(plugins.inject(
        pipes.builtAppScriptsDev().pipe(pipes.orderedAppScripts()),
        {relative: true}))
    .pipe(plugins.inject(pipes.builtAppStylesDev(), {relative: true}))
    .pipe(plugins.inject(pipes.builtVendorStylesDev(), {relative: true, name:'bower'}))
    .pipe(gulp.dest(paths.distDev))

pipes.builtIndexProd = () => pipes.validatedIndex()
    .pipe(gulp.dest(paths.distProd)) // write first to get relative path for inject
    .pipe(plugins.inject(pipes.builtVendorScriptsProd(), {relative: true, name: 'bower'}))
    .pipe(plugins.inject(pipes.builtAppScriptsProd(), {relative: true}))
    .pipe(plugins.inject(pipes.builtVendorStylesProd(), {relative: true, name: 'bower'}))
    .pipe(plugins.inject(pipes.builtAppStylesProd(), {relative: true}))
    .pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
    .pipe(gulp.dest(paths.distProd))

pipes.assetsDev = () => gulp.src(paths.assets)
    .pipe(gulp.dest(paths.distDev))

pipes.assetsProd = () => gulp.src(paths.assets)
    .pipe(gulp.dest(paths.distProd))

pipes.builtAppDev = () => es.merge(
    pipes.builtIndexDev(),
    pipes.builtPartialsDev(),
    pipes.assetsDev()
)

pipes.builtAppProd = () => es.merge(
    pipes.builtIndexProd(),
    pipes.assetsProd()
)

// builds a complete dev environment
gulp.task('build-dev', pipes.builtAppDev);

// builds a complete prod environment
gulp.task('build-prod', pipes.builtAppProd);

// clean, build, and watch live changes to the dev environment
gulp.task('watch-dev', ['build-dev'], function() {
    [
        [paths.index, pipes.builtIndexDev],
        [paths.scripts, pipes.builtAppScriptsDev],
        [paths.partials, pipes.builtPartialsDev],
        [paths.cssStyles, pipes.builtAppStylesDev],
        [paths.sassStyles, pipes.builtAppStylesDev]
    ]
        .forEach(([path, pipe]) => gulp.watch(path, pipe))
});

// clean, build, and watch live changes to the prod environment
gulp.task('watch-prod', ['build-prod'], function() {
    [
        [paths.index, pipes.builtIndexProd],
        [paths.scripts, pipes.builtAppScriptsProd],
        [paths.partials, pipes.builtAppScriptsProd],
        [paths.cssStyles, pipes.builtAppStylesProd],
        [paths.sassStyles, pipes.builtAppStylesProd]
    ]
        .forEach(([path, pipe]) => gulp.watch(path, pipe))
});
<commit_msg>Make sure everything is watched in the new gulpfile<commit_after>const gulp = require('gulp');
const plugins = require('gulp-load-plugins')();
const es = require('event-stream');
const print = require('gulp-print');

const bowerFiles = require('main-bower-files');
const bowerFilesManual = [
    'bower_components/socket.io-client/dist/socket.io.slim.min.js'
];

let devMode = process.env.RPNOW_PRODUCTION !== 'production';

const paths = {
    index: './app/index.html',
    scripts: './app/**/*.js',
    partials: ['./app/**/*.html', '!./app/index.html'],
    mdPartials: './app/**/*.md',
    cssStyles: './app/**/*.css',
    sassStyles: './app/**/*.scss',
    assets: ['./app/**/*.*', '!./**/*.html', '!./**/*.css', '!./**/*.scss', '!./**/*.js', '!./**/*.md'],
    distDev: './dist.dev',
    distProd: './dist.prod',
    distVendorDev: './dist.dev/vendor',
    distScriptsProd: './dist.prod/scripts',
    distStylesProd: './dist.prod/styles'
};

let pipes = {};

pipes.orderedVendorScripts = () => plugins.order(['jquery.js', 'angular.js'])
pipes.orderedAppScripts = () => plugins.angularFilesort()

pipes.minifiedFileName = () => plugins.rename(path=>path.extname = '.min' + path.extname)

pipes.mdToHtmlPartials = () => gulp.src(paths.mdPartials)
    .pipe(plugins.markdown())
    .pipe(plugins.rename(path=>path.extname = '.html'))

pipes.partials = () =>
    es.merge(gulp.src(paths.partials), pipes.mdToHtmlPartials())

pipes.validatedPartials = () => pipes.partials()
    // .pipe(plugins.htmlhint({'doctype-first': false}))
    // .pipe(plugins.htmlhint.reporter())

pipes.builtPartialsDev = () => pipes.validatedPartials()
    .pipe(gulp.dest(paths.distDev))

pipes.scriptedPartials = () => pipes.validatedPartials()
    // .pipe(plugins.htmlhint.failReporter())
    .pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
    .pipe(plugins.ngHtml2js({moduleName: "rpnow", prefix: "/", declareModule: false}))

pipes.validatedAppScripts = () => gulp.src(paths.scripts)
    .pipe(plugins.babel({ presets: ['env'] }))
    // .pipe(plugins.jshint())
    // .pipe(plugins.jshint.reporter('jshint-stylish'))

pipes.builtAppScriptsDev = () => pipes.validatedAppScripts()
    .pipe(gulp.dest(paths.distDev))

pipes.builtAppScriptsProd = () =>
    es.merge(pipes.scriptedPartials(), pipes.validatedAppScripts())
    .pipe(pipes.orderedAppScripts())
    .pipe(plugins.concat('app.min.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest(paths.distScriptsProd))

pipes.appStyles = () =>
    es.merge(
        gulp.src(paths.cssStyles),
        gulp.src(paths.sassStyles).pipe(plugins.sass())
    )

pipes.builtAppStylesDev = () => pipes.appStyles()
    .pipe(gulp.dest(paths.distDev))

pipes.builtAppStylesProd = () => pipes.appStyles()
    .pipe(plugins.minifyCss())
    .pipe(plugins.concat('app.min.css'))
    .pipe(gulp.dest(paths.distStylesProd));

pipes.vendorScripts = () => gulp.src([...bowerFiles('**/*.js'), ...bowerFilesManual])

pipes.builtVendorScriptsDev = () => pipes.vendorScripts()
    .pipe(gulp.dest(paths.distVendorDev))

pipes.builtVendorScriptsProd = () => pipes.vendorScripts()
    .pipe(pipes.orderedVendorScripts())
    .pipe(plugins.concat('vendor.min.js'))
    .pipe(plugins.uglify())
    .pipe(gulp.dest(paths.distScriptsProd))

pipes.vendorStyles = () => gulp.src(bowerFiles('**/*.css'))

pipes.builtVendorStylesDev = () =>  pipes.vendorStyles()
    .pipe(gulp.dest(paths.distVendorDev))

pipes.builtVendorStylesProd = () => pipes.vendorStyles()
    .pipe(plugins.minifyCss())
    .pipe(plugins.concat('vendor.min.css'))
    .pipe(gulp.dest(paths.distStylesProd));

pipes.validatedIndex = () => gulp.src(paths.index)
    // .pipe(plugins.htmlhint())
    // .pipe(plugins.htmlhint.reporter())

pipes.builtIndexDev = () => pipes.validatedIndex()
    .pipe(gulp.dest(paths.distDev)) // write first to get relative path for inject
    .pipe(plugins.inject(
        pipes.builtVendorScriptsDev().pipe(pipes.orderedVendorScripts()),
        {relative: true, name: 'bower'}))
    .pipe(plugins.inject(
        pipes.builtAppScriptsDev().pipe(pipes.orderedAppScripts()),
        {relative: true}))
    .pipe(plugins.inject(pipes.builtAppStylesDev(), {relative: true}))
    .pipe(plugins.inject(pipes.builtVendorStylesDev(), {relative: true, name:'bower'}))
    .pipe(gulp.dest(paths.distDev))

pipes.builtIndexProd = () => pipes.validatedIndex()
    .pipe(gulp.dest(paths.distProd)) // write first to get relative path for inject
    .pipe(plugins.inject(pipes.builtVendorScriptsProd(), {relative: true, name: 'bower'}))
    .pipe(plugins.inject(pipes.builtAppScriptsProd(), {relative: true}))
    .pipe(plugins.inject(pipes.builtVendorStylesProd(), {relative: true, name: 'bower'}))
    .pipe(plugins.inject(pipes.builtAppStylesProd(), {relative: true}))
    .pipe(plugins.htmlmin({collapseWhitespace: true, removeComments: true}))
    .pipe(gulp.dest(paths.distProd))

pipes.assetsDev = () => gulp.src(paths.assets)
    .pipe(gulp.dest(paths.distDev))

pipes.assetsProd = () => gulp.src(paths.assets)
    .pipe(gulp.dest(paths.distProd))

pipes.builtAppDev = () => es.merge(
    pipes.builtIndexDev(),
    pipes.builtPartialsDev(),
    pipes.assetsDev()
)

pipes.builtAppProd = () => es.merge(
    pipes.builtIndexProd(),
    pipes.assetsProd()
)

// builds a complete dev environment
gulp.task('build-dev', pipes.builtAppDev);

// builds a complete prod environment
gulp.task('build-prod', pipes.builtAppProd);

// clean, build, and watch live changes to the dev environment
gulp.task('watch-dev', ['build-dev'], function() {
    [
        [paths.index, pipes.builtIndexDev],
        [paths.scripts, pipes.builtAppScriptsDev],
        [paths.partials, pipes.builtPartialsDev],
        [paths.mdPartials, pipes.builtPartialsDev],
        [paths.cssStyles, pipes.builtAppStylesDev],
        [paths.sassStyles, pipes.builtAppStylesDev],
        [paths.assets, pipes.assetsDev]
    ]
        .forEach(([path, pipe]) => gulp.watch(path, pipe))
});

// clean, build, and watch live changes to the prod environment
gulp.task('watch-prod', ['build-prod'], function() {
    [
        [paths.index, pipes.builtIndexProd],
        [paths.scripts, pipes.builtAppScriptsProd],
        [paths.partials, pipes.builtAppScriptsProd],
        [paths.mdPartials, pipes.builtAppScriptsProd],
        [paths.cssStyles, pipes.builtAppStylesProd],
        [paths.sassStyles, pipes.builtAppStylesProd],
        [paths.assets, pipes.assetsProd]
    ]
        .forEach(([path, pipe]) => gulp.watch(path, pipe))
});
<|endoftext|>


<commit_before>// Include JSON parser
Titanium.include('json2.js');

//Include app header
//Titanium.include('header.js');

//Construct main content views
//Titanium.include('json2.js'); // Creates a 'chooser' view we manipulate in the main app

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

var actInd = Titanium.UI.createActivityIndicator({
	top:10,
	height:50,
	width:10,
	color:'#000000',
	style:Titanium.UI.iPhone.ActivityIndicatorStyle.DARK
});

function displayResults(result) {

}

function getResults(term, nearby) {
	actInd.show();
	try {
		var xhr = Titanium.Network.createHTTPClient();

		if (nearby == true) {
			Titanium.API.debug("GETTING NEARBY");

			Titanium.Geolocation.getCurrentPosition(
			  function(pos) {
			    // what to do if getCurrentPosition was successful
			    // `pos` will be the object shown above in "Returns"
				nearbyUrl = 'http://openottawa.org/api/fsi/nearby.php?lat='+pos.coords.latitude+"&lon="+pos.coords.longitude;
				Titanium.API.debug(nearbyUrl);
				xhr.open('GET', nearbyUrl);
				xhr.send();
				Titanium.API.debug("Got coords - " + pos.coords.latitude + ", " + pos.coords.longitude);
			  },
			  function() {
			    // what to do if getCurrentPosition failed
				alert("Couldn't get location - do plain search instead");
			  }
			);

		} else {
			xhr.open('GET','http://openottawa.org/api/fsi/all.php');
			Titanium.API.debug("getting ALL");
		}

		xhr.onload = function() {
	        //do work on "this.responseXML"
			Titanium.API.debug("Success - got "+ this.responseText);

			// parse data back into magic
			//responseData = JSON.parse(text, function (key, value) {
			//   var type;
			//    if (value && typeof value === 'object') {
			//        type = value.type;
			//        if (typeof type === 'string' && typeof window[type] === 'function') {
			//            return new (window[type])(value);
			//        }
			//    }
			//    return value;
			//});
			actInd.hide();
	    };

	}
	catch(err) {
	    Titanium.UI.createAlertDialog({
	        title: "Error",
	        message: String(err),
	        buttonNames: ['OK']
	    }).show();
		actInd.message = null;
		actInd.hide();
	}
}

// create tab group
var tabGroup = Titanium.UI.createTabGroup();

//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
    title:'Eat Safe Ottawa',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
    icon:'KS_nav_views.png',
    title:'Places',
    window:win1
});

var refresh = Titanium.UI.createButton({
	systemButton:Titanium.UI.iPhone.SystemButton.REFRESH
});

refresh.addEventListener('click', function()
{
	getResults(search.value, true)
	Titanium.API.debug("refresh location + nearby");
});

win1.barColor = '#0071ce';

//
// CREATE SEARCH BAR
//
var search = Titanium.UI.createSearchBar({
	barColor:'#0071ce',
	showCancel:false
});
search.addEventListener('change', function(e)
{
   e.value // search string as user types
});

search.addEventListener('return', function(e)
{
   getResults(e.value, false);
   search.blur();
});
search.addEventListener('cancel', function(e)
{
   search.blur();
});

var tableView;
var data = [
	{title:'1 FOR 1 PIZZA', hasDetail:true, id:'123', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Royal Thai', hasDetail:true, id:'456', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Sante Restaurant', hasDetail:true, id:'789', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Royal Oak', hasDetail:true, id:'101112', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'}
];

/*
// create the rest of the rows
for (var c=1;c<50;c++)
{
	var row = Ti.UI.createTableViewRow();
	row.selectedBackgroundColor = '#fff';
	row.height = 50;
	row.className = 'datarow';

	var user = Ti.UI.createLabel({
		color:'#000',
		font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica Neue'},
		left:10,
		top:5,
		height:20,
		width:200,
		text:'1 FOR '+c+' PIZZA '
	});

	row.addEventListener('click', function(e)
	{
		// use rowNum property on object to get row number
		var rowNum = e.source.rowNum;
		updateRowText.text = 'You clicked on the user';
		// TODO: FIX UPDATE ROW
		//tableView.updateRow(rowNum,updateRow,{animationStyle:Titanium.UI.iPhone.RowAnimationStyle.LEFT});
	});

	row.filter = user.text;

	user.rowNum = c;
	row.add(user);

	var address = Ti.UI.createLabel({
		color:'#222',
		font:{fontSize:14,fontWeight:'normal', fontFamily:'Arial'},
		left:10,
		top:22,
		height:20,
		width:200,
		text:'1234 Bank St.'
	});

	address.addEventListener('click', function(e)
	{
		// use rowNum property on object to get row number
		var rowNum = e.source.rowNum;
		updateRowText.text = 'You clicked on the comment';

		// TODO: FIX UPDATE ROW
		//tableView.updateRow(rowNum,updateRow,{animationStyle:Titanium.UI.iPhone.RowAnimationStyle.LEFT});
	});

	address.rowNum = c;
	row.add(address);
    data.push(row);
}

*/
//
// create table view (
//
tableView = Titanium.UI.createTableView({
	data:data,
	search:search,
	filterAttribute:'filter'
});

// create table view event listener
tableView.addEventListener('click', function(e)
{
	// event data
	var index = e.index;
	var section = e.section;
	var row = e.row;
	var rowdata = e.rowData;

	// custom property
	var id = e.rowData.id;
	var address = e.rowData.address;
	var city = e.rowData.city;
	var phone = e.rowData.phone;

	//
		// create window with right nav button
		//
		var detail = Titanium.UI.createWindow({
			backgroundColor:'#13386c',
			barColor:'#336699',
			translucent:true,
		});

		var detailview = Titanium.UI.createView({backgroundColor:'yellow'});

		// Restaurant Label
		var detailTitle = Ti.UI.createLabel({
		color:'#000',
		font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica Neue'},
		left:10,
		top:5,
		height:20,
		width:200,
		text:e.rowData.title
		});

		//Details
		var detailAddress = Ti.UI.createLabel({
			color:'#222',
			font:{fontSize:14,fontWeight:'normal', fontFamily:'Arial'},
			left:10,
			top:22,
			height:20,
			width:200,
			text:address
		});
		detailview.add(detailTitle);
		detailview.add(detailAddress);

		//List report details

		detail.add(detailview);
		actInd.show();
		tab1.open(detail,{animated:true});
		actInd.hide();

	Titanium.UI.createAlertDialog({title:'Table View',message:'custom value ' + id}).show();
});

//init();
win1.add(actInd);
win1.add(tableView);
win1.setRightNavButton(refresh);

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
    title:'About',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
    icon:'KS_nav_ui.png',
    title:'About',
    window:win2
});

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'}
});

win2.add(label2);

//
//  add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

// open tab group
tabGroup.open();

if (!Titanium.Network.online) {
  var a = Titanium.UI.createAlertDialog({
    title:'Network Connection Required',
    message: 'EatSafeOttawa requires an internet connection to, you know, get stuff from the internet.  Check your network connection and try again.'
  });
	a.show();
}
// Fetch initial results
getResults('pizza',true);

<commit_msg>added detail view<commit_after>// Include JSON parser
Titanium.include('json2.js');

//Include app header
//Titanium.include('header.js');

//Construct main content views
//Titanium.include('json2.js'); // Creates a 'chooser' view we manipulate in the main app

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

var actInd = Titanium.UI.createActivityIndicator({
	top:10,
	height:50,
	width:10,
	color:'#000000',
	style:Titanium.UI.iPhone.ActivityIndicatorStyle.DARK
});

function displayResults(result) {

}

function getResults(term, nearby) {
	actInd.show();
	try {
		var xhr = Titanium.Network.createHTTPClient();

		if (nearby == true) {
			Titanium.API.debug("GETTING NEARBY");

			Titanium.Geolocation.getCurrentPosition(
			  function(pos) {
			    // what to do if getCurrentPosition was successful
			    // `pos` will be the object shown above in "Returns"
				nearbyUrl = 'http://openottawa.org/api/fsi/nearby.php?lat='+pos.coords.latitude+"&lon="+pos.coords.longitude;
				Titanium.API.debug(nearbyUrl);
				xhr.open('GET', nearbyUrl);
				xhr.send();
				Titanium.API.debug("Got coords - " + pos.coords.latitude + ", " + pos.coords.longitude);
			  },
			  function() {
			    // what to do if getCurrentPosition failed
				alert("Couldn't get location - do plain search instead");
			  }
			);

		} else {
			xhr.open('GET','http://openottawa.org/api/fsi/nearby.php');
			Titanium.API.debug("getting ALL");
		}

		xhr.onload = function() {
	        //do work on "this.responseXML"
			Titanium.API.debug("Success - got "+ this.responseText);

			// parse data back into magic
			//responseData = JSON.parse(text, function (key, value) {
			//   var type;
			//    if (value && typeof value === 'object') {
			//        type = value.type;
			//        if (typeof type === 'string' && typeof window[type] === 'function') {
			//            return new (window[type])(value);
			//        }
			//    }
			//    return value;
			//});
			actInd.hide();
	    };

	}
	catch(err) {
	    Titanium.UI.createAlertDialog({
	        title: "Error",
	        message: String(err),
	        buttonNames: ['OK']
	    }).show();
		actInd.message = null;
		actInd.hide();
	}
}

// create tab group
var tabGroup = Titanium.UI.createTabGroup();

//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
    title:'Eat Safe Ottawa',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
    icon:'KS_nav_views.png',
    title:'Places',
    window:win1
});

var refresh = Titanium.UI.createButton({
	systemButton:Titanium.UI.iPhone.SystemButton.REFRESH
});

win1.barColor = '#0071ce';

//
// CREATE SEARCH BAR
//
var search = Titanium.UI.createSearchBar({
	barColor:'#0071ce',
	showCancel:false
});

refresh.addEventListener('click', function()
{
	getResults('pizza', true);
	Titanium.API.debug("refresh location + nearby");
});

search.addEventListener('change', function(e)
{
   e.value // search string as user types
});

search.addEventListener('return', function(e)
{
   getResults(e.value, false);
   search.blur();
});
search.addEventListener('cancel', function(e)
{
   search.blur();
});

var tableView;
var data = [
	{title:'1 FOR 1 PIZZA', hasDetail:true, id:'123', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Royal Thai', hasDetail:true, id:'456', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Sante Restaurant', hasDetail:true, id:'789', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'},
	{title:'Royal Oak', hasDetail:true, id:'101112', address:'1415 Bank St.', city:'Ottawa',phone:'613-555-1212'}
];

/*
// create the rest of the rows
for (var c=1;c<50;c++)
{
	var row = Ti.UI.createTableViewRow();
	row.selectedBackgroundColor = '#fff';
	row.height = 50;
	row.className = 'datarow';

	var user = Ti.UI.createLabel({
		color:'#000',
		font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica Neue'},
		left:10,
		top:5,
		height:20,
		width:200,
		text:'1 FOR '+c+' PIZZA '
	});

	row.addEventListener('click', function(e)
	{
		// use rowNum property on object to get row number
		var rowNum = e.source.rowNum;
		updateRowText.text = 'You clicked on the user';
		// TODO: FIX UPDATE ROW
		//tableView.updateRow(rowNum,updateRow,{animationStyle:Titanium.UI.iPhone.RowAnimationStyle.LEFT});
	});

	row.filter = user.text;

	user.rowNum = c;
	row.add(user);

	var address = Ti.UI.createLabel({
		color:'#222',
		font:{fontSize:14,fontWeight:'normal', fontFamily:'Arial'},
		left:10,
		top:22,
		height:20,
		width:200,
		text:'1234 Bank St.'
	});

	address.addEventListener('click', function(e)
	{
		// use rowNum property on object to get row number
		var rowNum = e.source.rowNum;
		updateRowText.text = 'You clicked on the comment';

		// TODO: FIX UPDATE ROW
		//tableView.updateRow(rowNum,updateRow,{animationStyle:Titanium.UI.iPhone.RowAnimationStyle.LEFT});
	});

	address.rowNum = c;
	row.add(address);
    data.push(row);
}

*/
//
// create table view (
//
tableView = Titanium.UI.createTableView({
	data:data,
	search:search,
	filterAttribute:'title'
});

// create table view event listener
tableView.addEventListener('click', function(e)
{
	// event data
	var index = e.index;
	var section = e.section;
	var row = e.row;
	var rowdata = e.rowData;

	// custom property
	var id = e.rowData.id;
	var address = e.rowData.address;
	var city = e.rowData.city;
	var phone = e.rowData.phone;

	//
		// create window with right nav button
		//
		var detail = Titanium.UI.createWindow({
			backgroundColor:'#13386c',
			barColor:'#336699',
			translucent:true
		});

		var detailview = Titanium.UI.createView({backgroundColor:'#000'});

		// Restaurant Label
		var detailTitle = Titanium.UI.createLabel({
		color:'#fff',
		font:{fontSize:16,fontWeight:'bold', fontFamily:'Helvetica'},
		left:10,
		top:5,
		height:20,
		width:200,
		text:'TITLE'
		});

		//Details
		var detailAddress = Titanium.UI.createLabel({
			color:'#fff',
			font:{fontSize:14,fontWeight:'normal', fontFamily:'Helvetica'},
			left:10,
			top:22,
			height:20,
			width:200,
			text:'Address Field'
		});

		var curWin = Titanium.UI.currentWindow;

		detail.add(detailview);

		//actInd.show();
		tab1.open(detail,{animated:true});
		detail.add(detailTitle);
		detail.add(detailAddress);
		alert("phone is "+ phone);
		//actInd.hide();

	//Titanium.UI.createAlertDialog({title:'Table View',message:'custom value ' + id}).show();
});

//init();
win1.add(actInd);
win1.add(tableView);
win1.setRightNavButton(refresh);

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
    title:'About',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
    icon:'KS_nav_ui.png',
    title:'About',
    window:win2
});

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'}
});

win2.add(label2);

//
//  add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

// open tab group
tabGroup.open();

if (!Titanium.Network.online) {
  var a = Titanium.UI.createAlertDialog({
    title:'Network Connection Required',
    message: 'EatSafeOttawa requires an internet connection to, you know, get stuff from the internet.  Check your network connection and try again.'
  });
	a.show();
}
// Fetch initial results
getResults('pizza',true);

<|endoftext|>


<commit_before>import React from 'react';
import { Route, IndexRoute } from 'react-router';

import App from './containers/App';
import Home from './containers/Home';
import Entry from './containers/Entry';
import About from './containers/About';
import NotFound from './containers/NotFound';

import Login from './containers/Login';
import LoginSuccess from './containers/LoginSuccess';
import Member from './containers/Member';

export default ({ dispatch, getState }) => {
  	const checkAuth = (nextState, replace, callback) => {
    	const { member: { auth } } = getState();
  		if (!auth) {
    		replace('/login');
  		}
  		callback();
  	};

  	return (
		<Route path="/" component={App}>
			<IndexRoute component={Home} />
			<Route path="about" component={About} />
			<Route path="articles/:id" component={Entry} />
	      	<Route path="login" component={Login}/>
			<Route onEnter={checkAuth}>
		        <Route path="member" component={Member}/>
		        <Route path="loginSuccess" component={LoginSuccess}/>
	      	</Route>
			<Route path="*" component={NotFound} status={404} />
		</Route>
	);
};<commit_msg>config routes in object styles<commit_after>import React from 'react';
import { Route, IndexRoute } from 'react-router';

import App from './containers/App';
import Home from './containers/Home';
import Entry from './containers/Entry';
import About from './containers/About';
import NotFound from './containers/NotFound';

import Login from './containers/Login';
import LoginSuccess from './containers/LoginSuccess';
import Member from './containers/Member';

export default ({ dispatch, getState }) => {
  	const checkAuth = (nextState, replace, callback) => {
    	const { member: { auth } } = getState();
  		if (!auth) {
    		replace('/login');
  		}
  		callback();
  	};

    //  return (
	// 	<Route path="/" component={App}>
	// 		<IndexRoute component={Home} />
	// 		<Route path="about" component={About} />
	// 		<Route path="articles/:id" component={Entry} />
	//      <Route path="login" component={Login}/>
	// 		<Route onEnter={checkAuth}>
	// 	        <Route path="member" component={Member}/>
	// 	        <Route path="loginSuccess" component={LoginSuccess}/>
	//      </Route>
	// 		<Route path="*" component={NotFound} status={404} />
	// 	</Route>
	// );

	return {
  		component: 'div',
	  	childRoutes: [
	  		{
			    path: '/',
			    component: App,
			    indexRoute: {
		      		component: Home
      			},
			    childRoutes: [
			      	{
			      		path: 'about',
			      		component: About
				    }, {
			      		path: 'login',
			      		component: Login
				    }, {
			      		path: 'articles/:id',
			      		component: Entry
				    }, {
				    	onEnter: checkAuth,
				    	childRoutes: [
							{
					      		path: 'member',
					      		component: Member
						    }, {
					      		path: 'loginSuccess',
					      		component: Login
						    }
				    	]
				    }, {
			      		path: '*',
			      		component: NotFound,
			      		status: 404
				    }
			    ]
	  		}
  		]
	}
};<|endoftext|>


<commit_before>exports.BattleAbilities = {
 	"drunkenfist": {
   		desc: "If a contact move knocks out this Pokemon, the opponent receives damage equal to one-fourth of its max HP.",
		shortDesc: "If this Pokemon is KOed with a contact move, that move's user loses 1/4 its max HP.",
		id: "drunkenfist",
		name: "Drunken Fist",
		onStart: function(pokemon) {
			this.add('-message', 'The effects of weather disappeared. (placeholder)');
		},
		onStart: function(pokemon) {
			pokemon.addVolatile('confusion');
			 this.boost({spa:2});
			 this.boost({atk:2});
			}
		},
		rating: 3,
		num: -8
	},
	"objection": {
		desc: "This Pokémon avoids all Rock-type attacks and hazards when switching in.",
		shortDesc: "On switch-in, this Pokemon avoids all Rock-type attacks and Stealth Rock.",
		onStart: function(pokemon) {
		         this.add('-message', pokemon.name + " objectified the normal type move!");
		},
		onImmunity: function(type, target) {
			if (type === 'Normal' && !target.activeTurns) {
				return false;
			}
		},
		id: "objection",
		name: "OBJECTION",
		rating: 3.5,
		num: -9
    	}
};
<commit_msg>Update abilities.js<commit_after>exports.BattleAbilities = {
 	"drunkenfist": {
   		desc: "If a contact move knocks out this Pokemon, the opponent receives damage equal to one-fourth of its max HP.",
		shortDesc: "If this Pokemon is KOed with a contact move, that move's user loses 1/4 its max HP.",
		id: "drunkenfist",
		name: "Drunken Fist",
		onStart: function(pokemon) {
			this.add('-message', 'The effects of weather disappeared. (placeholder)');
		},
		onStart: function(pokemon) {
			pokemon.addVolatile('confusion');
			 this.boost({spa:2});
			 this.boost({atk:2});
			}
		},
		id: "drunkenfist",
		name: "Drunken Fist",
		rating: 3,
		num: -8
	},
	"objection": {
		desc: "This Pokémon avoids all Rock-type attacks and hazards when switching in.",
		shortDesc: "On switch-in, this Pokemon avoids all Rock-type attacks and Stealth Rock.",
		onStart: function(pokemon) {
		         this.add('-message', pokemon.name + " objectified the normal type move!");
		},
		onImmunity: function(type, target) {
			if (type === 'Normal' && !target.activeTurns) {
				return false;
			}
		},
		id: "objection",
		name: "OBJECTION",
		rating: 3.5,
		num: -9
    	}
};
<|endoftext|>


<commit_before>const React = require('react');
const t = require('transducers.js');
const csp = require('js-csp');
const { go, chan, take, put, ops } = csp;
const { takeAll } = require('./lib/util');

const App = require('./components/app');
const Page = require('./components/page');
const Index = require('./components/index');
const Post = require('./components/post');
const Tag = require('./components/tag');
const Archive = require('./components/archive');
const Drafts = require('./components/drafts');
const Edit = require('./admin/edit');
const NotFound = require('./components/not-found');
const ServerError = require('./components/server-error');
const RR = require('react-router');

const Router = React.createFactory(RR.Router);
const Route = React.createFactory(RR.Route);
const IndexRoute = React.createFactory(RR.IndexRoute);

function makeFetchingComponent(store, RouteComponent) {
  const fetchData = component => {
    if(component.populateStore) {
      component.populateStore(store, routeProps);
    }
  };

  return React.createClass({
    displayName: 'RouteFetching',
    render: function() {
      // const newProps = Object.assign({}, this.props, {
      //   onEnter: function(routeState) {
      //     if(props.onEnter) {
      //       props.onEnter(routeState);
      //     }
      //     fetchData(this.component);
      //   }
      // });
      return React.createElement(RouteComponent, this.props, this.props.children);
    }
  });
}

var hljs = require('highlight.js/lib/highlight.js'); // (jwl)
hljs.registerLanguage('scheme', require('./lib/scheme-highlight.js'));
hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'));

module.exports = (store, history) => {
  function createElement(Component, props) {
    if(Component.populateStore) {
      Component.populateStore(store, props);
    }
    return React.createElement(Component, props);
  }

  return Router(
    { history, createElement },
    Route(
      { path: '/', component: App },
      IndexRoute({ component: Index }),
      Route({ path: '/tag/:tag', component: Tag }),
      Route({ path: 'archive', component: Archive }),
      Route({ path: 'drafts', component: Drafts }),
      Route({ path: ':post', component: Post }),
      Route({ path: '/edit/:post', component: Edit }),
      Route({ path: '*', component: NotFound }),
    )
  );
}
<commit_msg>remove dead code<commit_after>const React = require('react');
const t = require('transducers.js');
const csp = require('js-csp');
const { go, chan, take, put, ops } = csp;
const { takeAll } = require('./lib/util');

const App = require('./components/app');
const Page = require('./components/page');
const Index = require('./components/index');
const Post = require('./components/post');
const Tag = require('./components/tag');
const Archive = require('./components/archive');
const Drafts = require('./components/drafts');
const Edit = require('./admin/edit');
const NotFound = require('./components/not-found');
const ServerError = require('./components/server-error');
const RR = require('react-router');

const Router = React.createFactory(RR.Router);
const Route = React.createFactory(RR.Route);
const IndexRoute = React.createFactory(RR.IndexRoute);

var hljs = require('highlight.js/lib/highlight.js'); // (jwl)
hljs.registerLanguage('scheme', require('./lib/scheme-highlight.js'));
hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'));

module.exports = (store, history) => {
  function createElement(Component, props) {
    if(Component.populateStore) {
      Component.populateStore(store, props);
    }
    return React.createElement(Component, props);
  }

  return Router(
    { history, createElement },
    Route(
      { path: '/', component: App },
      IndexRoute({ component: Index }),
      Route({ path: '/tag/:tag', component: Tag }),
      Route({ path: 'archive', component: Archive }),
      Route({ path: 'drafts', component: Drafts }),
      Route({ path: ':post', component: Post }),
      Route({ path: '/edit/:post', component: Edit }),
      Route({ path: '*', component: NotFound }),
    )
  );
}
<|endoftext|>