<commit_before>'use strict';

angular.module('doguCoreUiApp').controller('VCloudInspectorCtrl', function ($scope, $http, $location) {

  $scope.listLoading = true;
  $scope.listError = false;

  var allTypes = {};
  var allObjects = {};
  var objectsById = {};

  function getObjectComparator(fieldName, caseSensitive) {
    return function(type1, type2) {
      var value1 = caseSensitive ? type1[fieldName] : type1[fieldName].toLowerCase(),
          value2 = caseSensitive ? type2[fieldName] : type2[fieldName].toLowerCase();
      if (value1 < value2) {
        return -1;
      }
      else if (value1 > value2) {
        return 1;
      }
      else {
        return 0;
      }
    };
  }

  $scope.updateObjects = function() {
    $scope.objects = this.selectedType && allObjects[ this.selectedHost ][ this.selectedType.id ];
  };
  $scope.onSelectedHostChange = $scope.updateObjects;
  $scope.onSelectedTypeChange = $scope.updateObjects;

  $scope.objectFilter = '';
  var keywords = [];
  $scope.onFilterChange = function() {
    keywords = this.objectFilter.split(/ +/g);
  };

  $scope.filterObject = function(object) {
    return keywords.every(function (keyword) {
      return object.host = $scope.selectedHost &&
        object.name.toLowerCase().indexOf(keyword.toLowerCase()) !== -1;
    });
  };

  $scope.selectedObject = null;
  $scope.isObjectSelected = function(object) {
    return $scope.selectedObject && object.id === $scope.selectedObject.id;
  };

  $scope.onObjectSelected = function(object) {
    $scope.object = object;
    $scope.selectedObject = object;
    $scope.objectLoading = true;
    $scope.objectError = false;
    $http({method: 'GET', url: 'http://dogu.local/vcloud-inspector/' + object.id})
      .success(function(data/*, status, headers, config*/) {
        $scope.objectLoading = false;

        // Check for URL values, and set "reference" to the object
        var matches;
        jQuery.each(data.data.values, function(property, valueObject) {
          jQuery.each(valueObject.history, function(historyRank, historyObject) {
            if (typeof historyObject.value === 'string' && (matches = historyObject.value.match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/))) {
              historyObject.reference = objectsById[ matches[0] ];
            }
          });
        });

        $scope.object = data.data;
      })
      .error(function(data/*, status, headers, config*/) {
        $scope.objectLoading = false;
        $scope.objectError = data;
      });
  };

  $scope.onReferenceClick = function(reference) {
    $scope.selectedHost = reference.host;
    $scope.selectedType = allTypes[reference.queryType];
    $scope.selectedObject = reference;
    $scope.updateObjects();
    $scope.onObjectSelected(reference);
  };

  $scope.getDate = function(time) {
    var d = new Date(1000 * +time);
    return d.getFullYear() + '-' + ('0'+d.getMonth()).slice(-2) + '-' + ('0'+d.getDate()).slice(-2) +
      ' ' + ('0'+d.getHours()).slice(-2) + ':' + ('0'+d.getMinutes()).slice(-2);
  };

  $scope.isLink = function(history) {
    return history.reference;
  };

  $scope.getLink = function(object) {
    return '/vcloud-inspector/' + object.host + '/' + object.queryType + '/' + object.object;
  };

  $scope.getTypeName = function(type) {
    return allTypes[type].name;
  };

  // Get all objects and update objects
  $http({method: 'GET', url: 'http://dogu.local/vcloud-inspector'})
    .success(function(data/*, status, headers, config*/) {
      $scope.listLoading = false;

      // Create a allObjects which is an object of the form
      //     {
      //       <host>: {
      //         <queryType>: {
      //           <id>: object,
      //           ...
      //         ],
      //         ...
      //       },
      //       ...
      //     }
      jQuery.each(data.data.objects, function (objectId, object) {

        // Save object in objectsById
        objectsById[ object.object ] = object;

        // If necessary, create allObject.<host> = {}
        if (!(object.host in allObjects)) {
          allObjects[object.host] = {};
        }

        // If necessary, create allObjects.<host>.<queryType> = []
        if (!(object.queryType in allObjects[object.host])) {
          allObjects[object.host][object.queryType] = [];
        }

        // Save object
        object.id = objectId;
        allObjects[object.host][object.queryType].push(object);
      });

      // Sort object arrays of allObjects
      for (var host in allObjects) {
        if (allObjects.hasOwnProperty(host)) {
          for(var queryType in allObjects[host]) {
            if (allObjects[host].hasOwnProperty(queryType)) {
              allObjects[host][queryType].sort(getObjectComparator('name'));
            }
          }
        }
      }

      // Update $scope.hosts
      $scope.hosts = data.data.hosts.sort();

      // Update $scope.types
      $scope.types = jQuery.map(data.data.types, function(name, id) {
        return allTypes[id] = {
          id: id,
          name: name
        };
      }).sort(getObjectComparator('name'));

      // Initialize default values
      if ($scope.hosts.length) {
        $scope.selectedHost = $scope.hosts[0];
      }
      if ($scope.types.length) {
        $scope.selectedType = $scope.types[0];
      }
      $scope.updateObjects();

    })
    .error(function(data/*, status, headers, config*/) {
      $scope.listLoading = false;
      $scope.listError = data;
    });

});
<commit_msg>Fixed JS to match new JsHint requirements<commit_after>'use strict';

angular.module('doguCoreUiApp').controller('VCloudInspectorCtrl', function ($scope, $http/*, $location*/) {

  $scope.listLoading = true;
  $scope.listError = false;

  var allTypes = {};
  var allObjects = {};
  var objectsById = {};

  function getObjectComparator(fieldName, caseSensitive) {
    return function(type1, type2) {
      var value1 = caseSensitive ? type1[fieldName] : type1[fieldName].toLowerCase(),
          value2 = caseSensitive ? type2[fieldName] : type2[fieldName].toLowerCase();
      if (value1 < value2) {
        return -1;
      }
      else if (value1 > value2) {
        return 1;
      }
      else {
        return 0;
      }
    };
  }

  $scope.updateObjects = function() {
    $scope.objects = this.selectedType && allObjects[ this.selectedHost ][ this.selectedType.id ];
  };
  $scope.onSelectedHostChange = $scope.updateObjects;
  $scope.onSelectedTypeChange = $scope.updateObjects;

  $scope.objectFilter = '';
  var keywords = [];
  $scope.onFilterChange = function() {
    keywords = this.objectFilter.split(/ +/g);
  };

  $scope.filterObject = function(object) {
    return keywords.every(function (keyword) {
      return (object.host = $scope.selectedHost) &&
        object.name.toLowerCase().indexOf(keyword.toLowerCase()) !== -1;
    });
  };

  $scope.selectedObject = null;
  $scope.isObjectSelected = function(object) {
    return $scope.selectedObject && object.id === $scope.selectedObject.id;
  };

  $scope.onObjectSelected = function(object) {
    $scope.object = object;
    $scope.selectedObject = object;
    $scope.objectLoading = true;
    $scope.objectError = false;
    $http({method: 'GET', url: 'http://dogu.local/vcloud-inspector/' + object.id})
      .success(function(data/*, status, headers, config*/) {
        $scope.objectLoading = false;

        // Check for URL values, and set "reference" to the object
        var matches;
        jQuery.each(data.data.values, function(property, valueObject) {
          jQuery.each(valueObject.history, function(historyRank, historyObject) {
            if (typeof historyObject.value === 'string' && (matches = historyObject.value.match(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/))) {
              historyObject.reference = objectsById[ matches[0] ];
            }
          });
        });

        $scope.object = data.data;
      })
      .error(function(data/*, status, headers, config*/) {
        $scope.objectLoading = false;
        $scope.objectError = data;
      });
  };

  $scope.onReferenceClick = function(reference) {
    $scope.selectedHost = reference.host;
    $scope.selectedType = allTypes[reference.queryType];
    $scope.selectedObject = reference;
    $scope.updateObjects();
    $scope.onObjectSelected(reference);
  };

  $scope.getDate = function(time) {
    var d = new Date(1000 * +time);
    return d.getFullYear() + '-' + ('0'+d.getMonth()).slice(-2) + '-' + ('0'+d.getDate()).slice(-2) +
      ' ' + ('0'+d.getHours()).slice(-2) + ':' + ('0'+d.getMinutes()).slice(-2);
  };

  $scope.isLink = function(history) {
    return history.reference;
  };

  $scope.getLink = function(object) {
    return '/vcloud-inspector/' + object.host + '/' + object.queryType + '/' + object.object;
  };

  $scope.getTypeName = function(type) {
    return allTypes[type].name;
  };

  // Get all objects and update objects
  $http({method: 'GET', url: 'http://dogu.local/vcloud-inspector'})
    .success(function(data/*, status, headers, config*/) {
      $scope.listLoading = false;

      // Create a allObjects which is an object of the form
      //     {
      //       <host>: {
      //         <queryType>: {
      //           <id>: object,
      //           ...
      //         ],
      //         ...
      //       },
      //       ...
      //     }
      jQuery.each(data.data.objects, function (objectId, object) {

        // Save object in objectsById
        objectsById[ object.object ] = object;

        // If necessary, create allObject.<host> = {}
        if (!(object.host in allObjects)) {
          allObjects[object.host] = {};
        }

        // If necessary, create allObjects.<host>.<queryType> = []
        if (!(object.queryType in allObjects[object.host])) {
          allObjects[object.host][object.queryType] = [];
        }

        // Save object
        object.id = objectId;
        allObjects[object.host][object.queryType].push(object);
      });

      // Sort object arrays of allObjects
      for (var host in allObjects) {
        if (allObjects.hasOwnProperty(host)) {
          for(var queryType in allObjects[host]) {
            if (allObjects[host].hasOwnProperty(queryType)) {
              allObjects[host][queryType].sort(getObjectComparator('name'));
            }
          }
        }
      }

      // Update $scope.hosts
      $scope.hosts = data.data.hosts.sort();

      // Update $scope.types
      $scope.types = jQuery.map(data.data.types, function(name, id) {
        allTypes[id] = {
          id: id,
          name: name
        };
        return allTypes[id];
      }).sort(getObjectComparator('name'));

      // Initialize default values
      if ($scope.hosts.length) {
        $scope.selectedHost = $scope.hosts[0];
      }
      if ($scope.types.length) {
        $scope.selectedType = $scope.types[0];
      }
      $scope.updateObjects();

    })
    .error(function(data/*, status, headers, config*/) {
      $scope.listLoading = false;
      $scope.listError = data;
    });

});
<|endoftext|>


<commit_before>import variable from './../variables/platform';

export default (variables = variable) => {
  const platformStyle = variables.platformStyle;
  const platform = variables.platform;
  const darkCommon = {
    'NativeBase.Text': {
      color: variables.brandDark,
    },
    'NativeBase.Icon': {
      color: variables.brandDark,
    },
    'NativeBase.IconNB': {
      color: variables.brandDark,
    }
  }
  const lightCommon = {
    'NativeBase.Text': {
      color: variables.brandLight,
    },
    'NativeBase.Icon': {
      color: variables.brandLight,
    },
    'NativeBase.IconNB': {
      color: variables.brandLight,
    }
  }
  const primaryCommon = {
    'NativeBase.Text': {
      color: variables.btnPrimaryBg,
    },
    'NativeBase.Icon': {
      color: variables.btnPrimaryBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnPrimaryBg,
    }
  }
  const successCommon = {
    'NativeBase.Text': {
      color: variables.btnSuccessBg,
    },
    'NativeBase.Icon': {
      color: variables.btnSuccessBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnSuccessBg,
    }
  }
  const infoCommon = {
    'NativeBase.Text': {
      color: variables.btnInfoBg,
    },
    'NativeBase.Icon': {
      color: variables.btnInfoBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnInfoBg,
    }
  }
  const warningCommon = {
    'NativeBase.Text': {
      color: variables.btnWarningBg,
    },
    'NativeBase.Icon': {
      color: variables.btnWarningBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnWarningBg,
    }
  }
  const dangerCommon = {
    'NativeBase.Text': {
      color: variables.btnDangerBg,
    },
    'NativeBase.Icon': {
      color: variables.btnDangerBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnDangerBg,
    }
  }
  const buttonTheme = {
    '.disabled': {
      backgroundColor: variables.btnDisabledBg,
    },
    '.bordered': {
      '.dark': {
        ...darkCommon,
        backgroundColor: 'transparent',
        borderColor: variables.brandDark,
        borderWidth: variables.borderWidth * 2,
      },
      '.light': {
        ...lightCommon,
        backgroundColor: 'transparent',
        borderColor: variables.brandLight,
        borderWidth: variables.borderWidth * 2,
      },
      '.primary': {
        ...primaryCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnPrimaryBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.success': {
        ...successCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnSuccessBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.info': {
        ...infoCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnInfoBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.warning': {
        ...warningCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnWarningBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.danger': {
        ...dangerCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnDangerBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.disabled': {
        backgroundColor: null,
        borderColor: variables.btnDisabledBg,
        borderWidth: variables.borderWidth * 2,
        'NativeBase.Text': {
          color: variables.btnDisabledBg,
        },
      },
      ...primaryCommon,
      borderWidth: variables.borderWidth * 2,
      elevation: null,
      shadowColor: null,
      shadowOffset: null,
      shadowOpacity: null,
      shadowRadius: null,
      backgroundColor: 'transparent',
    },

    '.dark': {
      '.bordered': {
        ...darkCommon,
      },
      backgroundColor: variables.brandDark,
    },
    '.light': {
      '.transparent': {
        ...lightCommon,
        backgroundColor: null,
      },
      '.bordered': {
        ...lightCommon,
      },
      ...darkCommon,
      backgroundColor: variables.brandLight,
    },

    '.primary': {
      '.bordered': {
        ...primaryCommon
      },
      backgroundColor: variables.btnPrimaryBg,
    },

    '.success': {
      '.bordered': {
        ...successCommon,
      },
      backgroundColor: variables.btnSuccessBg,
    },

    '.info': {
      '.bordered': {
        ...infoCommon
      },
      backgroundColor: variables.btnInfoBg,
    },

    '.warning': {
      '.bordered': {
        ...warningCommon,
      },
      backgroundColor: variables.btnWarningBg,
    },

    '.danger': {
      '.bordered': {
        ...dangerCommon,
      },
      backgroundColor: variables.btnDangerBg,
    },

    '.block': {
      justifyContent: 'center',
      alignSelf: 'stretch',
    },

    '.full': {
      justifyContent: 'center',
      alignSelf: 'stretch',
      borderRadius: 0,
    },

    '.rounded': {
      // paddingHorizontal: variables.buttonPadding + 20,
      borderRadius: variables.borderRadiusLarge,
    },

    '.transparent': {
      backgroundColor: 'transparent',
      elevation: 0,
      shadowColor: null,
      shadowOffset: null,
      shadowRadius: null,
      shadowOpacity: null,
      ...primaryCommon,
      '.dark': {
        ...darkCommon,
        backgroundColor: null,
      },
      '.danger': {
        ...dangerCommon,
        backgroundColor: null,
      },
      '.warning': {
        ...warningCommon,
        backgroundColor: null,
      },
      '.info': {
        ...infoCommon,
        backgroundColor: null,
      },
      '.primary': {
        ...primaryCommon,
        backgroundColor: null,
      },
      '.success': {
        ...successCommon,
        backgroundColor: null,
      },
      '.light': {
        ...lightCommon,
        backgroundColor: null,
      },
      '.disabled': {
        backgroundColor: 'transparent',
        borderColor: variables.btnDisabledBg,
        borderWidth: variables.borderWidth * 2,
        'NativeBase.Text': {
          color: variables.btnDisabledBg,
        },
        'NativeBase.Icon': {
          color: variables.btnDisabledBg,
        },
        'NativeBase.IconNB': {
          color: variables.btnDisabledBg,
        }
      }
    },

    '.small': {
      height: 30,
      'NativeBase.Text': {
        fontSize: 14,
      },
    },

    '.large': {
      height: 60,
      'NativeBase.Text': {
        fontSize: 22,
        lineHeight: 32,
      },
    },

    '.capitalize': {},

    '.vertical': {
      flexDirection: 'column',
      height: null,
    },

    'NativeBase.Text': {
      fontFamily: variables.btnFontFamily,
      marginLeft: 0,
      marginRight: 0,
      color: variables.inverseTextColor,
      fontSize: variables.btnTextSize,
      lineHeight: variables.btnLineHeight,
      paddingHorizontal: 16,
      backgroundColor: 'transparent',
      // childPosition: 1
    },

    'NativeBase.Icon': {
      color: variables.inverseTextColor,
      fontSize: 24,
      marginHorizontal: 16,
      paddingTop: platform === 'ios' ? 2 : undefined,
    },
    'NativeBase.IconNB': {
      color: variables.inverseTextColor,
      fontSize: 24,
      marginHorizontal: 16,
      paddingTop: platform === 'ios' ? 2 : undefined,
    },

    '.iconLeft': {
      'NativeBase.Text': {
        marginLeft: 0,
      },
      'NativeBase.IconNB': {
        marginRight: 0,
        marginLeft: 16,
      },
      'NativeBase.Icon': {
        marginRight: 0,
        marginLeft: 16,
      },
    },
    '.iconRight': {
      'NativeBase.Text': {
        marginRight: 0,
      },
      'NativeBase.IconNB': {
        marginLeft: 0,
        marginRight: 16,
      },
      'NativeBase.Icon': {
        marginLeft: 0,
        marginRight: 16,
      },
    },
    '.picker': {
      'NativeBase.Text': {
        '.note': {
          fontSize: 16,
          lineHeight: null,
        },
      },
    },

    paddingVertical: variables.buttonPadding,
    // paddingHorizontal: variables.buttonPadding + 10,
    backgroundColor: variables.btnPrimaryBg,
    borderRadius: variables.borderRadiusBase,
    borderColor: variables.btnPrimaryBg,
    borderWidth: null,
    height: 45,
    alignSelf: 'flex-start',
    flexDirection: 'row',
    elevation: 2,
    shadowColor: platformStyle === 'material' ? variables.brandDark : undefined,
    shadowOffset:
      platformStyle === 'material' ? { width: 0, height: 2 } : undefined,
    shadowOpacity: platformStyle === 'material' ? 0.2 : undefined,
    shadowRadius: platformStyle === 'material' ? 1.2 : undefined,
    alignItems: 'center',
    justifyContent: 'space-between',
  };
  return buttonTheme;
};
<commit_msg>Update Button.js<commit_after>import variable from './../variables/platform';

export default (variables = variable) => {
  const platformStyle = variables.platformStyle;
  const platform = variables.platform;
  const darkCommon = {
    'NativeBase.Text': {
      color: variables.brandDark,
    },
    'NativeBase.Icon': {
      color: variables.brandDark,
    },
    'NativeBase.IconNB': {
      color: variables.brandDark,
    }
  }
  const lightCommon = {
    'NativeBase.Text': {
      color: variables.brandLight,
    },
    'NativeBase.Icon': {
      color: variables.brandLight,
    },
    'NativeBase.IconNB': {
      color: variables.brandLight,
    }
  }
  const primaryCommon = {
    'NativeBase.Text': {
      color: variables.btnPrimaryBg,
    },
    'NativeBase.Icon': {
      color: variables.btnPrimaryBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnPrimaryBg,
    }
  }
  const successCommon = {
    'NativeBase.Text': {
      color: variables.btnSuccessBg,
    },
    'NativeBase.Icon': {
      color: variables.btnSuccessBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnSuccessBg,
    }
  }
  const infoCommon = {
    'NativeBase.Text': {
      color: variables.btnInfoBg,
    },
    'NativeBase.Icon': {
      color: variables.btnInfoBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnInfoBg,
    }
  }
  const warningCommon = {
    'NativeBase.Text': {
      color: variables.btnWarningBg,
    },
    'NativeBase.Icon': {
      color: variables.btnWarningBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnWarningBg,
    }
  }
  const dangerCommon = {
    'NativeBase.Text': {
      color: variables.btnDangerBg,
    },
    'NativeBase.Icon': {
      color: variables.btnDangerBg,
    },
    'NativeBase.IconNB': {
      color: variables.btnDangerBg,
    }
  }
  const buttonTheme = {
    ".disabled": {
      ".transparent": {
        backgroundColor: null,
        "NativeBase.Text": {
          color: variables.btnDisabledBg
        }
      },
      backgroundColor: variables.btnDisabledBg
    },
    '.bordered': {
      '.dark': {
        ...darkCommon,
        backgroundColor: 'transparent',
        borderColor: variables.brandDark,
        borderWidth: variables.borderWidth * 2,
      },
      '.light': {
        ...lightCommon,
        backgroundColor: 'transparent',
        borderColor: variables.brandLight,
        borderWidth: variables.borderWidth * 2,
      },
      '.primary': {
        ...primaryCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnPrimaryBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.success': {
        ...successCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnSuccessBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.info': {
        ...infoCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnInfoBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.warning': {
        ...warningCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnWarningBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.danger': {
        ...dangerCommon,
        backgroundColor: 'transparent',
        borderColor: variables.btnDangerBg,
        borderWidth: variables.borderWidth * 2,
      },
      '.disabled': {
        backgroundColor: null,
        borderColor: variables.btnDisabledBg,
        borderWidth: variables.borderWidth * 2,
        'NativeBase.Text': {
          color: variables.btnDisabledBg,
        },
      },
      ...primaryCommon,
      borderWidth: variables.borderWidth * 2,
      elevation: null,
      shadowColor: null,
      shadowOffset: null,
      shadowOpacity: null,
      shadowRadius: null,
      backgroundColor: 'transparent',
    },

    '.dark': {
      '.bordered': {
        ...darkCommon,
      },
      backgroundColor: variables.brandDark,
    },
    '.light': {
      '.transparent': {
        ...lightCommon,
        backgroundColor: null,
      },
      '.bordered': {
        ...lightCommon,
      },
      ...darkCommon,
      backgroundColor: variables.brandLight,
    },

    '.primary': {
      '.bordered': {
        ...primaryCommon
      },
      backgroundColor: variables.btnPrimaryBg,
    },

    '.success': {
      '.bordered': {
        ...successCommon,
      },
      backgroundColor: variables.btnSuccessBg,
    },

    '.info': {
      '.bordered': {
        ...infoCommon
      },
      backgroundColor: variables.btnInfoBg,
    },

    '.warning': {
      '.bordered': {
        ...warningCommon,
      },
      backgroundColor: variables.btnWarningBg,
    },

    '.danger': {
      '.bordered': {
        ...dangerCommon,
      },
      backgroundColor: variables.btnDangerBg,
    },

    '.block': {
      justifyContent: 'center',
      alignSelf: 'stretch',
    },

    '.full': {
      justifyContent: 'center',
      alignSelf: 'stretch',
      borderRadius: 0,
    },

    '.rounded': {
      // paddingHorizontal: variables.buttonPadding + 20,
      borderRadius: variables.borderRadiusLarge,
    },

    '.transparent': {
      backgroundColor: 'transparent',
      elevation: 0,
      shadowColor: null,
      shadowOffset: null,
      shadowRadius: null,
      shadowOpacity: null,
      ...primaryCommon,
      '.dark': {
        ...darkCommon,
        backgroundColor: null,
      },
      '.danger': {
        ...dangerCommon,
        backgroundColor: null,
      },
      '.warning': {
        ...warningCommon,
        backgroundColor: null,
      },
      '.info': {
        ...infoCommon,
        backgroundColor: null,
      },
      '.primary': {
        ...primaryCommon,
        backgroundColor: null,
      },
      '.success': {
        ...successCommon,
        backgroundColor: null,
      },
      '.light': {
        ...lightCommon,
        backgroundColor: null,
      },
      '.disabled': {
        backgroundColor: 'transparent',
        borderColor: variables.btnDisabledBg,
        borderWidth: variables.borderWidth * 2,
        'NativeBase.Text': {
          color: variables.btnDisabledBg,
        },
        'NativeBase.Icon': {
          color: variables.btnDisabledBg,
        },
        'NativeBase.IconNB': {
          color: variables.btnDisabledBg,
        }
      }
    },

    '.small': {
      height: 30,
      'NativeBase.Text': {
        fontSize: 14,
      },
    },

    '.large': {
      height: 60,
      'NativeBase.Text': {
        fontSize: 22,
        lineHeight: 32,
      },
    },

    '.capitalize': {},

    '.vertical': {
      flexDirection: 'column',
      height: null,
    },

    'NativeBase.Text': {
      fontFamily: variables.btnFontFamily,
      marginLeft: 0,
      marginRight: 0,
      color: variables.inverseTextColor,
      fontSize: variables.btnTextSize,
      lineHeight: variables.btnLineHeight,
      paddingHorizontal: 16,
      backgroundColor: 'transparent',
      // childPosition: 1
    },

    'NativeBase.Icon': {
      color: variables.inverseTextColor,
      fontSize: 24,
      marginHorizontal: 16,
      paddingTop: platform === 'ios' ? 2 : undefined,
    },
    'NativeBase.IconNB': {
      color: variables.inverseTextColor,
      fontSize: 24,
      marginHorizontal: 16,
      paddingTop: platform === 'ios' ? 2 : undefined,
    },

    '.iconLeft': {
      'NativeBase.Text': {
        marginLeft: 0,
      },
      'NativeBase.IconNB': {
        marginRight: 0,
        marginLeft: 16,
      },
      'NativeBase.Icon': {
        marginRight: 0,
        marginLeft: 16,
      },
    },
    '.iconRight': {
      'NativeBase.Text': {
        marginRight: 0,
      },
      'NativeBase.IconNB': {
        marginLeft: 0,
        marginRight: 16,
      },
      'NativeBase.Icon': {
        marginLeft: 0,
        marginRight: 16,
      },
    },
    '.picker': {
      'NativeBase.Text': {
        '.note': {
          fontSize: 16,
          lineHeight: null,
        },
      },
    },

    paddingVertical: variables.buttonPadding,
    // paddingHorizontal: variables.buttonPadding + 10,
    backgroundColor: variables.btnPrimaryBg,
    borderRadius: variables.borderRadiusBase,
    borderColor: variables.btnPrimaryBg,
    borderWidth: null,
    height: 45,
    alignSelf: 'flex-start',
    flexDirection: 'row',
    elevation: 2,
    shadowColor: platformStyle === 'material' ? variables.brandDark : undefined,
    shadowOffset:
      platformStyle === 'material' ? { width: 0, height: 2 } : undefined,
    shadowOpacity: platformStyle === 'material' ? 0.2 : undefined,
    shadowRadius: platformStyle === 'material' ? 1.2 : undefined,
    alignItems: 'center',
    justifyContent: 'space-between',
  };
  return buttonTheme;
};
<|endoftext|>


<commit_before>/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */

/**
 * A basic HTML5 multi-file upload tool with graceful degradation.
 * If all features are supported by browser, user can drag and drop multiple
 * files onto a target, preview them, optionally modify contentIds inline, and upload
 * files while receiving progress feedback. On successful upload, the panel will
 * present links enabling the user to navigate to the uploaded item.
 *
 * @author Daniel Bernstein
 */

$.widget("ui.uploader", {
        _dropPreview: null,
        _space: null,
        _progress: null,
        _progressPanel: null,
        _dropTarget: null,
        _isDnDSupported:function(){
            return (typeof FileReader != 'undefined') &&
                   ('draggable' in document.createElement('span')) &&
                   (!!window.FormData) &&
                   ("upload" in new XMLHttpRequest);
        },
        _init: function(){
            var that = this;

            var dropTarget = $("#drop-target", this.element);

            /**
             * configure drag and drop support only if it is supported.
             */
            if(this._isDnDSupported()){

                dropTarget.unbind();
                dropTarget.bind("dragover",
                            function () {
                                this.className = 'hover';
                                return false;
                            });

                dropTarget.bind("dragend", function () {
                                        this.className = '';
                                        return false;
                                      });

                dropTarget.bind("drop",
                            function (e) {
                                this.className = '';
                                e.preventDefault();
                                that._loadPreviewList(e.originalEvent.dataTransfer.files);
                            });
                that._dropTarget = dropTarget;

                var dp = $("#drop-preview",this.element);
                that._dropPreview =  dp;

            }

            that._progress = $("#uploadprogress");

            that._progressPanel = that._progress.parent();

            var  singleUploadForm = $("#single-upload-form");

            singleUploadForm.validate({
                rules: {
                    file: {
                        required:true,
                    },
                },
                messages: {}
            });

            var formControls = singleUploadForm.find("button");
            singleUploadForm.ajaxForm({
                dataType: "json",
                beforeSerialize:function(form, options){
                    dc.checkSession();
                    form.find("#spaceId").val(that._space.spaceId);
                    form.find("#storeId").val(that._space.storeId);
                    formControls.attr("disabled", "disabled");
                },
                success: function(data){
                    dc.checkSession();
                    that._status("Successfully uploaded.", true);
                    that._progressPanel.hide();
                    //on success reset
                    that._reset();
                    if(that.options.clickContent){
                        var item = $("

");
                        item.append($(""+data.results.contentId+"")
                                .click(function(){
                                    that.options.clickContent(data.results[0]);
                                }));
                        that._dropPreview.append(item);

                    }
                },

                uploadProgress: function (event, position, total, complete) {
                    that._status("Uploading files...");
                    that._progressPanel.show();
                    that._progress.val(complete);
                    that._progress.html(complete);
                },

                error: function(xhr, status, errorThrown){
                    that._status("Upload failed", false);
                },

                complete: function(){
                    formControls.removeAttr("disabled");
                }
            });

            that._reset();

        },

        _previewfile: function (file,index, onload) {
            var that = this;
            var item = $("

").addClass("clearfix");
            item.css("vertical-align","middle");
            item.append("<input type='text' name='contentId' data-initial-value='"+file.name+"'value='"+file.name+"'/>");
            var removeBtn = $("<button></button>")
                           .click(function(){
                               item.slideUp().remove();
                           });
            item.append(removeBtn);
            var reader = new FileReader();
            reader.onload = function (event) {
              var image = new Image();
              if(file.type.indexOf("image") == 0){
                  image.src = event.target.result;
                  image.width = 40; // a fake resize
                  image.height = 40;
                  image = $("

").addClass("float-l").append(image);
              }else{
                  image = "

"
              }
              item.prepend(image);
              onload(index);
            };
            that._dropPreview.append(item);
            reader.readAsDataURL(file);
        },

        space: function(/*space object*/space){
            this._space = space;
        },

        _reset: function(){
            var form = $("#single-upload-form",this.element);
            form[0].reset();
            form.show();
            if(this._isDnDSupported()){
                this._dropPreview.children().remove();
                $("#dnd-upload").show();
                this._status('Select a single file using the file chooser or drag and '+
                'drop files from your computer onto the dotted square to upload');

            }else{
                this._status('Select a single file using the file chooser.');
            }
        },

        _status: function(statusText,/*boolean*/ success){
            var status = $(".status", this.element);
            status
            .removeClass("success")
            .removeClass("error")
            .find("p").html(statusText);

            if(success !== undefined){
                status.addClass(success ? 'success' : 'error');
            }

        },

        _uploadFiles: function(files){
            var that = this;
            var inputfields = that._dropPreview.find("input");

            var formData =  new FormData();
            formData.append("spaceId", that._space.spaceId);
            formData.append("storeId", that._space.storeId);

            $.each(inputfields, function(i,f){
               var node = $(f);

               var initialVal = node.attr("data-initial-value");
               var name = node.attr("name");

               //add only files that appear in form.
               if(name == 'contentId' && initialVal){
                   formData.append(node.attr("name"), node.val());

                   $.each(files, function(j, file){
                       if(file.name == initialVal){
                           formData.append('file', file);
                       }
                   });
               }
            });

            $("input, button", that._dropPreview).attr("disabled", "disabled");

            //using raw xhr because progress bar was not working with jquery:
            //probably need to upgrade to jquery 1.10.* but that is non-trivial
            //since it will require upgrading many other plugins - did not work
            //right off that bat so I abandonned the upgrade for the time being.

            that._progressPanel.show();
            var status = $(".status", this.element);
            that._status("Uploading...");
            var xhr = new XMLHttpRequest();
            xhr.open('POST', '/duradmin/spaces/content/upload');
            xhr.onload = function() {
              that._progress.val(100);
              that._progress.html(100);
              var data = $.parseJSON(xhr.responseText);
              var results = data.results;
              that._status("Upload successful! Click on any item label below to see the content details.", true);
              that._progressPanel.hide();
              that._dropPreview.find("button").remove();
              that._dropPreview.prepend(
                      $("<button>Upload more files</button>")
                          .click(function(e){
                              e.preventDefault();
                              that._reset();
                          }
                      )
                  );
              that._success(results);
            };

            xhr.upload.onprogress = function (event) {
              if (event.lengthComputable) {
                var complete = (event.loaded / event.total * 100 | 0);
                that._progress.val(complete);
                that._progress.html(complete);
                if(complete == 100){
                    that._status("Finalizing upload...");
                }
              }
            };

            xhr.send(formData);
        },

        _success: function(results){
            var that = this;
          //replace fields with links.
            $.each($(".upload-item",this.element), function(i, el){
                var node = $(el);
                var contentId = node.find("input[name='contentId']").val();
                $.each(results, function(j, result){
                    var link = $(""+contentId+"")
                    if(result.contentId == contentId){
                        link.click(function(){
                            var clickContent = that.options.clickContent;
                            if(clickContent){
                                clickContent(result);
                            }
                        });
                        node.children().not(":first-child").remove();
                        node.append(link);
                        return false;
                    }

                });
            });
        },
        _loadPreviewList: function(files) {
            var that = this;
            $.each(files, function(i, file){
                that._previewfile(file, i, function(index){

                    //disable extraneous controls while previewing.
                    $("#single-upload-form", that.element).fadeOut();
                    $("#dnd-upload",that.element).fadeOut();

                    if(index == files.length-1){
                        var cancel = $("<button>cancel</button>")
                                        .click(function(e){
                                            e.preventDefault();
                                            that._reset();
                                        });

                        that._dropPreview.prepend(cancel);

                        var upload =
                                $("<button>upload</button>")
                                .click(function(e){
                                    e.preventDefault();
                                    that._uploadFiles(files);
                                });

                        that._dropPreview.prepend(upload);

                        that._status("Before uploading modify the content ids below if the original file name doesn't suit you. Then click 'upload'.");
                    }
                });
            });
        },

        destroy: function(){

        },
    }
);

<commit_msg>Applies Danny's patch to resolve issue #13 (duradmin upload chokes on error) in release 2.4 issues list: https://wiki.duraspace.org/display/DSPINT/Release+2.4+Tasks<commit_after>/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */

/**
 * A basic HTML5 multi-file upload tool with graceful degradation.
 * If all features are supported by browser, user can drag and drop multiple
 * files onto a target, preview them, optionally modify contentIds inline, and upload
 * files while receiving progress feedback. On successful upload, the panel will
 * present links enabling the user to navigate to the uploaded item.
 *
 * @author Daniel Bernstein
 */

$.widget("ui.uploader", {
        _dropPreview: null,
        _space: null,
        _progress: null,
        _progressPanel: null,
        _dropTarget: null,
        _isDnDSupported:function(){
            return (typeof FileReader != 'undefined') &&
                   ('draggable' in document.createElement('span')) &&
                   (!!window.FormData) &&
                   ("upload" in new XMLHttpRequest);
        },
        _init: function(){
            var that = this;

            var dropTarget = $("#drop-target", this.element);

            /**
             * configure drag and drop support only if it is supported.
             */
            if(this._isDnDSupported()){

                dropTarget.unbind();
                dropTarget.bind("dragover",
                            function () {
                                this.className = 'hover';
                                return false;
                            });

                dropTarget.bind("dragend", function () {
                                        this.className = '';
                                        return false;
                                      });

                dropTarget.bind("drop",
                            function (e) {
                                this.className = '';
                                e.preventDefault();
                                that._loadPreviewList(e.originalEvent.dataTransfer.files);
                            });
                that._dropTarget = dropTarget;

                var dp = $("#drop-preview",this.element);
                that._dropPreview =  dp;

            }

            that._progress = $("#uploadprogress");

            that._progressPanel = that._progress.parent();

            var  singleUploadForm = $("#single-upload-form");

            singleUploadForm.validate({
                rules: {
                    file: {
                        required:true,
                    },
                },
                messages: {}
            });

            var formControls = singleUploadForm.find("button");
            singleUploadForm.ajaxForm({
                dataType: "json",
                beforeSerialize:function(form, options){
                    dc.checkSession();
                    form.find("#spaceId").val(that._space.spaceId);
                    form.find("#storeId").val(that._space.storeId);
                    formControls.attr("disabled", "disabled");
                },
                success: function(data){
                    dc.checkSession();
                    that._status("Successfully uploaded.", true);
                    that._progressPanel.hide();
                    //on success reset
                    that._reset();
                    if(that.options.clickContent){
                        var item = $("

");
                        item.append($(""+data.results.contentId+"")
                                .click(function(){
                                    that.options.clickContent(data.results[0]);
                                }));
                        that._dropPreview.append(item);

                    }
                },

                uploadProgress: function (event, position, total, complete) {
                    that._status("Uploading files...");
                    that._progressPanel.show();
                    that._progress.val(complete);
                    that._progress.html(complete);
                },

                error: function(xhr, status, errorThrown){
                    that._status("Upload failed", false);
                },

                complete: function(){
                    formControls.removeAttr("disabled");
                }
            });

            that._reset();

        },

        _previewfile: function (file,index, onload) {
            var that = this;
            var item = $("

").addClass("clearfix");
            item.css("vertical-align","middle");
            item.append("<input type='text' name='contentId' data-initial-value='"+file.name+"'value='"+file.name+"'/>");
            var removeBtn = $("<button></button>")
                           .click(function(){
                               item.slideUp().remove();
                           });
            item.append(removeBtn);
            var reader = new FileReader();
            reader.onload = function (event) {
              var image = new Image();
              if(file.type.indexOf("image") == 0){
                  image.src = event.target.result;
                  image.width = 40; // a fake resize
                  image.height = 40;
                  image = $("

").addClass("float-l").append(image);
              }else{
                  image = "

"
              }
              item.prepend(image);
              onload(index);
            };
            that._dropPreview.append(item);
            reader.readAsDataURL(file);
        },

        space: function(/*space object*/space){
            this._space = space;
        },

        _reset: function(){
            var form = $("#single-upload-form",this.element);
            form[0].reset();
            form.show();
            if(this._isDnDSupported()){
                this._dropPreview.children().remove();
                $("#dnd-upload").show();
                this._status('Select a single file using the file chooser or drag and '+
                'drop files from your computer onto the dotted square to upload');

            }else{
                this._status('Select a single file using the file chooser.');
            }
        },

        _status: function(statusText,/*boolean*/ success){
            var status = $(".status", this.element);
            status
            .removeClass("success")
            .removeClass("error")
            .find("p").html(statusText);

            if(success !== undefined){
                status.addClass(success ? 'success' : 'error');
            }

        },

        _uploadFiles: function(files){
            var that = this;
            var inputfields = that._dropPreview.find("input");

            var formData =  new FormData();
            formData.append("spaceId", that._space.spaceId);
            formData.append("storeId", that._space.storeId);

            $.each(inputfields, function(i,f){
               var node = $(f);

               var initialVal = node.attr("data-initial-value");
               var name = node.attr("name");

               //add only files that appear in form.
               if(name == 'contentId' && initialVal){
                   formData.append(node.attr("name"), node.val());

                   $.each(files, function(j, file){
                       if(file.name == initialVal){
                           formData.append('file', file);
                       }
                   });
               }
            });

            $("input, button", that._dropPreview).attr("disabled", "disabled");

            //using raw xhr because progress bar was not working with jquery:
            //probably need to upgrade to jquery 1.10.* but that is non-trivial
            //since it will require upgrading many other plugins - did not work
            //right off that bat so I abandonned the upgrade for the time being.

            that._progressPanel.show();
            var status = $(".status", this.element);
            that._status("Uploading...");
            var xhr = new XMLHttpRequest();
            xhr.open('POST', '/duradmin/spaces/content/upload');
            xhr.onload = function() {
              that._progress.val(100);
              that._progress.html(100);
              var data = $.parseJSON(xhr.responseText);
              var results = data.results;
              if(data.exception){
                  that._status("Upload failed: " + data.exception.message, false);

              }else{
                  that._status("Upload successful! Click on any item label below to see the content details.", true);
                  that._progressPanel.hide();
                  that._dropPreview.find("button").remove();
                  that._dropPreview.prepend(
                          $("<button>Upload more files</button>")
                              .click(function(e){
                                  e.preventDefault();
                                  that._reset();
                              }
                          )
                      );
                  that._success(results);
              }
            };

            xhr.upload.onprogress = function (event) {
              if (event.lengthComputable) {
                var complete = (event.loaded / event.total * 100 | 0);
                that._progress.val(complete);
                that._progress.html(complete);
                if(complete == 100){
                    that._status("Finalizing upload...");
                }
              }
            };

            xhr.send(formData);
        },

        _success: function(results){
            var that = this;
          //replace fields with links.
            $.each($(".upload-item",this.element), function(i, el){
                var node = $(el);
                var contentId = node.find("input[name='contentId']").val();
                $.each(results, function(j, result){
                    var link = $(""+contentId+"")
                    if(result.contentId == contentId){
                        link.click(function(){
                            var clickContent = that.options.clickContent;
                            if(clickContent){
                                clickContent(result);
                            }
                        });
                        node.children().not(":first-child").remove();
                        node.append(link);
                        return false;
                    }

                });
            });
        },
        _loadPreviewList: function(files) {
            var that = this;
            $.each(files, function(i, file){
                that._previewfile(file, i, function(index){

                    //disable extraneous controls while previewing.
                    $("#single-upload-form", that.element).fadeOut();
                    $("#dnd-upload",that.element).fadeOut();

                    if(index == files.length-1){
                        var cancel = $("<button>cancel</button>")
                                        .click(function(e){
                                            e.preventDefault();
                                            that._reset();
                                        });

                        that._dropPreview.prepend(cancel);

                        var upload =
                                $("<button>upload</button>")
                                .click(function(e){
                                    e.preventDefault();
                                    that._uploadFiles(files);
                                });

                        that._dropPreview.prepend(upload);

                        that._status("Before uploading modify the content ids below if the original file name doesn't suit you. Then click 'upload'.");
                    }
                });
            });
        },

        destroy: function(){

        },
    }
);

<|endoftext|>


<commit_before>/**
 * @author mrdoob / http://mrdoob.com/
 * @author alteredq / http://alteredqualia.com/
 */

THREE.Material = function () {

	Object.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } );

	this.uuid = THREE.Math.generateUUID();

	this.name = '';
	this.type = 'Material';

	this.side = THREE.FrontSide;

	this.opacity = 1;
	this.transparent = false;

	this.blending = THREE.NormalBlending;

	this.blendSrc = THREE.SrcAlphaFactor;
	this.blendDst = THREE.OneMinusSrcAlphaFactor;
	this.blendEquation = THREE.AddEquation;
	this.blendSrcAlpha = null;
	this.blendDstAlpha = null;
	this.blendEquationAlpha = null;

	this.depthFunc = THREE.LessEqualDepth;
	this.depthTest = true;
	this.depthWrite = true;

	this.colorWrite = true;

	this.precision = null; // override the renderer's default precision for this material

	this.polygonOffset = false;
	this.polygonOffsetFactor = 0;
	this.polygonOffsetUnits = 0;

	this.alphaTest = 0;

	this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer

	this.visible = true;

	this._needsUpdate = true;

};

THREE.Material.prototype = {

	constructor: THREE.Material,

	get needsUpdate () {

		return this._needsUpdate;

	},

	set needsUpdate ( value ) {

		if ( value === true ) this.update();

		this._needsUpdate = value;

	},

	setValues: function ( values ) {

		if ( values === undefined ) return;

		for ( var key in values ) {

			var newValue = values[ key ];

			if ( newValue === undefined ) {

				console.warn( "THREE.Material: '" + key + "' parameter is undefined." );
				continue;

			}

			if ( key in this ) {

				var currentValue = this[ key ];

				if ( currentValue instanceof THREE.Color ) {

					currentValue.set( newValue );

				} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {

					currentValue.copy( newValue );

				} else if ( key === 'overdraw' ) {

					// ensure overdraw is backwards-compatible with legacy boolean type
					this[ key ] = Number( newValue );

				} else {

					this[ key ] = newValue;

				}

			}

		}

	},

	toJSON: function ( meta ) {

		var data = {
			metadata: {
				version: 4.4,
				type: 'Material',
				generator: 'Material.toJSON'
			}
		};

		// standard Material serialization
		data.uuid = this.uuid;
		data.type = this.type;
		if ( this.name !== '' ) data.name = this.name;

		if ( this.color instanceof THREE.Color ) data.color = this.color.getHex();
		if ( this.emissive instanceof THREE.Color ) data.emissive = this.emissive.getHex();
		if ( this.specular instanceof THREE.Color ) data.specular = this.specular.getHex();
		if ( this.shininess !== undefined ) data.shininess = this.shininess;

		if ( this.map instanceof THREE.Texture ) data.map = this.map.toJSON( meta ).uuid;
		if ( this.alphaMap instanceof THREE.Texture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
		if ( this.lightMap instanceof THREE.Texture ) data.lightMap = this.lightMap.toJSON( meta ).uuid;
		if ( this.bumpMap instanceof THREE.Texture ) {

			data.bumpMap = this.bumpMap.toJSON( meta ).uuid;
			data.bumpScale = this.bumpScale;

		}
		if ( this.normalMap instanceof THREE.Texture ) {

			data.normalMap = this.normalMap.toJSON( meta ).uuid;
			data.normalScale = this.normalScale; // Removed for now, causes issue in editor ui.js

		}
		if ( this.displacementMap instanceof THREE.Texture ) {

			data.displacementMap = this.displacementMap.toJSON( meta ).uuid;
			data.displacementScale = this.displacementScale;
			data.displacementBias = this.displacementBias;

		}
		if ( this.specularMap instanceof THREE.Texture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
		if ( this.envMap instanceof THREE.Texture ) {

			data.envMap = this.envMap.toJSON( meta ).uuid;
			data.reflectivity = this.reflectivity; // Scale behind envMap

		}

		if ( this.size !== undefined ) data.size = this.size;
		if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;

		if ( this.vertexColors !== undefined && this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
		if ( this.shading !== undefined && this.shading !== THREE.SmoothShading ) data.shading = this.shading;
		if ( this.blending !== undefined && this.blending !== THREE.NormalBlending ) data.blending = this.blending;
		if ( this.side !== undefined && this.side !== THREE.FrontSide ) data.side = this.side;

		if ( this.opacity < 1 ) data.opacity = this.opacity;
		if ( this.transparent === true ) data.transparent = this.transparent;
		if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
		if ( this.wireframe === true ) data.wireframe = this.wireframe;
		if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;

		return data;

	},

	clone: function () {

		return new this.constructor().copy( this );

	},

	copy: function ( source ) {

		this.name = source.name;

		this.side = source.side;

		this.opacity = source.opacity;
		this.transparent = source.transparent;

		this.blending = source.blending;

		this.blendSrc = source.blendSrc;
		this.blendDst = source.blendDst;
		this.blendEquation = source.blendEquation;
		this.blendSrcAlpha = source.blendSrcAlpha;
		this.blendDstAlpha = source.blendDstAlpha;
		this.blendEquationAlpha = source.blendEquationAlpha;

		this.depthFunc = source.depthFunc;
		this.depthTest = source.depthTest;
		this.depthWrite = source.depthWrite;

		this.precision = source.precision;

		this.polygonOffset = source.polygonOffset;
		this.polygonOffsetFactor = source.polygonOffsetFactor;
		this.polygonOffsetUnits = source.polygonOffsetUnits;

		this.alphaTest = source.alphaTest;

		this.overdraw = source.overdraw;

		this.visible = source.visible;

		return this;

	},

	update: function () {

		this.dispatchEvent( { type: 'update' } );

	},

	dispose: function () {

		this.dispatchEvent( { type: 'dispose' } );

	}

};

THREE.EventDispatcher.prototype.apply( THREE.Material.prototype );

THREE.MaterialIdCount = 0;
<commit_msg>Material: Check if material has the property. Warn otherwise.<commit_after>/**
 * @author mrdoob / http://mrdoob.com/
 * @author alteredq / http://alteredqualia.com/
 */

THREE.Material = function () {

	Object.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } );

	this.uuid = THREE.Math.generateUUID();

	this.name = '';
	this.type = 'Material';

	this.side = THREE.FrontSide;

	this.opacity = 1;
	this.transparent = false;

	this.blending = THREE.NormalBlending;

	this.blendSrc = THREE.SrcAlphaFactor;
	this.blendDst = THREE.OneMinusSrcAlphaFactor;
	this.blendEquation = THREE.AddEquation;
	this.blendSrcAlpha = null;
	this.blendDstAlpha = null;
	this.blendEquationAlpha = null;

	this.depthFunc = THREE.LessEqualDepth;
	this.depthTest = true;
	this.depthWrite = true;

	this.colorWrite = true;

	this.precision = null; // override the renderer's default precision for this material

	this.polygonOffset = false;
	this.polygonOffsetFactor = 0;
	this.polygonOffsetUnits = 0;

	this.alphaTest = 0;

	this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer

	this.visible = true;

	this._needsUpdate = true;

};

THREE.Material.prototype = {

	constructor: THREE.Material,

	get needsUpdate () {

		return this._needsUpdate;

	},

	set needsUpdate ( value ) {

		if ( value === true ) this.update();

		this._needsUpdate = value;

	},

	setValues: function ( values ) {

		if ( values === undefined ) return;

		for ( var key in values ) {

			var newValue = values[ key ];

			if ( newValue === undefined ) {

				console.warn( "THREE.Material: '" + key + "' parameter is undefined." );
				continue;

			}

			var currentValue = this[ key ];

			if ( currentValue === undefined ) {

				console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." );
				continue;

			}

			if ( currentValue instanceof THREE.Color ) {

				currentValue.set( newValue );

			} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {

				currentValue.copy( newValue );

			} else if ( key === 'overdraw' ) {

				// ensure overdraw is backwards-compatible with legacy boolean type
				this[ key ] = Number( newValue );

			} else {

				this[ key ] = newValue;

			}

		}

	},

	toJSON: function ( meta ) {

		var data = {
			metadata: {
				version: 4.4,
				type: 'Material',
				generator: 'Material.toJSON'
			}
		};

		// standard Material serialization
		data.uuid = this.uuid;
		data.type = this.type;
		if ( this.name !== '' ) data.name = this.name;

		if ( this.color instanceof THREE.Color ) data.color = this.color.getHex();
		if ( this.emissive instanceof THREE.Color ) data.emissive = this.emissive.getHex();
		if ( this.specular instanceof THREE.Color ) data.specular = this.specular.getHex();
		if ( this.shininess !== undefined ) data.shininess = this.shininess;

		if ( this.map instanceof THREE.Texture ) data.map = this.map.toJSON( meta ).uuid;
		if ( this.alphaMap instanceof THREE.Texture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
		if ( this.lightMap instanceof THREE.Texture ) data.lightMap = this.lightMap.toJSON( meta ).uuid;
		if ( this.bumpMap instanceof THREE.Texture ) {

			data.bumpMap = this.bumpMap.toJSON( meta ).uuid;
			data.bumpScale = this.bumpScale;

		}
		if ( this.normalMap instanceof THREE.Texture ) {

			data.normalMap = this.normalMap.toJSON( meta ).uuid;
			data.normalScale = this.normalScale; // Removed for now, causes issue in editor ui.js

		}
		if ( this.displacementMap instanceof THREE.Texture ) {

			data.displacementMap = this.displacementMap.toJSON( meta ).uuid;
			data.displacementScale = this.displacementScale;
			data.displacementBias = this.displacementBias;

		}
		if ( this.specularMap instanceof THREE.Texture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
		if ( this.envMap instanceof THREE.Texture ) {

			data.envMap = this.envMap.toJSON( meta ).uuid;
			data.reflectivity = this.reflectivity; // Scale behind envMap

		}

		if ( this.size !== undefined ) data.size = this.size;
		if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;

		if ( this.vertexColors !== undefined && this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;
		if ( this.shading !== undefined && this.shading !== THREE.SmoothShading ) data.shading = this.shading;
		if ( this.blending !== undefined && this.blending !== THREE.NormalBlending ) data.blending = this.blending;
		if ( this.side !== undefined && this.side !== THREE.FrontSide ) data.side = this.side;

		if ( this.opacity < 1 ) data.opacity = this.opacity;
		if ( this.transparent === true ) data.transparent = this.transparent;
		if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
		if ( this.wireframe === true ) data.wireframe = this.wireframe;
		if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;

		return data;

	},

	clone: function () {

		return new this.constructor().copy( this );

	},

	copy: function ( source ) {

		this.name = source.name;

		this.side = source.side;

		this.opacity = source.opacity;
		this.transparent = source.transparent;

		this.blending = source.blending;

		this.blendSrc = source.blendSrc;
		this.blendDst = source.blendDst;
		this.blendEquation = source.blendEquation;
		this.blendSrcAlpha = source.blendSrcAlpha;
		this.blendDstAlpha = source.blendDstAlpha;
		this.blendEquationAlpha = source.blendEquationAlpha;

		this.depthFunc = source.depthFunc;
		this.depthTest = source.depthTest;
		this.depthWrite = source.depthWrite;

		this.precision = source.precision;

		this.polygonOffset = source.polygonOffset;
		this.polygonOffsetFactor = source.polygonOffsetFactor;
		this.polygonOffsetUnits = source.polygonOffsetUnits;

		this.alphaTest = source.alphaTest;

		this.overdraw = source.overdraw;

		this.visible = source.visible;

		return this;

	},

	update: function () {

		this.dispatchEvent( { type: 'update' } );

	},

	dispose: function () {

		this.dispatchEvent( { type: 'dispose' } );

	}

};

THREE.EventDispatcher.prototype.apply( THREE.Material.prototype );

THREE.MaterialIdCount = 0;
<|endoftext|>


<commit_before>var modRewrite = require("connect-modrewrite");
var serveStatic = require("serve-static");

module.exports = function(grunt) {
  var dstFileBanner =
    '/**\n * @application <%= pkg.name %>\n * @version <%= pkg.version %>\n * @updated <%= grunt.template.today("yyyy-mm-dd") %>\n * @author <%= pkg.author %>\n * @license <%= pkg.license %>\n */\n';

  // Project configuration.
  grunt.initConfig({
    app: grunt.file.readJSON("application-config.json"),
    pkg: grunt.file.readJSON("package.json"),
    global: {
      repository: { root: "@REST_FRONTEND_SOURCE_INSTALL_REPOSITORY@" }
    },
    "create-website-structure": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: "resources/structure.json.in",
        output: "resources/structure.json"
      }
    },
    "create-website-news": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        news_root: "doc/news",
        output: "resources/news.json",
        regex: {
          filename: {
            pattern: "^([0-9]{4}\\-[0-9]{2}\\-[0-9]{2})_(.*)$",
            flags: "i"
          },
          title: { pattern: "^# ([^#\n]*)$", flags: "im" },
          shortdesc: { pattern: "^- shortDesc: (.*)$", flags: "im" }
        }
      }
    },
    "create-website-news-rss": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: {
          news: "<%= grunt.config('create-website-news.build.output') %>"
        },
        regex: { guid: { pattern: "^\\- guid: ([a-fA-F0-9-]+)$", flags: "m" } },
        feed: {
          title: "Elektra's Blog",
          description: "News around Elektra",
          feed_url:
            "<%= app.website.url %>rss/<%= grunt.config('create-website-news-rss.build.output.feed') %>",
          post_url: "<%= app.website.url &>news/",
          site_url: "<%= app.website.url %>",
          language: "en",
          pubDate: new Date().toUTCString(),
          ttl: 1800
        },
        output: { dir: "public/news", feed: "feed.rss" }
      }
    },
    "copy-website-content": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: {
          structure:
            "<%= grunt.config('create-website-structure.build.output') %>",
          news: "<%= grunt.config('create-website-news.build.output') %>"
        },
        target_dir: "public/website"
      }
    },
    jshint: {
      options: {
        reporter: require("jshint-stylish"),
        node: true,
        browserify: true
      },
      build: ["Gruntfile.js", "resources/assets/js/**/*.js"]
    },
    less: {
      options: {},
      build: {
        files: {
          "public/assets/skin/default/css/theme.css":
            "resources/assets/skin/default/less/theme.less",
          "public/assets/skin/bootstrap/bootstrap.css":
            "resources/assets/skin/bootstrap/bootstrap.less"
        }
      }
    },
    cssmin: {
      options: { banner: dstFileBanner },
      build: {
        files: {
          "public/assets/skin/default/css/theme.min.css":
            "public/assets/skin/default/css/theme.css",
          "public/assets/skin/bootstrap/bootstrap.min.css":
            "public/assets/skin/bootstrap/bootstrap.css"
        }
      }
    },
    concat: {
      options: { banner: dstFileBanner },
      vendor: {
        src: [
          "public/assets/skin/bootstrap/bootstrap.min.css",
          "node_modules/highlight.js/styles/github.css",
          "node_modules/angular-ui-notification/dist/angular-ui-notification.min.css",
          "node_modules/ng-tags-input/build/ng-tags-input.min.css",
          "node_modules/ng-tags-input/build/ng-tags-input.bootstrap.min.css",
          "node_modules/angular-typewriter/npm-dist/angular-typewrite.css",
          "node_modules/docsearch.js/dist/cdn/docsearch.min.css"
        ],
        dest: "public/assets/skin/vendor.css"
      },
      docsearchcss: {
        src: ["node_modules/docsearch.js/dist/cdn/docsearch.min.css"],
        dest: "public/vendor/docsearch.min.css"
      },
      docsearchjs: {
        src: ["node_modules/docsearch.js/dist/cdn/docsearch.min.js"],
        dest: "public/vendor/docsearch.min.js"
      },
      pacejs: {
        src: ["node_modules/pace-progress/pace.min.js"],
        dest: "public/vendor/pace.min.js"
      },
      pacecss: {
        src: ["node_modules/pace-progress/themes/blue/pace-theme-minimal.css"],
        dest: "public/vendor/pace.min.css"
      }
    },
    copy: {
      options: {},
      build: {
        files: [
          {
            cwd: "<%= global.repository.root %>/doc/images",
            src: [
              "qtgui.png",
              "web-gui-kdb.png",
              "oyranos-kolor-manager.png",
              "oyranos-km-logo.svg"
            ],
            dest:
              "<%= grunt.config('copy-website-content.build.target_dir') %>/img",
            expand: true
          }
        ]
      }
    },
    preprocess: {
      options: {
        context: {
          CONFIGURATION: "<%= grunt.file.read('application-config.json') %>",
          WEBSTRUCTURE: "<%= grunt.file.read('resources/structure.json') %>",
          NEWS: "<%= grunt.file.read('resources/news.json') %>",
          BUILDDATE: new Date().toUTCString()
        },
        type: "js"
      },
      config: {
        src: "resources/assets/js/config/index.js.in",
        dest: "resources/assets/js/config/index.js"
      },
      index: {
        src: "resources/assets/html/index.html.in",
        dest: "public/index.html"
      }
    },
    watch: {
      options: {},
      less: {
        files: ["resources/assets/skin/**/*"],
        tasks: ["less", "cssmin"]
      },
      preprocess: {
        files: [
          "application-config.json",
          "<%= grunt.config('create-website-structure.build.output') %>",
          "<%= grunt.config('create-website-news.build.output') %>"
        ],
        tasks: ["preprocess", "browserify:build"]
      },
      js: {
        files: ["public/assets/js/application.js"],
        tasks: [] // do nothing, the watcher only triggers browserify implicitly
      }
    },
    browserify: {
      options: {},
      build: {
        src: "resources/assets/js/application.js",
        dest: "resources/application.js.tmp",
        options: { banner: dstFileBanner, watch: true }
      }
    },
    uglify: {
      options: {
        compress: true,
        mangle: false,
        sourceMap: true,
        screwIE8: false
      },
      build: {
        files: {
          "public/assets/js/application.js": [
            "<%= grunt.config('browserify.build.dest') %>"
          ]
        }
      }
    },
    connect: {
      server: {
        options: {
          hostname: "*", // * for any
          port: 9000,
          protocol: "http",
          base: {
            path: "public",
            options: { index: "index.html", maxAge: 3600 }
          },
          keepalive: true,
          middleware: function(connect, options, middlewares) {
            //                        middlewares.unshift(function(req, res, next) {
            //                            grunt.log.writeln('URL: ' + req.url);
            //                            if(!grunt.file.exists('public', req.url)) {
            //                                req.redirect('index.html');
            //                            }
            //                            next();
            //                        });
            //                        return middlewares;
            var staticExtensions = [
              "html",
              "js",
              "css",
              "json",
              "svg",
              "md",
              "png",
              "jpg",
              "gif",
              "otf",
              "eot",
              "ttf",
              "woff",
              "woff2",
              "xml",
              "c",
              "h",
              "cpp",
              "hpp",
              "java",
              "py",
              "rss",
              "ini"
            ];
            return [
              modRewrite([
                "!" +
                  staticExtensions
                    .map(function(elem) {
                      return "\\." + elem;
                    })
                    .join("|") +
                  "$ /index.html [L]"
              ]),
              serveStatic("public")
            ];
          }
        }
      }
    }
  });

  grunt.loadNpmTasks("grunt-browserify");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-cssmin");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-less");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-preprocess");

  grunt.loadTasks("./resources/grunt-tasks");

  grunt.registerTask("default", ["full"]);
  grunt.registerTask("full", [
    "stylesheets",
    "website-news",
    "create-website-structure",
    "copy-website-content",
    "copy",
    "preprocess",
    "browserify:build",
    "uglify:build"
  ]);
  grunt.registerTask("install", [
    "stylesheets",
    "website-news",
    "create-website-structure",
    "copy-website-content",
    "copy",
    "preprocess",
    "browserify:build",
    "uglify:build"
  ]);
  grunt.registerTask("stylesheets", ["less", "cssmin", "concat"]);
  grunt.registerTask("website-news", [
    "create-website-news",
    "create-website-news-rss"
  ]);
  grunt.registerTask("server", ["connect"]);
};
<commit_msg>website: fix another instance of broken rss link<commit_after>var modRewrite = require("connect-modrewrite");
var serveStatic = require("serve-static");

module.exports = function(grunt) {
  var dstFileBanner =
    '/**\n * @application <%= pkg.name %>\n * @version <%= pkg.version %>\n * @updated <%= grunt.template.today("yyyy-mm-dd") %>\n * @author <%= pkg.author %>\n * @license <%= pkg.license %>\n */\n';

  // Project configuration.
  grunt.initConfig({
    app: grunt.file.readJSON("application-config.json"),
    pkg: grunt.file.readJSON("package.json"),
    global: {
      repository: { root: "@REST_FRONTEND_SOURCE_INSTALL_REPOSITORY@" }
    },
    "create-website-structure": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: "resources/structure.json.in",
        output: "resources/structure.json"
      }
    },
    "create-website-news": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        news_root: "doc/news",
        output: "resources/news.json",
        regex: {
          filename: {
            pattern: "^([0-9]{4}\\-[0-9]{2}\\-[0-9]{2})_(.*)$",
            flags: "i"
          },
          title: { pattern: "^# ([^#\n]*)$", flags: "im" },
          shortdesc: { pattern: "^- shortDesc: (.*)$", flags: "im" }
        }
      }
    },
    "create-website-news-rss": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: {
          news: "<%= grunt.config('create-website-news.build.output') %>"
        },
        regex: { guid: { pattern: "^\\- guid: ([a-fA-F0-9-]+)$", flags: "m" } },
        feed: {
          title: "Elektra's Blog",
          description: "News around Elektra",
          feed_url:
            "<%= app.website.url %>news/<%= grunt.config('create-website-news-rss.build.output.feed') %>",
          post_url: "<%= app.website.url &>news/",
          site_url: "<%= app.website.url %>",
          language: "en",
          pubDate: new Date().toUTCString(),
          ttl: 1800
        },
        output: { dir: "public/news", feed: "feed.rss" }
      }
    },
    "copy-website-content": {
      options: {},
      build: {
        repo_root: "<%= global.repository.root %>",
        input: {
          structure:
            "<%= grunt.config('create-website-structure.build.output') %>",
          news: "<%= grunt.config('create-website-news.build.output') %>"
        },
        target_dir: "public/website"
      }
    },
    jshint: {
      options: {
        reporter: require("jshint-stylish"),
        node: true,
        browserify: true
      },
      build: ["Gruntfile.js", "resources/assets/js/**/*.js"]
    },
    less: {
      options: {},
      build: {
        files: {
          "public/assets/skin/default/css/theme.css":
            "resources/assets/skin/default/less/theme.less",
          "public/assets/skin/bootstrap/bootstrap.css":
            "resources/assets/skin/bootstrap/bootstrap.less"
        }
      }
    },
    cssmin: {
      options: { banner: dstFileBanner },
      build: {
        files: {
          "public/assets/skin/default/css/theme.min.css":
            "public/assets/skin/default/css/theme.css",
          "public/assets/skin/bootstrap/bootstrap.min.css":
            "public/assets/skin/bootstrap/bootstrap.css"
        }
      }
    },
    concat: {
      options: { banner: dstFileBanner },
      vendor: {
        src: [
          "public/assets/skin/bootstrap/bootstrap.min.css",
          "node_modules/highlight.js/styles/github.css",
          "node_modules/angular-ui-notification/dist/angular-ui-notification.min.css",
          "node_modules/ng-tags-input/build/ng-tags-input.min.css",
          "node_modules/ng-tags-input/build/ng-tags-input.bootstrap.min.css",
          "node_modules/angular-typewriter/npm-dist/angular-typewrite.css",
          "node_modules/docsearch.js/dist/cdn/docsearch.min.css"
        ],
        dest: "public/assets/skin/vendor.css"
      },
      docsearchcss: {
        src: ["node_modules/docsearch.js/dist/cdn/docsearch.min.css"],
        dest: "public/vendor/docsearch.min.css"
      },
      docsearchjs: {
        src: ["node_modules/docsearch.js/dist/cdn/docsearch.min.js"],
        dest: "public/vendor/docsearch.min.js"
      },
      pacejs: {
        src: ["node_modules/pace-progress/pace.min.js"],
        dest: "public/vendor/pace.min.js"
      },
      pacecss: {
        src: ["node_modules/pace-progress/themes/blue/pace-theme-minimal.css"],
        dest: "public/vendor/pace.min.css"
      }
    },
    copy: {
      options: {},
      build: {
        files: [
          {
            cwd: "<%= global.repository.root %>/doc/images",
            src: [
              "qtgui.png",
              "web-gui-kdb.png",
              "oyranos-kolor-manager.png",
              "oyranos-km-logo.svg"
            ],
            dest:
              "<%= grunt.config('copy-website-content.build.target_dir') %>/img",
            expand: true
          }
        ]
      }
    },
    preprocess: {
      options: {
        context: {
          CONFIGURATION: "<%= grunt.file.read('application-config.json') %>",
          WEBSTRUCTURE: "<%= grunt.file.read('resources/structure.json') %>",
          NEWS: "<%= grunt.file.read('resources/news.json') %>",
          BUILDDATE: new Date().toUTCString()
        },
        type: "js"
      },
      config: {
        src: "resources/assets/js/config/index.js.in",
        dest: "resources/assets/js/config/index.js"
      },
      index: {
        src: "resources/assets/html/index.html.in",
        dest: "public/index.html"
      }
    },
    watch: {
      options: {},
      less: {
        files: ["resources/assets/skin/**/*"],
        tasks: ["less", "cssmin"]
      },
      preprocess: {
        files: [
          "application-config.json",
          "<%= grunt.config('create-website-structure.build.output') %>",
          "<%= grunt.config('create-website-news.build.output') %>"
        ],
        tasks: ["preprocess", "browserify:build"]
      },
      js: {
        files: ["public/assets/js/application.js"],
        tasks: [] // do nothing, the watcher only triggers browserify implicitly
      }
    },
    browserify: {
      options: {},
      build: {
        src: "resources/assets/js/application.js",
        dest: "resources/application.js.tmp",
        options: { banner: dstFileBanner, watch: true }
      }
    },
    uglify: {
      options: {
        compress: true,
        mangle: false,
        sourceMap: true,
        screwIE8: false
      },
      build: {
        files: {
          "public/assets/js/application.js": [
            "<%= grunt.config('browserify.build.dest') %>"
          ]
        }
      }
    },
    connect: {
      server: {
        options: {
          hostname: "*", // * for any
          port: 9000,
          protocol: "http",
          base: {
            path: "public",
            options: { index: "index.html", maxAge: 3600 }
          },
          keepalive: true,
          middleware: function(connect, options, middlewares) {
            //                        middlewares.unshift(function(req, res, next) {
            //                            grunt.log.writeln('URL: ' + req.url);
            //                            if(!grunt.file.exists('public', req.url)) {
            //                                req.redirect('index.html');
            //                            }
            //                            next();
            //                        });
            //                        return middlewares;
            var staticExtensions = [
              "html",
              "js",
              "css",
              "json",
              "svg",
              "md",
              "png",
              "jpg",
              "gif",
              "otf",
              "eot",
              "ttf",
              "woff",
              "woff2",
              "xml",
              "c",
              "h",
              "cpp",
              "hpp",
              "java",
              "py",
              "rss",
              "ini"
            ];
            return [
              modRewrite([
                "!" +
                  staticExtensions
                    .map(function(elem) {
                      return "\\." + elem;
                    })
                    .join("|") +
                  "$ /index.html [L]"
              ]),
              serveStatic("public")
            ];
          }
        }
      }
    }
  });

  grunt.loadNpmTasks("grunt-browserify");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-cssmin");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-less");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-preprocess");

  grunt.loadTasks("./resources/grunt-tasks");

  grunt.registerTask("default", ["full"]);
  grunt.registerTask("full", [
    "stylesheets",
    "website-news",
    "create-website-structure",
    "copy-website-content",
    "copy",
    "preprocess",
    "browserify:build",
    "uglify:build"
  ]);
  grunt.registerTask("install", [
    "stylesheets",
    "website-news",
    "create-website-structure",
    "copy-website-content",
    "copy",
    "preprocess",
    "browserify:build",
    "uglify:build"
  ]);
  grunt.registerTask("stylesheets", ["less", "cssmin", "concat"]);
  grunt.registerTask("website-news", [
    "create-website-news",
    "create-website-news-rss"
  ]);
  grunt.registerTask("server", ["connect"]);
};
<|endoftext|>


<commit_before>import React from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import injectSheet from "react-jss";
import { Row, Col } from "react-bootstrap/lib";
import { toRoman } from "roman-numerals";

import SubscriptionForm from "../../accounts/components/forms/SubscriptionForm";
import { subscribe } from "../../accounts/actions";
import { FacebookProvider, Comments } from 'react-facebook';
import { GoogleAdsense } from "../../advertisements/components";

const styles = {
  ArticleFooter: {
    fontFamily: "Minion Pro",
  },
  inPrint: {
    borderBottom: "1px solid #ddd",
    color: "#000",
    fontSize: "19px",
    fontStyle: "italic",
    lineHeight: 1.4,
    marginBottom: "14px",
    paddingBottom: "13px",
    "& a": {
      color: "#000",
      textDecoration: "underline",
      "&:hover, &:active, &:focus": {
        color: "#000",
      },
    },
  },
  subscriptionCTA: {
    color: "#000",
    fontSize: "19px",
    marginBottom: "10px",
  },
  subscriptionFormContainer: {
    marginBottom: "21px",
    "& > div > form": {
      display: "flex",
    },
    "& > div > form > div": {
      display: "inline-block",
    },
    "& > div > form > div:first-child": {
      width: "80%",
      "& > div > input": {
        // email input
        borderRadius: "3px 0 0 3px",
        width: "100%",
      },
    },
    "& > div > form > div:last-child": {
      width: "20%",
      "& > button": {
        // "Subscribe" button
        borderRadius: "0 3px 3px 0",
        margin: 0,
        width: "100%",
      },
    },
  },
  "@media (max-width: 991px)": {
    ArticleFooter: {
      padding: "0 10%",
    },
  },
  "@media (max-width: 767px)": {
    ArticleFooter: {
      padding: "0 2%",
    },
  },
};

const ArticleFooter = ({ classes, article, subscribe }) => {
  const { volume, issue, section } = article;
  return (
    <Row className={classes.ArticleFooter}>
      <Col xs={12} sm={12} md={8} lg={8}>

          This article appears in print in
          {section.permalink.includes('special-issues') ? (
            <Link to={section.permalink}>{section.name}</Link>, {section.description}
          ) : (

              {`Volume ${toRoman(volume)}, Issue ${issue}`}
              {/* TODO: Lookup table for individual volume/issue links */}

          )}.

          Never miss a Spectator issue again. Sign up for our newsletter
          to receive a weekly e-mail with staff-picked stories.

          <SubscriptionForm
            onSubmit={values => subscribe(values)}
            callToAction="Go"
          />

      </Col>
      <Col xsHidden smHidden md={4} lg={4} />
        <GoogleAdsense
          adClient='ca-pub-6227330768557696'
          adSlot='8432941751'
          style={{'display': 'block'}}
          adLayout='in-article'
          adFormat='auto'
          fullWidthResponsive='true'
        />
      <FacebookProvider appId='510092146640696'>
        <Comments href={`https://www.stuyspec.com${window.location.pathname}`} tabs="none" />
      </FacebookProvider>
    </Row>
  );
};

//ownProps so ArticleFooter gets semi typed props
const mapDispatchToProps = (dispatch, ownProps) => {
  return bindActionCreators({ subscribe }, dispatch);
};

export default connect(null, mapDispatchToProps)(
  injectSheet(styles)(ArticleFooter),
);
<commit_msg>added div to googlead<commit_after>import React from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import injectSheet from "react-jss";
import { Row, Col } from "react-bootstrap/lib";
import { toRoman } from "roman-numerals";

import SubscriptionForm from "../../accounts/components/forms/SubscriptionForm";
import { subscribe } from "../../accounts/actions";
import { FacebookProvider, Comments } from 'react-facebook';
import { GoogleAdsense } from "../../advertisements/components";

const styles = {
  ArticleFooter: {
    fontFamily: "Minion Pro",
  },
  inPrint: {
    borderBottom: "1px solid #ddd",
    color: "#000",
    fontSize: "19px",
    fontStyle: "italic",
    lineHeight: 1.4,
    marginBottom: "14px",
    paddingBottom: "13px",
    "& a": {
      color: "#000",
      textDecoration: "underline",
      "&:hover, &:active, &:focus": {
        color: "#000",
      },
    },
  },
  subscriptionCTA: {
    color: "#000",
    fontSize: "19px",
    marginBottom: "10px",
  },
  subscriptionFormContainer: {
    marginBottom: "21px",
    "& > div > form": {
      display: "flex",
    },
    "& > div > form > div": {
      display: "inline-block",
    },
    "& > div > form > div:first-child": {
      width: "80%",
      "& > div > input": {
        // email input
        borderRadius: "3px 0 0 3px",
        width: "100%",
      },
    },
    "& > div > form > div:last-child": {
      width: "20%",
      "& > button": {
        // "Subscribe" button
        borderRadius: "0 3px 3px 0",
        margin: 0,
        width: "100%",
      },
    },
  },
  "@media (max-width: 991px)": {
    ArticleFooter: {
      padding: "0 10%",
    },
  },
  "@media (max-width: 767px)": {
    ArticleFooter: {
      padding: "0 2%",
    },
  },
};

const ArticleFooter = ({ classes, article, subscribe }) => {
  const { volume, issue, section } = article;
  return (
    <Row className={classes.ArticleFooter}>
      <Col xs={12} sm={12} md={8} lg={8}>

          This article appears in print in
          {section.permalink.includes('special-issues') ? (
            <Link to={section.permalink}>{section.name}</Link>, {section.description}
          ) : (

              {`Volume ${toRoman(volume)}, Issue ${issue}`}
              {/* TODO: Lookup table for individual volume/issue links */}

          )}.

          Never miss a Spectator issue again. Sign up for our newsletter
          to receive a weekly e-mail with staff-picked stories.

          <SubscriptionForm
            onSubmit={values => subscribe(values)}
            callToAction="Go"
          />

      </Col>
      <Col xsHidden smHidden md={4} lg={4} />

        <GoogleAdsense
          adClient='ca-pub-6227330768557696'
          adSlot='8432941751'
          style={{'display': 'block'}}
          adLayout='in-article'
          adFormat='auto'
          fullWidthResponsive='true'
        />

      <FacebookProvider appId='510092146640696'>
        <Comments href={`https://www.stuyspec.com${window.location.pathname}`} tabs="none" />
      </FacebookProvider>
    </Row>
  );
};

//ownProps so ArticleFooter gets semi typed props
const mapDispatchToProps = (dispatch, ownProps) => {
  return bindActionCreators({ subscribe }, dispatch);
};

export default connect(null, mapDispatchToProps)(
  injectSheet(styles)(ArticleFooter),
);
<|endoftext|>


<commit_before>import React from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import injectSheet from "react-jss";
import { Row, Col } from "react-bootstrap/lib";
import { toRoman } from "roman-numerals";

import SubscriptionForm from "../../accounts/components/forms/SubscriptionForm";
import { subscribe } from "../../accounts/actions";
import { GoogleAdsense } from "../../advertisements/components";

const styles = {
  ArticleFooter: {
    fontFamily: "Minion Pro",
  },
  inPrint: {
    borderBottom: "1px solid #ddd",
    color: "#000",
    fontSize: "19px",
    fontStyle: "italic",
    lineHeight: 1.4,
    marginBottom: "14px",
    paddingBottom: "13px",
    "& a": {
      color: "#000",
      textDecoration: "underline",
      "&:hover, &:active, &:focus": {
        color: "#000",
      },
    },
  },
  subscriptionCTA: {
    color: "#000",
    fontSize: "19px",
    marginBottom: "10px",
  },
  subscriptionFormContainer: {
    marginBottom: "21px",
    "& > div > form": {
      display: "flex",
    },
    "& > div > form > div": {
      display: "inline-block",
    },
    "& > div > form > div:first-child": {
      width: "80%",
      "& > div > input": {
        // email input
        borderRadius: "3px 0 0 3px",
        width: "100%",
      },
    },
    "& > div > form > div:last-child": {
      width: "20%",
      "& > button": {
        // "Subscribe" button
        borderRadius: "0 3px 3px 0",
        margin: 0,
        width: "100%",
      },
    },
  },
  "@media (max-width: 991px)": {
    ArticleFooter: {
      padding: "0 10%",
    },
  },
  "@media (max-width: 767px)": {
    ArticleFooter: {
      padding: "0 2%",
    },
  },
};

const ArticleFooter = ({ classes, article, subscribe }) => {
  const { volume, issue, section } = article;
  return (
    <Row className={classes.ArticleFooter}>
      <Col xs={12} sm={12} md={8} lg={8}>

          This article appears in print in
          {section.permalink.includes('special-issues') ? (
            <Link to={section.permalink}>{section.name}</Link>, {section.description}
          ) : (

              {`Volume ${toRoman(volume)}, Issue ${issue}`}
              {/* TODO: Lookup table for individual volume/issue links */}

          )}.

          Never miss a Spectator issue again. Sign up for our newsletter
          to receive a weekly e-mail with staff-picked stories.

          <SubscriptionForm
            onSubmit={values => subscribe(values)}
            callToAction="Go"
          />

      </Col>

        <GoogleAdsense
          adClient='ca-pub-6227330768557696'
          adSlot='7357348018'
          style={{'display:block; text-align:center;'}}
          adLayout='in-article'
          adFormat='fluid'
        />

    </Row>
  );
};

//ownProps so ArticleFooter gets semi typed props
const mapDispatchToProps = (dispatch, ownProps) => {
  return bindActionCreators({ subscribe }, dispatch);
};

export default connect(null, mapDispatchToProps)(
  injectSheet(styles)(ArticleFooter),
);
<commit_msg>footer<commit_after>import React from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import injectSheet from "react-jss";
import { Row, Col } from "react-bootstrap/lib";
import { toRoman } from "roman-numerals";

import SubscriptionForm from "../../accounts/components/forms/SubscriptionForm";
import { subscribe } from "../../accounts/actions";
import { GoogleAdsense } from "../../advertisements/components";

const styles = {
  ArticleFooter: {
    fontFamily: "Minion Pro",
  },
  inPrint: {
    borderBottom: "1px solid #ddd",
    color: "#000",
    fontSize: "19px",
    fontStyle: "italic",
    lineHeight: 1.4,
    marginBottom: "14px",
    paddingBottom: "13px",
    "& a": {
      color: "#000",
      textDecoration: "underline",
      "&:hover, &:active, &:focus": {
        color: "#000",
      },
    },
  },
  subscriptionCTA: {
    color: "#000",
    fontSize: "19px",
    marginBottom: "10px",
  },
  subscriptionFormContainer: {
    marginBottom: "21px",
    "& > div > form": {
      display: "flex",
    },
    "& > div > form > div": {
      display: "inline-block",
    },
    "& > div > form > div:first-child": {
      width: "80%",
      "& > div > input": {
        // email input
        borderRadius: "3px 0 0 3px",
        width: "100%",
      },
    },
    "& > div > form > div:last-child": {
      width: "20%",
      "& > button": {
        // "Subscribe" button
        borderRadius: "0 3px 3px 0",
        margin: 0,
        width: "100%",
      },
    },
  },
  "@media (max-width: 991px)": {
    ArticleFooter: {
      padding: "0 10%",
    },
  },
  "@media (max-width: 767px)": {
    ArticleFooter: {
      padding: "0 2%",
    },
  },
};

const ArticleFooter = ({ classes, article, subscribe }) => {
  const { volume, issue, section } = article;
  return (
    <Row className={classes.ArticleFooter}>
      <Col xs={12} sm={12} md={8} lg={8}>

          This article appears in print in
          {section.permalink.includes('special-issues') ? (
            <Link to={section.permalink}>{section.name}</Link>, {section.description}
          ) : (

              {`Volume ${toRoman(volume)}, Issue ${issue}`}
              {/* TODO: Lookup table for individual volume/issue links */}

          )}.

          Never miss a Spectator issue again. Sign up for our newsletter
          to receive a weekly e-mail with staff-picked stories.

          <SubscriptionForm
            onSubmit={values => subscribe(values)}
            callToAction="Go"
          />

      </Col>

        <GoogleAdsense
          adClient='ca-pub-6227330768557696'
          adSlot='7357348018'
          style=
            {{
              'display':'block',
              'text-align':'center'
            }}
          adLayout='in-article'
          adFormat='fluid'
        />

    </Row>
  );
};

//ownProps so ArticleFooter gets semi typed props
const mapDispatchToProps = (dispatch, ownProps) => {
  return bindActionCreators({ subscribe }, dispatch);
};

export default connect(null, mapDispatchToProps)(
  injectSheet(styles)(ArticleFooter),
);
<|endoftext|>