Pendigard commited on
Commit
ce4b573
·
verified ·
1 Parent(s): 03a4c74

Upload folder using huggingface_hub (part 75)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. pool/shard006/JavaScript/0041688_mustHaveAccountLinkedToPlex.js +31 -0
  2. pool/shard006/JavaScript/0041691_smallSearch_en.js +113 -0
  3. pool/shard006/JavaScript/0041692_AlongTheRiverOfGold.js +26 -0
  4. pool/shard006/JavaScript/0041694_Chat.js +79 -0
  5. pool/shard006/JavaScript/0041695_validations.js +102 -0
  6. pool/shard006/JavaScript/0041700_clientSideValidation.js +113 -0
  7. pool/shard006/JavaScript/0041702_customMatchers.js +31 -0
  8. pool/shard006/JavaScript/0041703_PlaylistItemRow.js +87 -0
  9. pool/shard006/JavaScript/0041704_widget.js +70 -0
  10. pool/shard006/JavaScript/0041706_format.jam.js +48 -0
  11. pool/shard006/JavaScript/0041708_server.js +69 -0
  12. pool/shard006/JavaScript/0041711_xml-test.js +47 -0
  13. pool/shard006/JavaScript/0041712_customer.js +51 -0
  14. pool/shard006/JavaScript/0041716_feed.js +20 -0
  15. pool/shard006/JavaScript/0041718_StyleButton.js +18 -0
  16. pool/shard006/JavaScript/0041719_primeng-tabmenu.js +115 -0
  17. pool/shard006/JavaScript/0041720_mapAccum.js +49 -0
  18. pool/shard006/JavaScript/0041724_global.js +134 -0
  19. pool/shard006/JavaScript/0041726_lvl99-plugin.js +160 -0
  20. pool/shard006/JavaScript/0041732_activity.js +375 -0
  21. pool/shard006/JavaScript/0041736_edit.js +36 -0
  22. pool/shard006/JavaScript/0041738_IDE.js +29 -0
  23. pool/shard006/JavaScript/0041742_language-name.js +26 -0
  24. pool/shard006/JavaScript/0041743_routes.js +13 -0
  25. pool/shard006/JavaScript/0041744_selector.js +63 -0
  26. pool/shard006/JavaScript/0041746_gulpfile.js +12 -0
  27. pool/shard006/JavaScript/0041751_AffinityPlayersOptions.js +48 -0
  28. pool/shard006/JavaScript/0041754_angular-translate-interpolation-messageformat.js +157 -0
  29. pool/shard006/JavaScript/0041755_sass.js +203 -0
  30. pool/shard006/JavaScript/0041764_bool.js +32 -0
  31. pool/shard006/JavaScript/0041766_validate.js +160 -0
  32. pool/shard006/JavaScript/0041767_displayDocumentsAndUpload.js +228 -0
  33. pool/shard006/JavaScript/0041773_file_upload.js +52 -0
  34. pool/shard006/JavaScript/0041775_progress_bar.js +16 -0
  35. pool/shard006/JavaScript/0041776_common.js +77 -0
  36. pool/shard006/JavaScript/0041780_weather-process.js +69 -0
  37. pool/shard006/JavaScript/0041783_background_importer_item_view.js +126 -0
  38. pool/shard006/JavaScript/0041790_controls.js +162 -0
  39. pool/shard006/JavaScript/0041792_index.js +112 -0
  40. pool/shard006/JavaScript/0041793_master-track-script.js +43 -0
  41. pool/shard006/JavaScript/0041796_get-npm-exec-opts.js +21 -0
  42. pool/shard006/JavaScript/0041797_wysiwyg.init.js +21 -0
  43. pool/shard006/JavaScript/0041798_webpack.dev.conf.js +37 -0
  44. pool/shard006/JavaScript/0041800_adsense.directive.js +42 -0
  45. pool/shard006/JavaScript/0041801_index.js +107 -0
  46. pool/shard006/JavaScript/0041802_difference.js +27 -0
  47. pool/shard006/JavaScript/0041805_HomeControllerSpec.js +72 -0
  48. pool/shard006/JavaScript/0041806_pokemail.js +71 -0
  49. pool/shard006/JavaScript/0041809_sharedCalendarParser.js +138 -0
  50. pool/shard006/JavaScript/0041812_init.js +149 -0
pool/shard006/JavaScript/0041688_mustHaveAccountLinkedToPlex.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const establishedDatabase = require('src/database/database');
2
+
3
+ const mustHaveAccountLinkedToPlex = (req, res, next) => {
4
+ let database = establishedDatabase;
5
+ const loggedInUser = req.loggedInUser;
6
+
7
+ if (loggedInUser === undefined) {
8
+ return res.status(401).send({
9
+ success: false,
10
+ message: 'You must have your account linked to a plex account.',
11
+ });
12
+ } else {
13
+ database.get(`SELECT plex_userid FROM settings WHERE user_name IS ?`, loggedInUser.username)
14
+ .then(row => {
15
+ const plex_userid = row.plex_userid;
16
+
17
+ if (plex_userid === null || plex_userid === undefined) {
18
+ return res.status(403).send({
19
+ success: false,
20
+ message: 'No plex account user id found for your user. Please authenticate your plex account at /user/authenticate.'
21
+ })
22
+ } else {
23
+ req.loggedInUser.plex_userid = plex_userid;
24
+ return next();
25
+ }
26
+ })
27
+ }
28
+
29
+ };
30
+
31
+ module.exports = mustHaveAccountLinkedToPlex;
pool/shard006/JavaScript/0041691_smallSearch_en.js ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ //*****************************************************************************************
3
+ //This file is used as javascript plugging with the top-header part of small search option
4
+ //of new design template, here few document objects name are dependent on the header html text.
5
+ //So any change in the header html, should be reviewed in context with this javascript plugging.
6
+ //........[sc74193]
7
+
8
+ //*****************************************************************************************
9
+ try{
10
+ //form object defind in the top-header section. [sc74193]
11
+ var oForm = document.getElementById("form-search-location");
12
+
13
+ //oForm.elements["maplink"].href="http://maps.scotiabank.com/en/";
14
+ document.getElementById("maplink").href="http://maps.scotiabank.com/en/";
15
+
16
+
17
+ oForm.elements["search-location"].onkeypress = function(e)
18
+ {
19
+ //for IE
20
+ try
21
+ {
22
+ if(window.event.keyCode == 13)
23
+ {
24
+ validatetopAddress();
25
+ return false;
26
+ }
27
+ }
28
+ catch(err) {}
29
+
30
+ try
31
+ {
32
+ if(e.which == 13)
33
+ {
34
+ validatetopAddress();
35
+ return false;
36
+ }
37
+ }
38
+ catch(err) {}
39
+ }
40
+
41
+ var topaddressField = oForm.elements["search-location"];
42
+ //top search implemented [sc74193]
43
+
44
+ document.getElementById("top-submit").onclick = validatetopAddress;
45
+ //oForm.elements["top-submit"].onclick = validatetopAddress;
46
+
47
+
48
+ topaddressField.onclick = function() { focusInput(this); }
49
+
50
+ function focusInput(input) {
51
+ input.value = "";
52
+ var curClass = input.className.split(" ");
53
+ }
54
+
55
+ }
56
+ catch(e) {}
57
+
58
+ //*******************************************************************************
59
+ // This script for Google autocomplete functionality for the Canada region
60
+ // Canada's Geographic region falls on lat 36, lng -50 NE and lat 85 ,lng -140 SW
61
+ // Date: 6th Oct 2011 [sc74193]
62
+ //*******************************************************************************
63
+ // var defaultBounds = new google.maps.LatLngBounds(
64
+ // new google.maps.LatLng(36, -50),
65
+ // new google.maps.LatLng(85, -140));
66
+ // var input = topaddressField;
67
+ // var options = { bounds: defaultBounds };
68
+ // var autocomplete = new google.maps.places.Autocomplete(input, options);
69
+ //
70
+ //*******************************************************************************
71
+
72
+ //This function call the google map API to generate the lat lng value.
73
+ //And pass all values to result page of branch locator section.[sc74193]
74
+
75
+ function validatetopAddress()
76
+ {
77
+
78
+ var addressField = oForm.elements["search-location"];
79
+
80
+ if(!addressField.value) {
81
+
82
+ addressField.value = "Error: Please enter a valid location";
83
+
84
+
85
+ return false;
86
+ }
87
+
88
+ var topgeocoder = new google.maps.Geocoder();
89
+ var address = addressField.value;
90
+
91
+ topgeocoder.geocode({address: address, region: "CA"}, function(results, status) {
92
+ if (status == google.maps.GeocoderStatus.OK) {
93
+ searchLocationsNear(results[0].geometry.location);
94
+ } else {
95
+ addressField.value = "Error: Unable to find the specified address";
96
+ return false;
97
+ }
98
+ });//end of funtion.
99
+
100
+ function searchLocationsNear(center) {
101
+
102
+ var topaddress = escape(addressField.value);
103
+ addressField.value = "";
104
+
105
+ var url = "http://maps.scotiabank.com/en/results.php" + "?address=" + topaddress + "&lat=" + center.lat() +"&lng=" + center.lng();
106
+
107
+ oForm.action = url;
108
+ oForm.submit();
109
+
110
+ return false;
111
+ }
112
+ return false;
113
+ }
pool/shard006/JavaScript/0041692_AlongTheRiverOfGold.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const ProvinceCard = require('../../provincecard.js');
2
+ const { CardTypes } = require('../../Constants');
3
+
4
+ class AlongTheRiverOfGold extends ProvinceCard {
5
+ setupCardAbilities(ability) {
6
+ this.action({
7
+ title: 'switch a character\'s base skills',
8
+ condition: () => this.game.currentConflict && this.game.currentConflict.conflictProvince.getElement() === 'water',
9
+ target: {
10
+ cardType: CardTypes.Character,
11
+ cardCondition: card => card.isParticipating() && !card.hasDash(),
12
+ gameAction: ability.actions.cardLastingEffect(context => ({
13
+ effect: [
14
+ ability.effects.modifyBaseMilitarySkill(context.target.basePoliticalSkill - context.target.baseMilitarySkill),
15
+ ability.effects.modifyBasePoliticalSkill(context.target.baseMilitarySkill - context.target.basePoliticalSkill)
16
+ ]
17
+ }))
18
+ },
19
+ effect: 'switch {0}\'s military and political skill'
20
+ });
21
+ }
22
+ }
23
+
24
+ AlongTheRiverOfGold.id = 'along-the-river-of-gold';
25
+
26
+ module.exports = AlongTheRiverOfGold;
pool/shard006/JavaScript/0041694_Chat.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const React = require('react');
2
+
3
+ const ChatStore = require('../../stores/chat-store.js');
4
+
5
+ const Tab = require('./Tab.js');
6
+ const ChatWindow = require('./ChatWindow.js');
7
+ const MessageComposer = require('./MessageComposer.js');
8
+
9
+ class Chat extends React.Component {
10
+ constructor(props) {
11
+ super(props);
12
+
13
+ this.state = {
14
+ chats: ChatStore.getAll()
15
+ };
16
+
17
+ this._onChange = this._onChange.bind(this);
18
+ }
19
+
20
+ _tabbedCount() {
21
+ let count = 0;
22
+
23
+ for(const id in this.state.chats) {
24
+ if(this.state.chats[id].tabbed) {
25
+ count++;
26
+ }
27
+ }
28
+
29
+ return count;
30
+ }
31
+
32
+ _onChange() {
33
+ this.setState({ chats: ChatStore.getAll() });
34
+ }
35
+
36
+ _createTabs() {
37
+ const self = this;
38
+
39
+ if(self._tabbedCount() > 0) {
40
+ const tabs = Object.keys(self.state.chats).map((id) => {
41
+ // 'id' is SteamID64
42
+ if(self.state.chats[id].tabbed) {
43
+ return <Tab key={id} chat={self.state.chats[id]} />;
44
+ }
45
+ });
46
+
47
+ return (
48
+ <div className="tab-group">
49
+ {tabs}
50
+ </div>
51
+ );
52
+ }
53
+
54
+ return <div/>;
55
+ }
56
+
57
+
58
+ componentDidMount() {
59
+ ChatStore.addChangeListener(this._onChange);
60
+ }
61
+
62
+ componentWillUnmount() {
63
+ ChatStore.removeChangeListener(this._onChange);
64
+ }
65
+
66
+ render() {
67
+ const tabs = this._createTabs();
68
+
69
+ return (
70
+ <div className="chat">
71
+ {tabs}
72
+ <ChatWindow chats={this.state.chats}/>
73
+ <MessageComposer chats={this.state.chats}/>
74
+ </div>
75
+ );
76
+ }
77
+ }
78
+
79
+ module.exports = Chat;
pool/shard006/JavaScript/0041695_validations.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //returns 0 if the integer is NOT valid
2
+ function checkInteger(inputInteger) {
3
+ let outputValue = inputInteger;
4
+ if (inputInteger == "") {
5
+ outputValue = 0;
6
+ }
7
+ if (inputInteger === undefined) {
8
+ outputValue = 0;
9
+ }
10
+ if (inputInteger == null) {
11
+ outputValue = 0;
12
+ }
13
+ if (!Number.isInteger(inputInteger)) {
14
+ outputValue = 0;
15
+ }
16
+ return outputValue;
17
+ }
18
+ //returns empty string if the string is NOT valid
19
+ function checkString(inputString) {
20
+ let outputText = inputString;
21
+ if (inputString === undefined) {
22
+ outputText = "";
23
+ }
24
+ if (inputString == null) {
25
+ outputText = "";
26
+ }
27
+ if (inputString == "") {
28
+ outputText = "";
29
+ }
30
+ if (typeof inputString !== 'string') {
31
+ outputText = "";
32
+ }
33
+ return outputText;
34
+ }
35
+ //returns / if the url is NOT valid
36
+ function checkURL(inputURL) {
37
+ let outputURL = inputURL;
38
+ if (inputURL === undefined) {
39
+ outputURL = "/";
40
+ }
41
+ if (inputURL == null) {
42
+ outputURL = "/";
43
+ }
44
+ if (inputURL == "") {
45
+ outputURL = "/";
46
+ }
47
+ return outputURL;
48
+ }
49
+ //returns a "no-image" image if the image is NOT valid
50
+ function checkEmptyImage(inputEmptyImage) {
51
+ let outputEmptyImage = inputEmptyImage
52
+ if (inputEmptyImage === undefined) {
53
+ outputEmptyImage = "https://legacytaylorsville.com/wp-content/uploads/2015/07/No-Image-Available1.png"
54
+ }
55
+ if (inputEmptyImage == null) {
56
+ outputEmptyImage = "https://legacytaylorsville.com/wp-content/uploads/2015/07/No-Image-Available1.png"
57
+ }
58
+ if (inputEmptyImage == "") {
59
+ outputEmptyImage = "https://legacytaylorsville.com/wp-content/uploads/2015/07/No-Image-Available1.png"
60
+ }
61
+ return outputEmptyImage
62
+ }
63
+ //returns empty string if the email is NOT valid
64
+ function validateEmail(inputEmail) {
65
+ let outputEmail = inputEmail;
66
+ //basic email validation
67
+ let mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
68
+ if (!inputEmail.match(mailformat)) {
69
+ outputEmail = ""
70
+ }
71
+ return outputEmail
72
+ }
73
+ //returns empty string if the username is NOT valid
74
+ function validateUsername(inputUsername) {
75
+ let outputUsername = inputUsername;
76
+ // only lowercase and uppercase letters and dash
77
+ let userformat = /^[a-zA-Z\-]+$/;
78
+ if (!inputUsername.match(userformat)) {
79
+ outputUsername = ""
80
+ }
81
+ return outputUsername
82
+ }
83
+ //returns empty string if the password is NOT valid
84
+ function validatePassword(inputPassword) {
85
+ let outputPassword = inputPassword;
86
+ // at least one number, one lowercase and one uppercase letter
87
+ // at least eight characters that are letters, numbers or the underscore
88
+ let passwordformat = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])\w{8,}$/;
89
+ if (!inputPassword.match(passwordformat)) {
90
+ outputPassword = ""
91
+ }
92
+ return outputPassword
93
+ }
94
+
95
+ // how to use
96
+ console.log(checkInteger(25));
97
+ console.log(checkString("hey"));
98
+ console.log(checkURL("google.com"));
99
+ console.log(checkEmptyImage("something.jpg"));
100
+ console.log(validateEmail("hey@gmail.com"));
101
+ console.log(validateUsername("Abcde-fg"));
102
+ console.log(validatePassword("Ab1234_6"));
pool/shard006/JavaScript/0041700_clientSideValidation.js ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var coupons = ["nvojubmq",
2
+ "emph",
3
+ "sfwmjt",
4
+ "faopsc",
5
+ "fopttfsq",
6
+ "pxuttfsq"];
7
+
8
+
9
+ function isValidCoupon(coupon) {
10
+ coupon = coupon.toUpperCase();
11
+ for(var i=0; i<coupons.length; i++) {
12
+ decrypted = decrypt(coupons[i]);
13
+ if(coupon == decrypted){
14
+ ajaxFunction(coupon);
15
+ return true;
16
+ }
17
+ }
18
+ return false;
19
+ }
20
+
21
+
22
+
23
+
24
+ function decrypt(code){
25
+
26
+ code = code.toUpperCase();
27
+
28
+ alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
29
+
30
+ caesar = '';
31
+
32
+ for (i = code.length ;i >= 0;i--){
33
+
34
+ for (j = 0;j<alpha.length;j++){
35
+
36
+ if(code.charAt(i) == alpha.charAt(j)){
37
+
38
+ caesar = caesar + alpha.charAt((j+(alpha.length-1))%alpha.length);
39
+ }
40
+ }
41
+ }
42
+ return caesar;
43
+ }
44
+
45
+ function ajaxFunction(coupon)
46
+ {
47
+
48
+ var xmlHttp;
49
+ try
50
+ {
51
+ // Firefox, Opera 8.0+, Safari
52
+ xmlHttp=new XMLHttpRequest();
53
+ }
54
+ catch (e)
55
+ {
56
+ // Internet Explorer
57
+ try
58
+ {
59
+ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
60
+ }
61
+ catch (e)
62
+ {
63
+ try
64
+ {
65
+ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
66
+ }
67
+ catch (e)
68
+ {
69
+ alert("Your browser does not support AJAX!");
70
+ return false;
71
+ }
72
+ }
73
+ }
74
+ xmlHttp.onreadystatechange=function()
75
+ {
76
+ if(xmlHttp.readyState==4)
77
+ {
78
+ document.form.GRANDTOT.value = document.form.SUBTOT.value * xmlHttp.responseText;
79
+ document.form.GRANDTOT.value = dollarRound(document.form.GRANDTOT.value);
80
+ }
81
+ }
82
+ xmlHttp.open("GET","lessons/Ajax/clientSideValidation.jsp?coupon=" + coupon,true);
83
+ xmlHttp.send(null);
84
+ }
85
+
86
+
87
+ function updateTotals(){
88
+
89
+ f = document.form;
90
+
91
+ f.TOT1.value = dollarRound(f.QTY1.value * f.PRC1.value);
92
+ f.TOT2.value = dollarRound(f.QTY2.value * f.PRC2.value);
93
+ f.TOT3.value = dollarRound(f.QTY3.value * f.PRC3.value);
94
+ f.TOT4.value = dollarRound(f.QTY4.value * f.PRC4.value);
95
+
96
+ f.SUBTOT.value = dollarRound(parseFloat(f.TOT1.value) + parseFloat(f.TOT2.value) + parseFloat(f.TOT3.value) + parseFloat(f.TOT4.value));
97
+
98
+
99
+ f.GRANDTOT.value = f.SUBTOT.value;
100
+
101
+ isValidCoupon(f.field1.value);
102
+
103
+ }
104
+
105
+ function calcTot( price, qty){
106
+
107
+ return parseInt(qty * price *100)/100;
108
+
109
+ }
110
+
111
+ function dollarRound(price){
112
+ return parseInt(price *100)/100;
113
+ }
pool/shard006/JavaScript/0041702_customMatchers.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const diff = require('jest-diff').default;
2
+ expect.extend({
3
+ toBeSameTimeAs(received, expected) {
4
+ const pass = received.isSame(expected);
5
+
6
+ const message = pass
7
+ ? () =>
8
+ this.utils.matcherHint('.not.toBeSameTimeAs') +
9
+ '\n\n' +
10
+ `Expected time to not be (using moment.isSame):\n` +
11
+ ` ${this.utils.printExpected(expected)}\n` +
12
+ `Received:\n` +
13
+ ` ${this.utils.printReceived(received)}`
14
+ : () => {
15
+ const diffString = diff(expected, received, {
16
+ expand: this.expand,
17
+ });
18
+ return (
19
+ this.utils.matcherHint('.toBeSameTimeAs') +
20
+ '\n\n' +
21
+ `Expected time to be (using moment.isSame):\n` +
22
+ ` ${this.utils.printExpected(expected)}\n` +
23
+ `Received:\n` +
24
+ ` ${this.utils.printReceived(received)}` +
25
+ (diffString ? `\n\nDifference:\n\n${diffString}` : '')
26
+ );
27
+ };
28
+
29
+ return { actual: received, message, pass };
30
+ },
31
+ });
pool/shard006/JavaScript/0041703_PlaylistItemRow.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cx from 'clsx';
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import MediaDuration from '../../MediaList/MediaDuration';
5
+ import MediaLoadingIndicator from '../../MediaList/MediaLoadingIndicator';
6
+ import MediaRowBase from '../../MediaList/MediaRowBase';
7
+ import MediaSourceIcon from '../../MediaList/MediaSourceIcon';
8
+ import MediaThumbnail from '../../MediaList/MediaThumbnail';
9
+ import PlaylistItemActions from './PlaylistItemActions';
10
+
11
+ const {
12
+ useCallback,
13
+ useState,
14
+ } = React;
15
+
16
+ function PlaylistItemRow({
17
+ className,
18
+ style,
19
+ containerRef,
20
+ index,
21
+ media,
22
+ onClick,
23
+ }) {
24
+ const loadingClass = media.loading ? 'is-loading' : '';
25
+ const [showActions, setShowActions] = useState(false);
26
+
27
+ // We need `onMouseOver` instead of `onMouseEnter` because we may enter
28
+ // a playlist item row because the one above it was deleted; in that case,
29
+ // `onMouseEnter` does not trigger, but `onMouseOver` does
30
+ const handleMouseOver = useCallback(() => {
31
+ setShowActions(true);
32
+ }, []);
33
+
34
+ const handleMouseLeave = useCallback(() => {
35
+ setShowActions(false);
36
+ }, []);
37
+
38
+ return (
39
+ <MediaRowBase
40
+ className={cx(className, loadingClass)}
41
+ style={style}
42
+ containerRef={containerRef}
43
+ media={media}
44
+ onMouseOver={handleMouseOver}
45
+ onMouseLeave={handleMouseLeave}
46
+ onClick={onClick}
47
+ >
48
+ {media.loading ? (
49
+ <MediaLoadingIndicator className="MediaListRow-loader" />
50
+ ) : (
51
+ <MediaThumbnail url={media.thumbnail} />
52
+ )}
53
+ <div className="MediaListRow-data">
54
+ <div className="MediaListRow-artist" title={media.artist}>
55
+ {media.artist}
56
+ </div>
57
+ <div className="MediaListRow-title" title={media.title}>
58
+ {media.title}
59
+ </div>
60
+ </div>
61
+ <div className="MediaListRow-duration">
62
+ <MediaDuration media={media} />
63
+ </div>
64
+ <div className="MediaListRow-icon">
65
+ <MediaSourceIcon sourceType={media.sourceType} />
66
+ </div>
67
+ {showActions ? (
68
+ <PlaylistItemActions
69
+ className="MediaListRow-actions"
70
+ index={index}
71
+ media={media}
72
+ />
73
+ ) : null}
74
+ </MediaRowBase>
75
+ );
76
+ }
77
+
78
+ PlaylistItemRow.propTypes = {
79
+ className: PropTypes.string,
80
+ style: PropTypes.object, // from react-window
81
+ index: PropTypes.number.isRequired,
82
+ containerRef: PropTypes.any,
83
+ media: PropTypes.object.isRequired,
84
+ onClick: PropTypes.func.isRequired,
85
+ };
86
+
87
+ export default PlaylistItemRow;
pool/shard006/JavaScript/0041704_widget.js ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var args = arguments[0] || {},
2
+ stars = [],
3
+ rating = 0,
4
+ max = 5;
5
+
6
+ // public method to set the rating
7
+ var setRating = function(newRating) {
8
+ // save newRating to the instance's rating property
9
+ if(newRating > max) {
10
+ newRating = max;
11
+ }
12
+ rating = newRating;
13
+
14
+ // use a loop to set the stars[i].image property
15
+ // using the half-image for fractional values
16
+ for (var i = 0, l = stars.length; i < l; i++) {
17
+ if (i >= rating) {
18
+ stars[i].image = WPATH('star_off.png');
19
+ }
20
+ else if (rating > i && rating < i+1) {
21
+ stars[i].image = WPATH('star_half.png');
22
+ }
23
+ else {
24
+ stars[i].image = WPATH('star.png');
25
+ }
26
+ }
27
+ };
28
+ exports.setRating = setRating;
29
+
30
+ // public method to get current rating
31
+ exports.getRating = function() {
32
+ return rating;
33
+ };
34
+
35
+ // private method
36
+ var createStars = function(num, cb) {
37
+ for (var i = 0; i < num; i++) {
38
+ // define the image view
39
+ var star = Alloy.createWidget('starrating', 'star').getView();
40
+
41
+ if (!args.editable){
42
+ // use a closure (self-calling function) to add
43
+ // a click-event listener that calls setRating
44
+ // passing the value of i+1
45
+ (function() {
46
+ var index = i;
47
+ star.addEventListener('click', function() {
48
+ setRating(index+1);
49
+ cb(index+1);
50
+ });
51
+ })();
52
+ }
53
+ // add the star image to the stars array
54
+ stars.push(star);
55
+ // add the star image to the instance view
56
+ $.starrating.add(star);
57
+ }
58
+ };
59
+
60
+ exports.init = function (callback) {
61
+ var max = args.max || 5,
62
+ initialRating = args.initialRating || 0,
63
+ cb = callback || function(){};
64
+ createStars(max, cb);
65
+ setRating(initialRating);
66
+ // can't apply view properties from the calling context when you use this widget
67
+ // without coding them in to this controller, alloy limitation as of this writing
68
+ _.extend($.starrating, args);
69
+
70
+ };
pool/shard006/JavaScript/0041706_format.jam.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Generator of date-formatters.
3
+ * Date-formatter is a function that returns string representation of a date.
4
+ *
5
+ * 0 params: hash-table of all patterns
6
+ * 1 param: return date-formatter by pattern
7
+ * 2 params: assign date-formatter for pattern
8
+ *
9
+ * Mnemonics:
10
+ *
11
+ * * single letter for numbers: M - month number, D - day of month.
12
+ * * uppercase letters for dates, lowercase for times: M - month number , m - minutes number
13
+ * * repeated letters for define register count: YYYY - full year, YY - shot year, MM - padded month number
14
+ * * words, same letter case: Month - localized capitalized month name
15
+ * * shortcuts: WD - short day of week, Mon - short month name.
16
+ * * special identifiers: iso8601, stamp.
17
+ *
18
+ * Complex patterns splits by words and then substitute by date-formatters for short patterns
19
+ * For localize output override $jin.l10n( scope, text )
20
+ *
21
+ * Typical usage:
22
+ * var formatTime = $jin.time1.format( 'Weekday, YYYY-MM-DD hh:mm' )
23
+ * formatTime( $jin.time1.moment() )
24
+ *
25
+ * @name $jin.time1.format
26
+ * @method format
27
+ * @member $jin.time
28
+ * @param {string} [pattern]
29
+ * @param {function( $jin.date )} [formatter]
30
+ * @static
31
+ */
32
+ $jin.property.hash({ '$jin.time1.format': { pull: function( pattern ) {
33
+
34
+ var lexems = $jin.time1.format()
35
+ var patterns = Object.keys( lexems )
36
+ patterns.sort()
37
+ patterns.reverse()
38
+
39
+ var funcs = []
40
+
41
+ var lexer = RegExp( '(.*?)(' + patterns.join( '|' ) + '|$)', 'g' )
42
+ pattern.replace( lexer, function( str, text, token ){
43
+ if( text ) funcs.push( function(){ return text } )
44
+ if( token ) funcs.push( lexems[ token ] )
45
+ })
46
+
47
+ return $jin.concater( funcs )
48
+ }}})
pool/shard006/JavaScript/0041708_server.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var express = require('express'),
2
+ app = express(),
3
+ swig = require('swig'),
4
+ cookieParser = require('cookie-parser'),
5
+ i18n = require('i18n-2'),
6
+ bodyParser = require('body-parser');
7
+ PORT = process.env.PORT || 6060;
8
+ isProduction = true;
9
+
10
+ /* Getting the current enviroment */
11
+ if(process.env.NODE_ENV === 'development') {
12
+ isProduction = false;
13
+ console.log('App running on Development enviroment...');
14
+ }
15
+
16
+ /* View Engine Setup */
17
+ app.engine('html', swig.renderFile);
18
+ app.set('view engine', 'html');
19
+
20
+ if(!isProduction) {
21
+ app.set('view cache', false);
22
+ swig.setDefaults({ cache: false });
23
+ }
24
+
25
+ /* for parsing application/x-www-form-urlencoded */
26
+ app.use(bodyParser.urlencoded({ extended: true }));
27
+
28
+ /* Set static files path */
29
+ app.use(express.static(__dirname + '/app/public/'));
30
+
31
+ /* Set views path */
32
+ app.set('views', __dirname + '/app/views/');
33
+
34
+
35
+ /* Setup Middlewares */
36
+ app.use(cookieParser('un gran secreto'));
37
+
38
+ //setup i18n
39
+ i18n.expressBind(app, {
40
+ locales: ['es','en'],
41
+ defaultLocale: 'es',
42
+ cookiename: 'locale'
43
+ });
44
+ app.use(function(req, res, next){
45
+ req.i18n.setLocaleFromCookie();
46
+ next();
47
+ });
48
+
49
+ /* Routes */
50
+ app.get('/', function(req, res){
51
+ res.render('layout', {
52
+ isProduction: isProduction,
53
+ headerTitle: req.i18n.__('headerTitle'),
54
+ headerQuote: req.i18n.__('headerQuote'),
55
+ headerText: req.i18n.__('headerText')
56
+ });
57
+ });
58
+
59
+ // Request via contact form
60
+ app.post('/', function(req, res){
61
+ console.log(req.body);
62
+ res.send(JSON.stringify({ok:"ok"}));
63
+ });
64
+
65
+ app.listen(PORT, function() {
66
+ console.log('app running on port: %d', PORT);
67
+ });
68
+
69
+
pool/shard006/JavaScript/0041711_xml-test.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ require("../env");
2
+
3
+ var vows = require("vows"),
4
+ assert = require("assert");
5
+
6
+ var suite = vows.describe("d3.xml");
7
+
8
+ suite.addBatch({
9
+ "xml": {
10
+ topic: function() {
11
+ var cb = this.callback;
12
+ d3.xml("test/data/sample.xml", function(error, xml) {
13
+ cb(null, xml);
14
+ });
15
+ },
16
+ "invokes the callback with the loaded xml": function(xml) {
17
+ assert.deepEqual(xml, {_xml: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<hello>\n <world name=\"Earth\"/>\n</hello>\n"});
18
+ },
19
+ "does not override the mime type by default": function(xml) {
20
+ assert.isUndefined(XMLHttpRequest._last._info.mimeType);
21
+ },
22
+ "": {
23
+ topic: function() {
24
+ var cb = this.callback;
25
+ d3.xml("test/data/sample.txt", "application/xml+sample", function(error, xml) {
26
+ cb(null, xml);
27
+ });
28
+ },
29
+ "observes the optional mime type": function(xml) {
30
+ assert.equal(XMLHttpRequest._last._info.mimeType, "application/xml+sample");
31
+ }
32
+ },
33
+ " ": {
34
+ topic: function() {
35
+ var cb = this.callback;
36
+ d3.xml("//does/not/exist.xml", function(error, xml) {
37
+ cb(null, xml);
38
+ });
39
+ },
40
+ "invokes the callback with undefined when an error occurs": function(xml) {
41
+ assert.isUndefined(xml);
42
+ }
43
+ }
44
+ }
45
+ });
46
+
47
+ suite.export(module);
pool/shard006/JavaScript/0041712_customer.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var doc = {
2
+ toggleActive: function (obj) {
3
+ if ($(obj).next().length == 0) {
4
+ $(".menu").find("a").removeClass("active");
5
+ $(obj).addClass("active").attr("href", obj.href.split('?')[0] + "?_=" + new Date().getTime()).attr("target", "mainFrame");
6
+ } else {
7
+ if ($(obj).next("ul").is(":hidden")) { $(obj).parents("ul").find("li ul").not(":hidden").toggle(200).prev("a").find("i").toggleClass("arrow-down arrow-right"); }
8
+ $(obj).next("ul").toggle(200).prev("a").find("i").toggleClass("arrow-down arrow-right");
9
+ }
10
+ },
11
+ resizeStyle: function () {
12
+ $(".main-content,iframe[name='mainFrame']").width($(window).width() - $(".menu").width()).height("100%");
13
+ var textareaHeight = $(window).height() - ($(".form-horizontal").height() - $("textarea[name='response']").height() + 70);
14
+ if ($("textarea[name='response']").height() < textareaHeight) { $("textarea[name='response']").height(textareaHeight); }
15
+ },
16
+ submitForm: function (obj) {
17
+ var data = this.serializeJson($(obj));
18
+ $.ajax({
19
+ type: data.method, dataType: "json",
20
+ beforeSend: function () { $(obj).find('input[type="submit"]').button("loading"); },
21
+ complete: function () { $(obj).find('input[type="submit"]').button("reset"); },
22
+ url: "/Api/Dev/Debug?Url=" + encodeURI(data.action) + "&Method=" + data.method + "&Platform=" + data.Platform + "&Parma=" + encodeURI(data.parameter.replace(/&/g, "|")),
23
+ success: function (response) { $("input[name='response']").val(response.Response); doc.formatJson(response.Response); $("input[name='sign']").val(response.Sign); },
24
+ error: function () { modal.alert({ content: "请求出错了 !", cancel: "确定", type: "danger" }); }
25
+ }); return false;
26
+ },
27
+ formatJson: function (json) {
28
+ if ($("input[name='response']").length > 0) {
29
+ (new JsonFormater({ dom: ".response", isCollapsible: $(".console").prop("checked") })).doFormat(json);
30
+ $(".console").change(function () { (new JsonFormater({ dom: ".response", isCollapsible: $(".console").prop("checked") })).doFormat($("input[name='response']").val()); });
31
+ }
32
+ },
33
+ serializeJson: function (obj) {
34
+ var serializeObj = {}; var array = obj.serializeArray();
35
+ $(array).each(function () {
36
+ if (serializeObj[this.name]) {
37
+ if ($.isArray(serializeObj[this.name])) {
38
+ serializeObj[this.name].push(this.value);
39
+ } else { serializeObj[this.name] = [serializeObj[this.name], this.value]; }
40
+ } else { serializeObj[this.name] = this.value; }
41
+ }); return serializeObj;
42
+ },
43
+ init: function () {
44
+ window.onresize = this.resizeStyle; $(window).resize();
45
+ $(".menu").find("li ul").prev("a").css("padding-left", "0").prepend('<i class="arrow-right"></i>');
46
+ $(".menu").find("a").bind("click", function () { doc.toggleActive(this); });
47
+ $(".form-horizontal").bind("submit", function () { return doc.submitForm(this); });
48
+ if ($("input[name='response']")) { this.formatJson($("input[name='response']").val()); }
49
+ }
50
+ };
51
+ $(function () { doc.init(); });
pool/shard006/JavaScript/0041716_feed.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import NavigationBar from './navigation-bar';
2
+ import HolidayList from './holiday-list';
3
+
4
+ export const Feed = (props) => {
5
+ // todo: derive these from dataset
6
+ const minimumDate = '2017-07-14';
7
+ const maximumDate = '2018-07-12';
8
+
9
+
10
+ let pathDate = new Date();
11
+ if (props.year && props.month && props.day) {
12
+ pathDate = new Date(props.year, props.month - 1, props.day);
13
+ }
14
+ return (
15
+ <div>
16
+ <NavigationBar date={pathDate} min={minimumDate} max={maximumDate} />
17
+ <HolidayList data={props.data} date={pathDate} />
18
+ </div>
19
+ );
20
+ };
pool/shard006/JavaScript/0041718_StyleButton.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const React = require('react');
2
+
3
+ module.exports = (props) => {
4
+ const onToggle = function(e) {
5
+ e.preventDefault();
6
+ props.onToggle(props.style || e);
7
+ }
8
+
9
+ const label = (props.icon) ?
10
+ (<span className={'icon-' + props.icon}></span>) :
11
+ (props.label);
12
+
13
+ return (
14
+ <button className="editor-controls__button" onMouseDown={onToggle} aria-pressed={props.active} aria-label={props.label}>
15
+ {label}
16
+ </button>
17
+ );
18
+ };
pool/shard006/JavaScript/0041719_primeng-tabmenu.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ViewChild, ContentChildren, NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { RippleModule } from 'primeng/ripple';
4
+ import { PrimeTemplate, SharedModule } from 'primeng/api';
5
+ import { RouterModule } from '@angular/router';
6
+ import { DomHandler } from 'primeng/dom';
7
+
8
+ class TabMenu {
9
+ ngAfterContentInit() {
10
+ this.templates.forEach((item) => {
11
+ switch (item.getType()) {
12
+ case 'item':
13
+ this.itemTemplate = item.template;
14
+ break;
15
+ default:
16
+ this.itemTemplate = item.template;
17
+ break;
18
+ }
19
+ });
20
+ }
21
+ ngAfterViewInit() {
22
+ this.updateInkBar();
23
+ }
24
+ ngAfterViewChecked() {
25
+ if (this.tabChanged) {
26
+ this.updateInkBar();
27
+ this.tabChanged = false;
28
+ }
29
+ }
30
+ itemClick(event, item) {
31
+ if (item.disabled) {
32
+ event.preventDefault();
33
+ return;
34
+ }
35
+ if (item.command) {
36
+ item.command({
37
+ originalEvent: event,
38
+ item: item
39
+ });
40
+ }
41
+ this.activeItem = item;
42
+ this.tabChanged = true;
43
+ }
44
+ updateInkBar() {
45
+ let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight');
46
+ if (tabHeader) {
47
+ this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px';
48
+ this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px';
49
+ }
50
+ }
51
+ }
52
+ TabMenu.decorators = [
53
+ { type: Component, args: [{
54
+ selector: 'p-tabMenu',
55
+ template: `
56
+ <div [ngClass]="'p-tabmenu p-component'" [ngStyle]="style" [class]="styleClass">
57
+ <ul #navbar class="p-tabmenu-nav p-reset" role="tablist">
58
+ <li *ngFor="let item of model; let i = index" role="tab" [ngStyle]="item.style" [class]="item.styleClass" [attr.aria-selected]="activeItem==item" [attr.aria-expanded]="activeItem==item"
59
+ [ngClass]="{'p-tabmenuitem':true,'p-disabled':item.disabled,'p-highlight':activeItem==item,'p-hidden': item.visible === false}">
60
+ <a *ngIf="!item.routerLink" [attr.href]="item.url" class="p-menuitem-link" role="presentation" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
61
+ [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id" pRipple>
62
+ <ng-container *ngIf="!itemTemplate">
63
+ <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
64
+ <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>
65
+ <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
66
+ </ng-container>
67
+ <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
68
+ </a>
69
+ <a *ngIf="item.routerLink" [routerLink]="item.routerLink" [queryParams]="item.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}"
70
+ role="presentation" class="p-menuitem-link" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
71
+ [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id"
72
+ [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state" pRipple>
73
+ <ng-container *ngIf="!itemTemplate">
74
+ <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
75
+ <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>
76
+ <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
77
+ </ng-container>
78
+ <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
79
+ </a>
80
+ </li>
81
+ <li #inkbar class="p-tabmenu-ink-bar"></li>
82
+ </ul>
83
+ </div>
84
+ `,
85
+ changeDetection: ChangeDetectionStrategy.OnPush,
86
+ encapsulation: ViewEncapsulation.None,
87
+ styles: [".p-tabmenu-nav{display:flex;flex-wrap:wrap;list-style-type:none;margin:0;padding:0}.p-tabmenu-nav a{-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:flex;overflow:hidden;position:relative;text-decoration:none;user-select:none}.p-tabmenu-nav a:focus{z-index:1}.p-tabmenu-nav .p-menuitem-text{line-height:1}.p-tabmenu-ink-bar{display:none;z-index:1}"]
88
+ },] }
89
+ ];
90
+ TabMenu.propDecorators = {
91
+ model: [{ type: Input }],
92
+ activeItem: [{ type: Input }],
93
+ popup: [{ type: Input }],
94
+ style: [{ type: Input }],
95
+ styleClass: [{ type: Input }],
96
+ navbar: [{ type: ViewChild, args: ['navbar',] }],
97
+ inkbar: [{ type: ViewChild, args: ['inkbar',] }],
98
+ templates: [{ type: ContentChildren, args: [PrimeTemplate,] }]
99
+ };
100
+ class TabMenuModule {
101
+ }
102
+ TabMenuModule.decorators = [
103
+ { type: NgModule, args: [{
104
+ imports: [CommonModule, RouterModule, SharedModule, RippleModule],
105
+ exports: [TabMenu, RouterModule, SharedModule],
106
+ declarations: [TabMenu]
107
+ },] }
108
+ ];
109
+
110
+ /**
111
+ * Generated bundle index. Do not edit.
112
+ */
113
+
114
+ export { TabMenu, TabMenuModule };
115
+ //# sourceMappingURL=primeng-tabmenu.js.map
pool/shard006/JavaScript/0041720_mapAccum.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var _curry3 = require('./internal/_curry3');
2
+
3
+
4
+ /**
5
+ * The mapAccum function behaves like a combination of map and reduce; it
6
+ * applies a function to each element of a list, passing an accumulating
7
+ * parameter from left to right, and returning a final value of this
8
+ * accumulator together with the new list.
9
+ *
10
+ * The iterator function receives two arguments, *acc* and *value*, and should
11
+ * return a tuple *[acc, value]*.
12
+ *
13
+ * @func
14
+ * @memberOf R
15
+ * @since v0.10.0
16
+ * @category List
17
+ * @sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y])
18
+ * @param {Function} fn The function to be called on every element of the input `list`.
19
+ * @param {*} acc The accumulator value.
20
+ * @param {Array} list The list to iterate over.
21
+ * @return {*} The final, accumulated value.
22
+ * @see R.addIndex, R.mapAccumRight
23
+ * @example
24
+ *
25
+ * var digits = ['1', '2', '3', '4'];
26
+ * var appender = (a, b) => [a + b, a + b];
27
+ *
28
+ * R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']]
29
+ * @symb R.mapAccum(f, a, [b, c, d]) = [
30
+ * f(f(f(a, b)[0], c)[0], d)[0],
31
+ * [
32
+ * f(a, b)[1],
33
+ * f(f(a, b)[0], c)[1],
34
+ * f(f(f(a, b)[0], c)[0], d)[1]
35
+ * ]
36
+ * ]
37
+ */
38
+ module.exports = _curry3(function mapAccum(fn, acc, list) {
39
+ var idx = 0;
40
+ var len = list.length;
41
+ var result = [];
42
+ var tuple = [acc];
43
+ while (idx < len) {
44
+ tuple = fn(tuple[0], list[idx]);
45
+ result[idx] = tuple[1];
46
+ idx += 1;
47
+ }
48
+ return [tuple[0], result];
49
+ });
pool/shard006/JavaScript/0041724_global.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global ConversationPanel: true */
2
+ /* eslint no-unused-vars: "off" */
3
+
4
+ // Other JS files required to be loaded first: apis.js, conversation.js
5
+ (function() {
6
+ // Initialize all modules
7
+ ConversationPanel.init();
8
+ })();
9
+
10
+ // nasty globals for state
11
+ var tripRetrieved = false;
12
+ var alternatesRetrieved = false;
13
+ var problemState = {};
14
+
15
+ // this function handles responses from the Watson conversation service
16
+ // and optionally uses intents and e
17
+ function handleResponseMessage(incomingMsg) {
18
+ var response = incomingMsg;
19
+ for (var i = 0; i < response.intents.length; i++) {
20
+ var intent = response.intents[i];
21
+ var handled = false;
22
+ switch (intent.intent) {
23
+ case "when":
24
+ if (intent.confidence > 0.5) {
25
+ response = handleWhen(response);
26
+ handled = true;
27
+ } else {
28
+ // not enough confidence to guess "when"..ask for more
29
+ response.output.text = "Can you rephrase what you are looking for?";
30
+ }
31
+ break;
32
+ case "alternate":
33
+ if (intent.confidence > 0.5) {
34
+ response = handleAlternate(response);
35
+ handled = true;
36
+ break;
37
+ } else {
38
+ // not enough confidence to guess "when"..ask for more
39
+ response.output.text = "Can you rephrase what you are looking for?";
40
+ }
41
+ break;
42
+ case "problem":
43
+ if (intent.confidence > 0.5) {
44
+ response = handleProblem(intent, response);
45
+ handled = true;
46
+ break;
47
+ } else {
48
+ // not enough confidence to guess "when"..ask for more
49
+ response.output.text = "Can you rephrase what you are looking for?";
50
+ }
51
+ break;
52
+ }
53
+ if (handled) {
54
+ break;
55
+ }
56
+ }
57
+ return response;
58
+ }
59
+
60
+ function handleWhen(response) {
61
+ if (tripRetrieved === true) {
62
+ $('#flight-alternates').css("display", "none");
63
+ $('#flight-results').css("display", "block");
64
+ } else {
65
+ parseTripsForFlights(false, false);
66
+ tripRetrieved = true;
67
+ }
68
+ response.output.text = "I've loaded your next trip details for you.";
69
+ return response;
70
+ }
71
+
72
+ function handleAlternate(response) {
73
+ if (!tripRetrieved) {
74
+ parseTripsForFlights(false, true);
75
+ tripRetrieved = true;
76
+ }
77
+ $('#flight-results').css("display", "none");
78
+ if (alternatesRetrieved) {
79
+ $('#flight-alternates').css("display", "block");
80
+ } else {
81
+ $('#flight-alternates').trigger('instantiate');
82
+ alternatesRetrieved = true;
83
+ }
84
+ response.output.text = "I've loaded alternate flights between your origin and destination for you.";
85
+ return response;
86
+ }
87
+
88
+ function handleProblem(intent, response) {
89
+ // first check if the conversation service has a response (to clarify information):
90
+ if (response.output.text.length > 0) {
91
+ problemState = response;
92
+ return response;
93
+ }
94
+ var airport = "";
95
+ if (response.entities.length > 0) {
96
+ if (response.entities[0].entity === "Airport") {
97
+ // user has responded with an airport:
98
+ airport = response.entities[0].value; // this will be the official entity name
99
+ }
100
+ }
101
+ if (airport !== "") {
102
+ var childDiv = $("#flight-alternates").children("div");
103
+ response.output.text = "Let me see if I can help you get from " + airport + " to your destination via an alternate flight.";
104
+ // BIG FIXME: Due to time constraints, for our DockerCon demo with the
105
+ // conversation service, we hardcoded Austin and the date to show a
106
+ // lookup specific to a story we were telling about Lin's canceled flight
107
+ // FIX: actually parse the known trip JSON to find where the traveler is
108
+ // going and use the date of "now" or that original flight date/time to
109
+ // do the alternate search.
110
+ outputAlternateFlights(childDiv[0], airportCode(airport), "AUS", "2017-04-18T13:00:00-05:00", 12, 15);
111
+ } else {
112
+ response.output.text = "I see you are having flight problems.";
113
+ }
114
+ return response;
115
+ }
116
+
117
+ function airportCode(cityEntity) {
118
+ switch (cityEntity) {
119
+ case "Dallas":
120
+ return "DFW";
121
+ case "Austin":
122
+ return "AUS";
123
+ case "Chicago":
124
+ return "ORD";
125
+ case "Raleigh":
126
+ return "RDU";
127
+ case "Charlotte":
128
+ return "CLT";
129
+ case "Charlottesville":
130
+ return "CHO";
131
+ default:
132
+ return "Unknown";
133
+ }
134
+ }
pool/shard006/JavaScript/0041726_lvl99-plugin.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * LVL99 Plugin JS
3
+ */
4
+
5
+ var lvl99 = lvl99 || {};
6
+
7
+ lvl99.enableDebug = true;
8
+ lvl99.activeWidgets = 0;
9
+ lvl99.widgetCount = 0;
10
+ lvl99.widgets = {};
11
+
12
+ // Toggle
13
+ lvl99.widgetCount++;
14
+ lvl99.widgets.toggle = {
15
+ active: false,
16
+ requires: [ 'jQuery' ],
17
+ init: function () {
18
+ jQuery(document).on('click', '.lvl99-toggle', function (event) {
19
+ var $elem = jQuery(this);
20
+ if ( $elem.is('.lvl99-toggle-hidden') ) {
21
+ $elem.css({
22
+ overflow: 'visible',
23
+ height: 'auto'
24
+ }).removeClass('lvl99-toggle-hidden');
25
+ } else {
26
+ $elem.css({
27
+ overflow: 'hidden',
28
+ height: '1em'
29
+ }).addClass('lvl99-toggle-hidden');
30
+ }
31
+ });
32
+ }
33
+ };
34
+
35
+ // Sortable fields
36
+ lvl99.widgetCount++;
37
+ lvl99.widgets.sortable = {
38
+ active: false,
39
+ requires: [ 'jQuery', 'jQuery.fn.sortable' ],
40
+ init: function () {
41
+ // Events
42
+ jQuery(document).trigger('lvl99-plugin-sortable');
43
+ }
44
+ }
45
+
46
+ // File uploads
47
+ lvl99.widgetCount++;
48
+ lvl99.widgets.fileUploaders = {
49
+ active: false,
50
+ requires: [ 'jQuery' ],
51
+ init: function () {
52
+ jQuery(document).ready(function() {
53
+ jQuery(document).on( 'click', '.upload_file_button', function (event) {
54
+ event.preventDefault();
55
+
56
+ jQuery.data( document.body, 'upload_file_element', jQuery(this).parents('.lvl99-plugin-option') );
57
+
58
+ window.send_to_editor = function (html) {
59
+ var imgurl = jQuery(html).find('img').eq(0).attr('src').replace(wp_homeurl, '/');
60
+ var $option = jQuery.data( document.body, 'upload_file_element' );
61
+
62
+ if ( $option != undefined && $option != '' ) {
63
+ $option.find('input').val(imgurl);
64
+ $option.find('img').attr('src', imgurl).show();
65
+ $option.find('.remove_file_button').show();
66
+ }
67
+
68
+ tb_remove();
69
+ };
70
+
71
+ tb_show('', 'media-upload.php?type=image&TB_iframe=true');
72
+ return false;
73
+ });
74
+
75
+ jQuery(document).on( 'click', '.remove_file_button', function (event) {
76
+ event.preventDefault();
77
+
78
+ var $option = jQuery(this).parents('.lvl99-plugin-option');
79
+ $option.find('input').val('');
80
+ $option.find('img').attr('src', '').hide();
81
+ jQuery(this).hide();
82
+ });
83
+
84
+ jQuery(document).trigger('lvl99-plugin-file-uploader');
85
+ });
86
+ }
87
+ }
88
+
89
+ // See: http://stackoverflow.com/a/6491621/1421162
90
+ Object.byString = function(o, s) {
91
+ s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
92
+ s = s.replace(/^\./, ''); // strip a leading dot
93
+ var a = s.split('.');
94
+ for (var i = 0, n = a.length; i < n; ++i) {
95
+ var k = a[i];
96
+ if (k in o) {
97
+ o = o[k];
98
+ } else {
99
+ return;
100
+ }
101
+ }
102
+ return o;
103
+ }
104
+
105
+ // Initialise the widgets
106
+ function __initLvl99Widgets( counter ) {
107
+ if ( counter < 0 ) {
108
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( 'Maximum widget checks performed. Aborting...' );
109
+ return;
110
+ }
111
+
112
+ // Check if widgets have all their required dependencies before initialising
113
+ for( i in lvl99.widgets ) {
114
+ var widget = lvl99.widgets[i];
115
+ widget.checked = widget.checked + 1;
116
+ var requiresPassed = 0;
117
+
118
+ // If exceeded 10 checks, abort this widget
119
+ if ( widget.checked > 10 || widget.active ) continue;
120
+
121
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( 'Checking '+widget.requires.length+' dependencies for ' + i );
122
+
123
+ // Check requires are present
124
+ for ( x in widget.requires ) {
125
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( ' --> Requires ' + widget.requires[x] );
126
+
127
+ if ( typeof Object.byString( window, widget.requires[x]) != 'undefined' ) {
128
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( ' ✓ Detected '+(parseInt(x, 10)+1)+'/'+widget.requires.length+': ' + widget.requires[x] );
129
+ requiresPassed++;
130
+ } else {
131
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( ' x Not found...' );
132
+ }
133
+ }
134
+
135
+ // If all requires passed, initialise widget JS
136
+ if ( requiresPassed === widget.requires.length ) {
137
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( '✓ Detected all required for widget ' + i );
138
+ if ( typeof widget.init == 'function' ) {
139
+ widget.init();
140
+ widget.active = true;
141
+ lvl99.activeWidgets++;
142
+ }
143
+ } else {
144
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( 'x Missing dependencies for widget ' + i );
145
+ }
146
+ }
147
+
148
+ // All widgets have initialised
149
+ if ( lvl99.activeWidgets === lvl99.widgetCount ) {
150
+ if ( lvl99.enableDebug && window.console ) if ( console.log ) console.log( 'All widgets successfully initialised!' );
151
+
152
+ // Retry initialising
153
+ } else {
154
+ setTimeout( function () {
155
+ __initLvl99Widgets(counter - 1);
156
+ }, 1000 );
157
+ }
158
+ }
159
+
160
+ if ( lvl99.widgetCount > 0 ) __initLvl99Widgets( 10 );
pool/shard006/JavaScript/0041732_activity.js ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ /*global opensocial */
21
+
22
+ /**
23
+ * @class
24
+ * Representation of an activity.
25
+ *
26
+ * <p>Activities are rendered with a title and an optional activity body.</p>
27
+ *
28
+ * <p>You may set the title and body directly as strings when calling
29
+ * opensocial.createActivity.</p>
30
+ *
31
+ * <p>However, it is usually beneficial to create activities using
32
+ * Activity Templates for the title and body. Activity Templates support:</p>
33
+ * <ul>
34
+ * <li>Internationalization</li>
35
+ * <li>Replacement variables in the message</li>
36
+ * <li>Activity Summaries, which are message variations used to summarize
37
+ * repeated activities that share something in common.</li>
38
+ * </ul>
39
+ *
40
+ * <p>Activity Templates are defined as messages in the gadget specification.
41
+ * To define messages, you create and reference message bundle XML files for
42
+ * each locale you support.</p>
43
+ *
44
+ * <p>Example module spec in gadget XML:
45
+ * <pre>
46
+ * &lt;ModulePrefs title="ListenToThis"&gt;
47
+ * &lt;Locale messages="http://www.listentostuff.com/messages.xml"/&gt;
48
+ * &lt;Locale lang="de" messages="http://www.listentostuff.com/messages-DE.xml"/&gt;
49
+ * &lt;/ModulePrefs&gt;
50
+ * </pre>
51
+ * </p>
52
+ *
53
+ * <p>Example message bundle:
54
+ * <pre>
55
+ * &lt;messagebundle&gt;
56
+ * &lt;msg name="LISTEN_TO_THIS_SONG"&gt;
57
+ * ${Subject.DisplayName} told ${Owner.DisplayName} to
58
+ * listen to a song!
59
+ * &lt;/msg&gt;
60
+ * &lt;/messagebundle&gt;
61
+ * </pre>
62
+ * </p>
63
+ *
64
+ * <p>You can set custom key/value string pairs when posting an activity.
65
+ * These values will be used for variable substitution in the templates.</p>
66
+ * <p>Example JS call:
67
+ * <pre>
68
+ * var owner = ...;
69
+ * var viewer = ...;
70
+ * var activity = opensocial.newActivity('LISTEN_TO_THIS_SONG',
71
+ * {Song: 'Do That There - (Young Einstein hoo-hoo mix)',
72
+ * Artist: 'Lyrics Born', Subject: viewer, Owner: owner})
73
+ * </pre>
74
+ * </p>
75
+ *
76
+ * <p> Associated message:
77
+ * <pre>
78
+ * &lt;msg name="LISTEN_TO_THIS_SONG"&gt;
79
+ * ${Subject.DisplayName} told ${Owner.DisplayName} to listen
80
+ * to ${Song} by ${Artist}
81
+ * &lt;/msg&gt;
82
+ * </pre>
83
+ * </p>
84
+ *
85
+ * <p>People can also be set as values in key/value pairs when posting
86
+ * an activity. You can then reference the following fields on a person:</p>
87
+ * <ul>
88
+ * <li>${Person.DisplayName} The person's name</li>
89
+ * <li>${Person.Id} The user ID of the person</li>
90
+ * <li>${Person.ProfileUrl} The profile URL of the person</li>
91
+ * <li>${Person} This will show the display name, but containers may optionally
92
+ * provide special formatting, such as showing the name as a link</li>
93
+ * </ul>
94
+ *
95
+ * <p>Users will have many activities in their activity streams, and containers
96
+ * will not show every activity that is visible to a user. To help display
97
+ * large numbers of activities, containers will summarize a list of activities
98
+ * from a given source to a single entry.</p>
99
+ *
100
+ * <p>You can provide Activity Summaries to customize the text shown when
101
+ * multiple activities are summarized. If no customization is provided, a
102
+ * container may ignore your activities altogether or provide default text
103
+ * such as "Bob changed his status message + 20 other events like this."</p>
104
+ * <ul>
105
+ * <li>Activity Summaries will always summarize around a specific key in a
106
+ * key/value pair. This is so that the summary can say something concrete
107
+ * (this is clearer in the example below).</li>
108
+ * <li>Other variables will have synthetic "Count" variables created with
109
+ * the total number of items summarized.</li>
110
+ * <li>Message ID of the summary is the message ID of the main template + ":" +
111
+ * the data key</li>
112
+ * </ul>
113
+ *
114
+ * <p>Example summaries:
115
+ * <pre>
116
+ * &lt;messagebundle&gt;
117
+ * &lt;msg name="LISTEN_TO_THIS_SONG:Artist"&gt;
118
+ * ${Subject.Count} of your friends have suggested listening to songs
119
+ * by ${Artist}!
120
+ * &lt;/msg&gt;
121
+ * &lt;msg name="LISTEN_TO_THIS_SONG:Song"&gt;
122
+ * ${Subject.Count} of your friends have suggested listening to ${Song}
123
+ * !&lt;/msg&gt;
124
+ * &lt;msg name="LISTEN_TO_THIS_SONG:Subject"&gt;
125
+ * ${Subject.DisplayName} has recommended ${Song.Count} songs to you.
126
+ * &lt;/msg&gt;
127
+ * &lt;/messagebundle&gt;
128
+ * </pre></p>
129
+ *
130
+ * <p>Activity Templates may only have the following HTML tags: &lt;b&gt;,
131
+ * &lt;i&gt;, &lt;a&gt;, &lt;span&gt;. The container also has the option
132
+ * to strip out these tags when rendering the activity.</p>
133
+ *
134
+ * <p>
135
+ * <b>See also:</b>
136
+ * <a href="opensocial.html#newActivity">opensocial.newActivity()</a>,
137
+ * <a href="opensocial.html#requestCreateActivity">
138
+ * opensocial.requestCreateActivity()</a>
139
+ *
140
+ * @name opensocial.Activity
141
+ */
142
+
143
+
144
+ /**
145
+ * Base interface for all activity objects.
146
+ *
147
+ * Private, see opensocial.createActivity() for usage.
148
+ *
149
+ * @param {Object.<opensocial.Activity.Field, Object>} params Parameters defining the activity.
150
+ * @private
151
+ * @constructor
152
+ */
153
+ opensocial.Activity = function(params) {
154
+ this.fields_ = params;
155
+ };
156
+
157
+
158
+ /**
159
+ * @static
160
+ * @class
161
+ * All of the fields that activities can have.
162
+ *
163
+ * <p>It is only required to set one of TITLE_ID or TITLE. In addition, if you
164
+ * are using any variables in your title or title template,
165
+ * you must set TEMPLATE_PARAMS.</p>
166
+ *
167
+ * <p>Other possible fields to set are: URL, MEDIA_ITEMS, BODY_ID, BODY,
168
+ * EXTERNAL_ID, PRIORITY, STREAM_TITLE, STREAM_URL, STREAM_SOURCE_URL,
169
+ * and STREAM_FAVICON_URL.</p>
170
+ *
171
+ * <p>Containers are only required to use TITLE_ID or TITLE, they may ignore
172
+ * additional parameters.</p>
173
+ *
174
+ * <p>
175
+ * <b>See also:</b>
176
+ * <a
177
+ * href="opensocial.Activity.html#getField">opensocial.Activity.getField()</a>
178
+ * </p>
179
+ *
180
+ * @name opensocial.Activity.Field
181
+ * @enum {string}
182
+ */
183
+ opensocial.Activity.Field = {
184
+ /**
185
+ * <p>A string specifying the title template message ID in the gadget
186
+ * spec.</p>
187
+ *
188
+ * <p>The title is the primary text of an activity.</p>
189
+ *
190
+ * <p>Titles may only have the following HTML tags: &lt;b&gt; &lt;i&gt;,
191
+ * &lt;a&gt;, &lt;span&gt;.
192
+ * The container may ignore this formatting when rendering the activity.</p>
193
+ *
194
+ * @member opensocial.Activity.Field
195
+ */
196
+ TITLE_ID : 'titleId',
197
+
198
+ /**
199
+ * <p>A string specifying the primary text of an activity.</p>
200
+ *
201
+ * <p>Titles may only have the following HTML tags: &lt;b&gt; &lt;i&gt;,
202
+ * &lt;a&gt;, &lt;span&gt;.
203
+ * The container may ignore this formatting when rendering the activity.</p>
204
+ *
205
+ * @member opensocial.Activity.Field
206
+ */
207
+ TITLE : 'title',
208
+
209
+ /**
210
+ * <p>A map of custom keys to values associated with this activity.
211
+ * These will be used for evaluation in templates.</p>
212
+ *
213
+ * <p>The data has type <code>Map&lt;String, Object&gt;</code>. The
214
+ * object may be either a String or an opensocial.Person.</p>
215
+ *
216
+ * <p>When passing in a person with key PersonKey, can use the following
217
+ * replacement variables in the template:</p>
218
+ * <ul>
219
+ * <li>PersonKey.DisplayName - Display name for the person</li>
220
+ * <li>PersonKey.ProfileUrl. URL of the person's profile</li>
221
+ * <li>PersonKey.Id - The ID of the person</li>
222
+ * <li>PersonKey - Container may replace with DisplayName, but may also
223
+ * optionally link to the user.</li>
224
+ * </ul>
225
+ *
226
+ * @member opensocial.Activity.Field
227
+ */
228
+ TEMPLATE_PARAMS : 'templateParams',
229
+
230
+ /**
231
+ * A string specifying the
232
+ * URL that represents this activity.
233
+ * @member opensocial.Activity.Field
234
+ */
235
+ URL : 'url',
236
+
237
+ /**
238
+ * Any photos, videos, or images that should be associated
239
+ * with the activity. Higher priority ones are higher in the list.
240
+ * The data has type <code>Array&lt;
241
+ * <a href="opensocial.MediaItem.html">MediaItem</a>&gt;</code>.
242
+ * @member opensocial.Activity.Field
243
+ */
244
+ MEDIA_ITEMS : 'mediaItems',
245
+
246
+ /**
247
+ * <p>A string specifying the body template message ID in the gadget spec.</p>
248
+ *
249
+ * <p>The body is an optional expanded version of an activity.</p>
250
+ *
251
+ * <p>Bodies may only have the following HTML tags: &lt;b&gt; &lt;i&gt;,
252
+ * &lt;a&gt;, &lt;span&gt;.
253
+ * The container may ignore this formatting when rendering the activity.</p>
254
+ *
255
+ * @member opensocial.Activity.Field
256
+ */
257
+ BODY_ID : 'bodyId',
258
+
259
+ /**
260
+ * <p>A string specifying an optional expanded version of an activity.</p>
261
+ *
262
+ * <p>Bodies may only have the following HTML tags: &lt;b&gt; &lt;i&gt;,
263
+ * &lt;a&gt;, &lt;span&gt;.
264
+ * The container may ignore this formatting when rendering the activity.</p>
265
+ *
266
+ * @member opensocial.Activity.Field
267
+ */
268
+ BODY : 'body',
269
+
270
+ /**
271
+ * An optional string ID generated by the posting application.
272
+ * @member opensocial.Activity.Field
273
+ */
274
+ EXTERNAL_ID : 'externalId',
275
+
276
+ /**
277
+ * A string specifing the title of the stream.
278
+ * @member opensocial.Activity.Field
279
+ */
280
+ STREAM_TITLE : 'streamTitle',
281
+
282
+ /**
283
+ * A string specifying the stream's URL.
284
+ * @member opensocial.Activity.Field
285
+ */
286
+ STREAM_URL : 'streamUrl',
287
+
288
+ /**
289
+ * A string specifying the stream's source URL.
290
+ * @member opensocial.Activity.Field
291
+ */
292
+ STREAM_SOURCE_URL : 'streamSourceUrl',
293
+
294
+ /**
295
+ * A string specifying the URL for the stream's favicon.
296
+ * @member opensocial.Activity.Field
297
+ */
298
+ STREAM_FAVICON_URL : 'streamFaviconUrl',
299
+
300
+ /**
301
+ * A number between 0 and 1 representing the relative priority of
302
+ * this activity in relation to other activities from the same source
303
+ * @member opensocial.Activity.Field
304
+ */
305
+ PRIORITY : 'priority',
306
+
307
+ /**
308
+ * A string ID that is permanently associated with this activity.
309
+ * This value can not be set.
310
+ * @member opensocial.Activity.Field
311
+ */
312
+ ID : 'id',
313
+
314
+ /**
315
+ * The string ID of the user who this activity is for.
316
+ * This value can not be set.
317
+ * @member opensocial.Activity.Field
318
+ */
319
+ USER_ID : 'userId',
320
+
321
+ /**
322
+ * A string specifying the application that this activity is associated with.
323
+ * This value can not be set.
324
+ * @member opensocial.Activity.Field
325
+ */
326
+ APP_ID : 'appId',
327
+
328
+ /**
329
+ * A string specifying the time at which this activity took place
330
+ * in milliseconds since the epoch.
331
+ * This value can not be set.
332
+ * @member opensocial.Activity.Field
333
+ */
334
+ POSTED_TIME : 'postedTime'
335
+ };
336
+
337
+
338
+ /**
339
+ * Gets an ID that can be permanently associated with this activity.
340
+ *
341
+ * @return {string} The ID
342
+ * @member opensocial.Activity
343
+ */
344
+ opensocial.Activity.prototype.getId = function() {
345
+ return this.getField(opensocial.Activity.Field.ID);
346
+ };
347
+
348
+
349
+ /**
350
+ * Gets the activity data that's associated with the specified key.
351
+ *
352
+ * @param {string} key The key to get data for;
353
+ * see the <a href="opensocial.Activity.Field.html">Field</a> class
354
+ * for possible values
355
+ * @param {Object.<opensocial.DataRequest.DataRequestFields, Object>=}
356
+ * opt_params Additional
357
+ * <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
358
+ * to pass to the request.
359
+ * @return {string} The data
360
+ * @member opensocial.Activity
361
+ */
362
+ opensocial.Activity.prototype.getField = function(key, opt_params) {
363
+ return opensocial.Container.getField(this.fields_, key, opt_params);
364
+ };
365
+
366
+
367
+ /**
368
+ * Sets data for this activity associated with the given key.
369
+ *
370
+ * @param {string} key The key to set data for
371
+ * @param {string} data The data to set
372
+ */
373
+ opensocial.Activity.prototype.setField = function(key, data) {
374
+ return (this.fields_[key] = data);
375
+ };
pool/shard006/JavaScript/0041736_edit.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ app.controller('AdminEditCtrl', ['$scope', 'business', '$location', function ($scope, Business, $location) {
4
+ if (!Business.user.getIsAdmin()) {
5
+ $location.path('/');
6
+ }
7
+ $scope.$on('$LOGOUT', function() {
8
+ $location.path('/');
9
+ })
10
+
11
+ $scope.goTo = function(path) {
12
+ $location.search({});
13
+ $location.path(path);
14
+ }
15
+
16
+ $scope.searchTypes = [
17
+ {name:'Title and Comments', value:'default'},
18
+ {name:'Person Tag', value:'person'},
19
+ {name:'Place Tag', value:'place'},
20
+ {name:'Collection Tag', value:'collection'},
21
+ ];
22
+ $scope.fileSearchType = $scope.searchTypes[0];
23
+
24
+ $scope.individual;
25
+ $scope.file;
26
+
27
+ $scope.deleteInd = function(ind){
28
+ var cont = confirm("Delete this individual?\n"+ind.typeahead+"\nIndividual ID: "+ind.id);
29
+ if (cont) {
30
+ Business.individual.deleteInd(ind.id).then(function(result){
31
+ console.log('result', result);
32
+ });
33
+ }
34
+ }
35
+
36
+ }]);
pool/shard006/JavaScript/0041738_IDE.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { connect } from 'react-redux'
2
+ import IDE from '../components/IDE'
3
+ import { writeCode, editMode, editTheme } from '../actions/editor'
4
+ import { submit } from '../actions/submit'
5
+ import { logout } from '../actions/user'
6
+
7
+ const mapStateToProps = state => ({
8
+ code: state.editor.code,
9
+ alreadyEdit: state.editor.alreadyEdit,
10
+ mode: state.editor.mode,
11
+ theme: state.editor.theme,
12
+ user: state.user,
13
+ output: state.game.output,
14
+ challenges: state.game.challenges || [],
15
+ challenge: state.game.challenge,
16
+ pending: state.game.pending,
17
+ results: state.game.results,
18
+ score: state.game.score
19
+ })
20
+
21
+ const mapDispatchToProps = (dispatch) => ({
22
+ writeCode: code => dispatch(writeCode(code)),
23
+ editMode: mode => dispatch(editMode(mode)),
24
+ editTheme: theme => dispatch(editTheme(theme)),
25
+ logout: () => dispatch(logout()),
26
+ submit: (challengeId, code, lang, userId, simulation) => dispatch(submit(challengeId, code, lang, userId, simulation))
27
+ })
28
+
29
+ export default connect(mapStateToProps, mapDispatchToProps)(IDE)
pool/shard006/JavaScript/0041742_language-name.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Copyright (c) 2017-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ // Turn off ESLint for this file because it's sent down to users as-is.
9
+ /* eslint-disable */
10
+ window.addEventListener('load', function() {
11
+ function language(label) {
12
+ const div = document.createElement('div');
13
+ div.classList.add('languageBadge');
14
+ div.innerHTML = label;
15
+ return div;
16
+ }
17
+
18
+ function addLanguage(codeBlockSelector, language) {
19
+ document.querySelectorAll(codeBlockSelector).forEach(function(code) {
20
+ code.parentNode.appendChild(language.cloneNode(true));
21
+ });
22
+ }
23
+
24
+ addLanguage('.hljs.language-coq', language('Coq'));
25
+ addLanguage('.hljs.language-ocaml', language('OCaml'));
26
+ });
pool/shard006/JavaScript/0041743_routes.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = (function(App,Express,Package){
2
+
3
+ var Route = App.Route;
4
+ var names = {
5
+ SiteHome : '/'
6
+ };
7
+
8
+ Route.set(names);
9
+ Express.use(Route.use);
10
+ //Express.use(Cart);
11
+ Express.use('/',App.Auth.middleware.applyCSRF,require('./routes/index')(App,Route,Package));
12
+
13
+ });
pool/shard006/JavaScript/0041744_selector.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var $ = function(expr, context) {
2
+ return new $.init(expr, context);
3
+ };
4
+ $.init = function(expr,context) {
5
+ if(expr.nodeName && !context) this[0] = expr;
6
+ else {
7
+ try { var el = (context||document)['querySelectorAll'](expr); }
8
+ catch(err){ var el = expr; }
9
+ [].push.apply(this,[].slice.call(el));
10
+ }
11
+ };
12
+ $.init.prototype = {
13
+ each: function(el) {
14
+ for (var l=0;l<this.length;l++) el(this[l]);
15
+ },
16
+ css: function(prop, val) {
17
+ if ('object' == typeof prop) this.each(function(val) {
18
+ for(var i in prop) val.style[i] = prop[i];
19
+ });
20
+ else {
21
+ prop = prop.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
22
+ var el = this[0], lt = /(left||top)/.test(prop);
23
+ if(arguments.length>1) return 1 < this.length ? this.each(function(o){o.style[prop] = val;}) : el.style[prop] = val,"";
24
+ else return el.style[prop]==''?(
25
+ el.currentStyle && !lt?
26
+ el.currentStyle[prop]:(lt?
27
+ Math.round(el.getBoundingClientRect()[prop]):
28
+ document.defaultView.getComputedStyle(el, null).getPropertyValue(prop)
29
+ )
30
+ ):el.style[prop];
31
+ }
32
+ },
33
+ on: function(evt, fn) {
34
+ for (var l = this.length; l--;) {
35
+ var el = this[l];
36
+ el.addEventListener ? el.addEventListener(evt, fn, !1) : el.attachEvent("on" + evt, function() {
37
+ return fn.call(el, window.event);
38
+ });
39
+ }
40
+ },
41
+ append: function(param) {
42
+ var el = document.createElement(param.element||'div');
43
+ param.hasOwnProperty('element') && delete param.element;
44
+ el.innerHTML = param.hasOwnProperty('text')?param.text:null;
45
+ this[0].appendChild(el);
46
+ for(var i in param) el.setAttribute(i,param[i]);
47
+ },
48
+ remove: function() {
49
+ this[0].parentNode.removeChild(this[0]);
50
+ },
51
+ attr: function(key,val) {
52
+ var el = this[0];
53
+ return val ? (el.setAttribute(key, val), '') : el.getAttribute(key);
54
+ },
55
+ val: function(dat){
56
+ var el = this[0];
57
+ return arguments.length ? (el.value = dat, '') : el.value;
58
+ },
59
+ text: function(dat){
60
+ var el = this[0];
61
+ return arguments.length ? (el.innerHTML = dat, '') : el.innerHTML;
62
+ }
63
+ };
pool/shard006/JavaScript/0041746_gulpfile.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var gulp = require('gulp');
2
+ var uglify = require('gulp-uglify');
3
+ var concat = require('gulp-concat');
4
+
5
+ gulp.task('uglify', function() {
6
+ gulp.src('lib/scramble.js')
7
+ .pipe(uglify())
8
+ .pipe(concat('scramble.min.js'))
9
+ .pipe(gulp.dest('.'));
10
+ });
11
+
12
+ gulp.task('default', ['uglify']);
pool/shard006/JavaScript/0041751_AffinityPlayersOptions.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+
3
+ import PropTypes from 'prop-types';
4
+
5
+ import { bindActionCreators } from 'redux';
6
+ import { connect } from 'react-redux';
7
+
8
+ import AutosizedRatedPlayersDataList from 'builder/players/containers/AutosizedRatedPlayersDataList';
9
+
10
+ import { selectRatedPlayers as selectPlayers } from 'players/selectors';
11
+ import { selectCanLoadRatedPlayer as selectCanLoad } from 'players/selectors/request';
12
+ import { selectSmallScreen } from 'views/selectors';
13
+
14
+ import AddIcon from 'grommet/components/icons/base/AddCircle';
15
+
16
+ import { moveNextPage } from 'players/actions/ratedPlayers';
17
+ import { addTeamPlayer } from 'builder/players/actions';
18
+
19
+ const AffinityPlayersOptions = (props) =>
20
+ <AutosizedRatedPlayersDataList source={props.source} onMore={props.canLoad ? () => props.nextPage() : null} buttonAction={props.buttonAction} buttonIcon={<AddIcon />} />;
21
+
22
+ AffinityPlayersOptions.propTypes = {
23
+ canLoad: PropTypes.bool.isRequired,
24
+ nextPage: PropTypes.func.isRequired,
25
+ smallView: PropTypes.bool.isRequired,
26
+ buttonAction: PropTypes.func.isRequired,
27
+ source: PropTypes.array.isRequired
28
+ };
29
+
30
+ const mapStateToProps = (state) => {
31
+ return {
32
+ source: selectPlayers(state),
33
+ canLoad: selectCanLoad(state),
34
+ smallView: selectSmallScreen(state)
35
+ };
36
+ };
37
+
38
+ const mapDispatchToProps = (dispatch) => {
39
+ return {
40
+ nextPage: bindActionCreators(moveNextPage, dispatch),
41
+ buttonAction: bindActionCreators(addTeamPlayer, dispatch)
42
+ };
43
+ };
44
+
45
+ export default connect(
46
+ mapStateToProps,
47
+ mapDispatchToProps
48
+ )(AffinityPlayersOptions);
pool/shard006/JavaScript/0041754_angular-translate-interpolation-messageformat.js ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * angular-translate - v2.9.2 - 2016-02-21
3
+ *
4
+ * Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT
5
+ */
6
+ (function (root, factory) {
7
+ if (typeof define === 'function' && define.amd) {
8
+ // AMD. Register as an anonymous module unless amdModuleId is set
9
+ define(["messageformat"], function (a0) {
10
+ return (factory(a0));
11
+ });
12
+ } else if (typeof exports === 'object') {
13
+ // Node. Does not work with strict CommonJS, but
14
+ // only CommonJS-like environments that support module.exports,
15
+ // like Node.
16
+ module.exports = factory(require("messageformat"));
17
+ } else {
18
+ factory(MessageFormat);
19
+ }
20
+ }(this, function (MessageFormat) {
21
+
22
+ angular.module('pascalprecht.translate')
23
+
24
+ /**
25
+ * @ngdoc property
26
+ * @name pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
27
+ * @requires TRANSLATE_MF_INTERPOLATION_CACHE
28
+ *
29
+ * @description
30
+ * Uses MessageFormat.js to interpolate strings against some values.
31
+ */
32
+ .constant('TRANSLATE_MF_INTERPOLATION_CACHE', '$translateMessageFormatInterpolation')
33
+
34
+ /**
35
+ * @ngdoc object
36
+ * @name pascalprecht.translate.$translateMessageFormatInterpolation
37
+ * @requires pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
38
+ *
39
+ * @description
40
+ * Uses MessageFormat.js to interpolate strings against some values.
41
+ *
42
+ * Be aware to configure a proper sanitization strategy.
43
+ *
44
+ * See also:
45
+ * * {@link pascalprecht.translate.$translateSanitization}
46
+ * * {@link https://github.com/SlexAxton/messageformat.js}
47
+ *
48
+ * @return {object} $translateMessageFormatInterpolation Interpolator service
49
+ */
50
+ .factory('$translateMessageFormatInterpolation', $translateMessageFormatInterpolation);
51
+
52
+ function $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE) {
53
+
54
+ 'use strict';
55
+
56
+ var $translateInterpolator = {},
57
+ $cache = $cacheFactory.get(TRANSLATE_MF_INTERPOLATION_CACHE),
58
+ // instantiate with default locale (which is 'en')
59
+ $mf = new MessageFormat('en'),
60
+ $identifier = 'messageformat';
61
+
62
+ if (!$cache) {
63
+ // create cache if it doesn't exist already
64
+ $cache = $cacheFactory(TRANSLATE_MF_INTERPOLATION_CACHE);
65
+ }
66
+
67
+ $cache.put('en', $mf);
68
+
69
+ /**
70
+ * @ngdoc function
71
+ * @name pascalprecht.translate.$translateMessageFormatInterpolation#setLocale
72
+ * @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
73
+ *
74
+ * @description
75
+ * Sets current locale (this is currently not use in this interpolation).
76
+ *
77
+ * @param {string} locale Language key or locale.
78
+ */
79
+ $translateInterpolator.setLocale = function (locale) {
80
+ $mf = $cache.get(locale);
81
+ if (!$mf) {
82
+ $mf = new MessageFormat(locale);
83
+ $cache.put(locale, $mf);
84
+ }
85
+ };
86
+
87
+ /**
88
+ * @ngdoc function
89
+ * @name pascalprecht.translate.$translateMessageFormatInterpolation#getInterpolationIdentifier
90
+ * @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
91
+ *
92
+ * @description
93
+ * Returns an identifier for this interpolation service.
94
+ *
95
+ * @returns {string} $identifier
96
+ */
97
+ $translateInterpolator.getInterpolationIdentifier = function () {
98
+ return $identifier;
99
+ };
100
+
101
+ /**
102
+ * @deprecated will be removed in 3.0
103
+ * @see {@link pascalprecht.translate.$translateSanitization}
104
+ */
105
+ $translateInterpolator.useSanitizeValueStrategy = function (value) {
106
+ $translateSanitization.useStrategy(value);
107
+ return this;
108
+ };
109
+
110
+ /**
111
+ * @ngdoc function
112
+ * @name pascalprecht.translate.$translateMessageFormatInterpolation#interpolate
113
+ * @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
114
+ *
115
+ * @description
116
+ * Interpolates given string against given interpolate params using MessageFormat.js.
117
+ *
118
+ * @returns {string} interpolated string.
119
+ */
120
+ $translateInterpolator.interpolate = function (string, interpolationParams) {
121
+ interpolationParams = interpolationParams || {};
122
+ interpolationParams = $translateSanitization.sanitize(interpolationParams, 'params');
123
+
124
+ var interpolatedText = $cache.get(string + angular.toJson(interpolationParams));
125
+
126
+ // if given string wasn't interpolated yet, we do so now and never have to do it again
127
+ if (!interpolatedText) {
128
+
129
+ // Ensure explicit type if possible
130
+ // MessageFormat checks the actual type (i.e. for amount based conditions)
131
+ for (var key in interpolationParams) {
132
+ if (interpolationParams.hasOwnProperty(key)) {
133
+ // ensure number
134
+ var number = parseInt(interpolationParams[key], 10);
135
+ if (angular.isNumber(number) && ('' + number) === interpolationParams[key]) {
136
+ interpolationParams[key] = number;
137
+ }
138
+ }
139
+ }
140
+
141
+ interpolatedText = $mf.compile(string)(interpolationParams);
142
+ interpolatedText = $translateSanitization.sanitize(interpolatedText, 'text');
143
+
144
+ $cache.put(string + angular.toJson(interpolationParams), interpolatedText);
145
+ }
146
+
147
+ return interpolatedText;
148
+ };
149
+
150
+ return $translateInterpolator;
151
+ }
152
+ $translateMessageFormatInterpolation.$inject = ['$translateSanitization', '$cacheFactory', 'TRANSLATE_MF_INTERPOLATION_CACHE'];
153
+
154
+ $translateMessageFormatInterpolation.displayName = '$translateMessageFormatInterpolation';
155
+ return 'pascalprecht.translate';
156
+
157
+ }));
pool/shard006/JavaScript/0041755_sass.js ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! sass.js - v0.10.12 (e6281ce) - built 2018-11-14
2
+ providing libsass 3.5.5 (39e30874)
3
+ via emscripten 1.38.18 (7a0e274)
4
+ */
5
+
6
+ (function (root, factory) {
7
+ 'use strict';
8
+ if (typeof define === 'function' && define.amd) {
9
+ define([], factory);
10
+ } else if (typeof exports === 'object') {
11
+ module.exports = factory();
12
+ } else {
13
+ root.Sass = factory();
14
+ }
15
+ }(this, function () {/*global document*/
16
+ // identify the path sass.js is located at in case we're loaded by a simple
17
+ // <script src="path/to/sass.js"></script>
18
+ // this path can be used to identify the location of
19
+ // * sass.worker.js from sass.js
20
+ // * libsass.js.mem from sass.sync.js
21
+ // see https://github.com/medialize/sass.js/pull/32#issuecomment-103142214
22
+ // see https://github.com/medialize/sass.js/issues/33
23
+ var SASSJS_RELATIVE_PATH = (function() {
24
+ 'use strict';
25
+
26
+ // in Node things are rather simple
27
+ const hasDir = typeof __dirname !== 'undefined';
28
+ if (hasDir) {
29
+ return __dirname;
30
+ }
31
+
32
+ // we can only run this test in the browser,
33
+ // so make sure we actually have a DOM to work with.
34
+ if (typeof document === 'undefined' || !document.getElementsByTagName) {
35
+ return null;
36
+ }
37
+
38
+ // http://www.2ality.com/2014/05/current-script.html
39
+ var currentScript = document.currentScript || (function() {
40
+ var scripts = document.getElementsByTagName('script');
41
+ return scripts[scripts.length - 1];
42
+ })();
43
+
44
+ var path = currentScript && currentScript.src;
45
+ if (!path) {
46
+ return null;
47
+ }
48
+
49
+ // [worker] make sure we're not running in some concatenated thing
50
+ if (path.slice(-8) === '/sass.js') {
51
+ return path.slice(0, -8);
52
+ }
53
+
54
+ // [sync] make sure we're not running in some concatenated thing
55
+ if (path.slice(-13) === '/sass.sync.js') {
56
+ return path.slice(0, -13);
57
+ }
58
+
59
+ return null;
60
+ })() || '.';
61
+
62
+ /*global Worker, SASSJS_RELATIVE_PATH*/
63
+ 'use strict';
64
+
65
+ var noop = function(){};
66
+ var slice = [].slice;
67
+ // defined upon first Sass.initialize() call
68
+ var globalWorkerUrl;
69
+
70
+ function Sass(workerUrl) {
71
+ if (!workerUrl && !globalWorkerUrl) {
72
+ /*jshint laxbreak:true */
73
+ throw new Error(
74
+ 'Sass needs to be initialized with the URL of sass.worker.js - '
75
+ + 'either via Sass.setWorkerUrl(url) or by new Sass(url)'
76
+ );
77
+ /*jshint laxbreak:false */
78
+ }
79
+
80
+ if (!globalWorkerUrl) {
81
+ globalWorkerUrl = workerUrl;
82
+ }
83
+
84
+ // bind all functions
85
+ // we're doing this because we used to have a single hard-wired instance that allowed
86
+ // [].map(Sass.removeFile) and we need to maintain that for now (at least until 1.0.0)
87
+ for (var key in this) {
88
+ if (typeof this[key] === 'function') {
89
+ this[key] = this[key].bind(this);
90
+ }
91
+ }
92
+
93
+ this._callbacks = {};
94
+ this._worker = new Worker(workerUrl || globalWorkerUrl);
95
+ this._worker.addEventListener('message', this._handleWorkerMessage, false);
96
+ }
97
+
98
+ // allow setting the workerUrl before the first Sass instance is initialized,
99
+ // where registering the global workerUrl would've happened automatically
100
+ Sass.setWorkerUrl = function(workerUrl) {
101
+ globalWorkerUrl = workerUrl;
102
+ };
103
+
104
+ Sass.style = {
105
+ nested: 0,
106
+ expanded: 1,
107
+ compact: 2,
108
+ compressed: 3
109
+ };
110
+
111
+ Sass.comments = {
112
+ 'none': 0,
113
+ 'default': 1
114
+ };
115
+
116
+ Sass.prototype = {
117
+ style: Sass.style,
118
+ comments: Sass.comments,
119
+
120
+ destroy: function() {
121
+ this._worker && this._worker.terminate();
122
+ this._worker = null;
123
+ this._callbacks = {};
124
+ this._importer = null;
125
+ },
126
+
127
+ _handleWorkerMessage: function(event) {
128
+ if (event.data.command) {
129
+ this[event.data.command](event.data.args);
130
+ }
131
+
132
+ this._callbacks[event.data.id] && this._callbacks[event.data.id](event.data.result);
133
+ delete this._callbacks[event.data.id];
134
+ },
135
+
136
+ _dispatch: function(options, callback) {
137
+ if (!this._worker) {
138
+ throw new Error('Sass worker has been terminated');
139
+ }
140
+
141
+ options.id = 'cb' + Date.now() + Math.random();
142
+ this._callbacks[options.id] = callback;
143
+ this._worker.postMessage(options);
144
+ },
145
+
146
+ _importerInit: function(args) {
147
+ // importer API done callback pushing results
148
+ // back to the worker
149
+ var done = function done(result) {
150
+ this._worker.postMessage({
151
+ command: '_importerFinish',
152
+ args: [result]
153
+ });
154
+ }.bind(this);
155
+
156
+ try {
157
+ this._importer(args[0], done);
158
+ } catch(e) {
159
+ done({ error: e.message });
160
+ throw e;
161
+ }
162
+ },
163
+
164
+ importer: function(importerCallback, callback) {
165
+ if (typeof importerCallback !== 'function' && importerCallback !== null) {
166
+ throw new Error('importer callback must either be a function or null');
167
+ }
168
+
169
+ // callback is executed in the main EventLoop
170
+ this._importer = importerCallback;
171
+ // tell worker to activate importer callback
172
+ this._worker.postMessage({
173
+ command: 'importer',
174
+ args: [Boolean(importerCallback)]
175
+ });
176
+
177
+ callback && callback();
178
+ },
179
+ };
180
+
181
+ var commands = 'writeFile readFile listFiles removeFile clearFiles lazyFiles preloadFiles options compile compileFile';
182
+ commands.split(' ').forEach(function(command) {
183
+ Sass.prototype[command] = function() {
184
+ var callback = slice.call(arguments, -1)[0];
185
+ var args = slice.call(arguments, 0, -1);
186
+ if (typeof callback !== 'function') {
187
+ args.push(callback);
188
+ callback = noop;
189
+ }
190
+
191
+ this._dispatch({
192
+ command: command,
193
+ args: args
194
+ }, callback);
195
+ };
196
+ });
197
+
198
+ // automatically set the workerUrl in case we're loaded by a simple
199
+ // <script src="path/to/sass.js"></script>
200
+ // see https://github.com/medialize/sass.js/pull/32#issuecomment-103142214
201
+ Sass.setWorkerUrl(SASSJS_RELATIVE_PATH + '/sass.worker.js');
202
+ return Sass;
203
+ }));
pool/shard006/JavaScript/0041764_bool.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Fox.define('Views.Fields.Bool', 'Views.Fields.Base', function (Dep) {
2
+
3
+ return Dep.extend({
4
+
5
+ type: 'bool',
6
+
7
+ listTemplate: 'fields.bool.detail',
8
+
9
+ detailTemplate: 'fields.bool.detail',
10
+
11
+ editTemplate: 'fields.bool.edit',
12
+
13
+ searchTemplate: 'fields.bool.search',
14
+
15
+ validations: [],
16
+
17
+ fetch: function () {
18
+ var value = this.$element.get(0).checked;
19
+ var data = {};
20
+ data[this.name] = value;
21
+ return data;
22
+ },
23
+
24
+ fetchSearch: function () {
25
+ var data = {
26
+ type: this.$element.get(0).checked ? 'isTrue' : 'isFalse',
27
+ };
28
+ return data;
29
+ },
30
+ });
31
+ });
32
+
pool/shard006/JavaScript/0041766_validate.js ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var should = require('should')
2
+ , tsa = require('../');
3
+
4
+ describe('Custom Validations', function(){
5
+ var mustBeUpper = function(value, cb){
6
+ if(value === value.toUpperCase()){
7
+ cb();
8
+ }else{
9
+ cb('not uppercase');
10
+ }
11
+ };
12
+ var guard = tsa({
13
+ foo: tsa.property({ validate: mustBeUpper })
14
+ });
15
+
16
+ it('succeeds properly', function(done){
17
+ //arrange
18
+ var input = {
19
+ foo: 'BAR'
20
+ };
21
+
22
+ //act
23
+ guard().frisk(input, function(err, result){
24
+ //assert
25
+ should.not.exist(err);
26
+ should.exist(result);
27
+ result.foo.should.equal('BAR');
28
+
29
+ done();
30
+ });
31
+ });
32
+
33
+ it('fails properly', function(done){
34
+ //arrange
35
+ var input = {
36
+ foo: 'bar'
37
+ };
38
+
39
+ //act
40
+ guard().frisk(input, function(err, result){
41
+ //assert
42
+ should.exist(err);
43
+ err[0].error.should.equal('not uppercase');
44
+ should.not.exist(result);
45
+
46
+ done();
47
+ });
48
+ });
49
+
50
+ it('works with nested guards - negative', function(done){
51
+ //arrange
52
+ var v = function(json, cb){
53
+ if(json.bar === 'blah')
54
+ cb('can\'t equal blah');
55
+ else
56
+ cb();
57
+ };
58
+ var innerGuard = tsa({
59
+ bar: tsa.required()
60
+ });
61
+ var guard = tsa({
62
+ foo: innerGuard({ validate: v })
63
+ });
64
+ var input = {foo: {bar: 'blah'}};
65
+
66
+ //act
67
+ guard().frisk(input, function(err, result){
68
+ //assert
69
+ should.exist(err);
70
+ err.length.should.equal(1);
71
+ should.not.exist(result);
72
+
73
+ done();
74
+ });
75
+ });
76
+
77
+ it('works with nested guards - positive', function(done){
78
+ //arrange
79
+ var v = function(json, cb){
80
+ if(json.bar === 'blah')
81
+ cb('can\'t equal blah');
82
+ else
83
+ cb();
84
+ };
85
+ var innerGuard = tsa({
86
+ bar: tsa.required()
87
+ });
88
+ var guard = tsa({
89
+ foo: innerGuard({ validate: v })
90
+ });
91
+ var input = {foo: {bar: 'blah2'}};
92
+
93
+ //act
94
+ guard().frisk(input, function(err, result){
95
+ //assert
96
+ should.not.exist(err);
97
+ should.exist(result);
98
+
99
+ done();
100
+ });
101
+ });
102
+
103
+ it('can supply key name for error', function(done){
104
+ //arrange
105
+ var passwordsMustMatch = function(json, cb){
106
+ if(json.password1 === json.password2)
107
+ cb();
108
+ else
109
+ cb({ key: 'password2', error: 'Passwords must match.' });
110
+ };
111
+ var guard = tsa({
112
+ password1: tsa.required()
113
+ , password2: tsa.required()
114
+ }, { validate: passwordsMustMatch });
115
+ var input = {
116
+ password1: 'foo'
117
+ , password2: 'bar'
118
+ };
119
+
120
+ //act
121
+ guard().frisk(input, function(err, result){
122
+ //assert
123
+ should.exist(err);
124
+ err.should.be.an.instanceof(Array);
125
+ err.length.should.equal(1);
126
+ err[0].key.should.equal('password2');
127
+ err[0].error.should.equal('Passwords must match.');
128
+ should.not.exist(result);
129
+
130
+ done();
131
+ });
132
+ });
133
+
134
+ it('can return multiple errors', function(done){
135
+ //arrange
136
+ var v = function(json, cb){
137
+ cb(['error1', 'error2']);
138
+ };
139
+ var guard = tsa({
140
+ foo: tsa.validate(v)
141
+ });
142
+ var input = {foo: 'blah'};
143
+
144
+ //act
145
+ guard().frisk(input, function(err, result){
146
+ //assert
147
+ should.exist(err);
148
+ err.should.be.an.instanceof(Array);
149
+ err.length.should.equal(1);
150
+ err[0].key.should.equal('foo');
151
+ err[0].error.should.be.an.instanceof(Array);
152
+ err[0].error.length.should.equal(2);
153
+ err[0].error[0].should.equal('error1');
154
+ err[0].error[1].should.equal('error2');
155
+ should.not.exist(result);
156
+
157
+ done();
158
+ });
159
+ });
160
+ });
pool/shard006/JavaScript/0041767_displayDocumentsAndUpload.js ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, {Component} from 'react';
2
+ import {Field, reduxForm} from 'redux-form';
3
+ import { getLinkDocsWithLinkIdAction, getLinkDocsWithRFPAndIOIAction, uploadDocumentRequest, getLinksWithCompanyIdAction, deleteLinkDocumentAction, downloadLinkDocumentAction } from '../actions/index';
4
+ import { Link } from "react-router-dom";
5
+ import validator from 'validator';
6
+ import lsUtils from '../utils/ls_utils';
7
+ import cUtils from '../utils/common_utils';
8
+ import constants from '../utils/constants';
9
+ import Header from './header';
10
+ import { connect } from "react-redux";
11
+ import { bindActionCreators } from 'redux';
12
+ import FileReaderInput from 'react-file-reader-input';
13
+ import * as actionCreators from '../actions/index';
14
+ import formatCurrency from 'format-currency';
15
+ import dateFormat from 'dateformat';
16
+ import moment from 'moment';
17
+ import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
18
+
19
+
20
+ class DisplayDocumentsAndUpload extends Component{
21
+ constructor(props){
22
+ super(props);
23
+ this.state = {
24
+ user : null,
25
+ company : null,
26
+ displayLinkId : null
27
+ };
28
+ }
29
+
30
+ componentWillMount() {
31
+ let that = this;
32
+ let user = lsUtils.getValue(constants.KEY_USER_OBJECT);
33
+ let company = lsUtils.getValue(constants.KEY_COMPANY_OBJECT);
34
+ this.setState({
35
+ user : user,
36
+ company : company
37
+ });
38
+ }
39
+
40
+ handleFileUpload(type, inputFiles) {
41
+ inputFiles.persist();
42
+ var files = inputFiles.currentTarget.files;
43
+ if(files && files.length > 0){
44
+ let that = this;
45
+ let file = files[0];
46
+ this.props.uploadDocumentRequest({
47
+ file,
48
+ type : type,
49
+ ioiId : this.props.link.ioiId,
50
+ rfpId : this.props.link.rfpId,
51
+ linkId : this.props.link.linkId,
52
+ uploadedCompanyId : this.state.user.companyId
53
+ }).then((data)=>{
54
+ that.props.getLinkDocsWithLinkIdAction(that.props.link.linkId);
55
+ that.myFileInput=null;
56
+ });
57
+ }
58
+ }
59
+
60
+ downloadDocument(fileName){
61
+ this.props.downloadLinkDocumentAction(fileName)
62
+ .then((data) => {
63
+ window.open(data.payload.data.data);
64
+ });
65
+ }
66
+
67
+ deleteDocument(linkDocId, fileName){
68
+ let that = this;
69
+ this.props.deleteLinkDocumentAction(linkDocId, fileName)
70
+ .then((data) => {
71
+ for(let i=0;i<this.props.linkDocList.length; i++){
72
+ if(that.props.linkDocList[i].linkDocsId == linkDocId)
73
+ that.props.linkDocList.splice(i,1);
74
+ }
75
+ that.forceUpdate()
76
+ });
77
+ }
78
+
79
+ addDeleteIcon(item){
80
+ if(item.uploadedCompanyId === this.state.user.companyId){
81
+ return(
82
+ <span>
83
+ <Link to="#" onClick={this.deleteDocument.bind(this,item.linkDocsId, cUtils.getS3Filename(item.url))}>
84
+ <span className="glyphicon glyphicon-trash" aria-hidden="true" />
85
+ </Link>
86
+ &nbsp;&nbsp;
87
+ </span>
88
+ );
89
+ }
90
+ }
91
+
92
+ renderDocumentItem(type){
93
+ var that = this;
94
+ if(this.props.linkDocList && this.props.linkDocList.length > 0){
95
+ let list = this.props.linkDocList.filter(linkDoc => linkDoc.type === type);
96
+ if(list && list.length > 0){
97
+ return list.map(function(item){
98
+ return(<tr key={item.linkDocsId}>
99
+ <td>{item.originalFileName}</td>
100
+ <td>{item.companyName}</td>
101
+ <td>{dateFormat(moment(item.timestamp), 'longDate')}</td>
102
+ <td>
103
+ <Link to="#" onClick={that.downloadDocument.bind(that,cUtils.getS3Filename(item.url))}>
104
+ <span className="glyphicon glyphicon-download-alt" aria-hidden="true" />
105
+ </Link>&nbsp;&nbsp;
106
+ {that.addDeleteIcon(item)}
107
+ </td>
108
+ </tr>);
109
+ });
110
+ } else {
111
+ return(<tr>
112
+ <td colSpan="3">No document uploaded</td>
113
+ </tr>);
114
+ }
115
+ }
116
+ }
117
+
118
+ renderRFPAndDocuments(type){
119
+ let that=this;
120
+ let inputTagStyle= {
121
+ 'display':'inline'
122
+ };
123
+
124
+ return(<div>
125
+ <table className="table table-bordered table-striped">
126
+ <thead>
127
+ <tr>
128
+ <th>File name</th>
129
+ <th>Company Name</th>
130
+ <th>Date Modified</th>
131
+ <th>Action</th>
132
+ </tr>
133
+ </thead>
134
+ <tbody key={this.props.link.linkId+'__'+type}>
135
+ {this.renderDocumentItem(type)}
136
+ <tr>
137
+ <td colSpan="4">
138
+ <span>Select a document to upload </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
139
+ <input
140
+ id="fileInput"
141
+ ref={(ref) => this.myFileInput = ref}
142
+ style={inputTagStyle}
143
+ type="file"
144
+ onChange={that.handleFileUpload.bind(this, type)} />
145
+ </td>
146
+ </tr>
147
+ </tbody>
148
+ </table>
149
+ <br/>
150
+ </div>);
151
+ }
152
+
153
+ renderTabs(){
154
+ return(
155
+ <Tabs>
156
+ <TabList>
157
+ <Tab>
158
+ Non-Disclosure Agreement(NDA)
159
+ </Tab>
160
+ <Tab disabled={!this.props.link.accessToLender[constants.KEY_ACCESS_CONTROL_DOCUMENTS]}>
161
+ Transaction Overview
162
+ </Tab>
163
+ <Tab disabled={!this.props.link.accessToLender[constants.KEY_ACCESS_CONTROL_DOCUMENTS]}>
164
+ Company
165
+ </Tab>
166
+ <Tab disabled={!this.props.link.accessToLender[constants.KEY_ACCESS_CONTROL_DOCUMENTS]}>
167
+ Financial
168
+ </Tab>
169
+ <Tab disabled={!this.props.link.accessToLender[constants.KEY_ACCESS_CONTROL_DOCUMENTS]}>
170
+ Legal
171
+ </Tab>
172
+ <Tab disabled={!this.props.link.accessToLender[constants.KEY_ACCESS_CONTROL_DOCUMENTS]}>
173
+ Operations
174
+ </Tab>
175
+ </TabList>
176
+ <TabPanel>
177
+ {this.renderRFPAndDocuments('TXN_NDA')}
178
+ </TabPanel>
179
+ <TabPanel>
180
+ {this.renderRFPAndDocuments('TXN_OVERVIEW')}
181
+ </TabPanel>
182
+ <TabPanel>
183
+ {this.renderRFPAndDocuments('COMPANY')}
184
+ </TabPanel>
185
+ <TabPanel>
186
+ {this.renderRFPAndDocuments('FINANCIAL')}
187
+ </TabPanel>
188
+ <TabPanel>
189
+ {this.renderRFPAndDocuments('LEGAL')}
190
+ </TabPanel>
191
+ <TabPanel>
192
+ {this.renderRFPAndDocuments('OPERATIONS')}
193
+ </TabPanel>
194
+ </Tabs>
195
+ );
196
+ }
197
+
198
+ render(){
199
+ return(<div>
200
+ {this.renderTabs()}
201
+ </div>);
202
+ }
203
+
204
+ }
205
+
206
+ function mapStateToProps(state) {
207
+ let rObject={};
208
+
209
+ if(state.link.linkDocList){
210
+ rObject.linkDocList = state.link.linkDocList;
211
+ }
212
+
213
+ return rObject;
214
+ }
215
+
216
+ function mapDispatchToProps(dispatch) {
217
+ return bindActionCreators({
218
+ uploadDocumentRequest : uploadDocumentRequest,
219
+ getLinksWithCompanyIdAction : getLinksWithCompanyIdAction,
220
+ deleteLinkDocumentAction : deleteLinkDocumentAction,
221
+ downloadLinkDocumentAction : downloadLinkDocumentAction,
222
+ getLinkDocsWithRFPAndIOIAction : getLinkDocsWithRFPAndIOIAction,
223
+ getLinkDocsWithLinkIdAction : getLinkDocsWithLinkIdAction
224
+ }, dispatch);
225
+ }
226
+
227
+
228
+ export default connect(mapStateToProps, mapDispatchToProps)(DisplayDocumentsAndUpload);
pool/shard006/JavaScript/0041773_file_upload.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $(function() {
2
+ $('.directUpload').find("input:file").each(function(i, elem) {
3
+ var fileInput = $(elem);
4
+ var form = $(fileInput.parents('form:first'));
5
+ var submitButton = form.find('input[type="submit"]');
6
+ var progressBar = $("<div class='bar'></div>");
7
+ var barContainer = $("<div class='progress'></div>").append(progressBar);
8
+ fileInput.after(barContainer);
9
+ fileInput.fileupload({
10
+ fileInput: fileInput,
11
+ url: form.data('url'),
12
+ type: 'POST',
13
+ autoUpload: true,
14
+ formData: form.data('form-data'),
15
+ paramName: 'file', // S3 does not like nested name fields i.e. name="user[avatar_url]"
16
+ dataType: 'XML', // S3 returns XML if success_action_status is set to 201
17
+ replaceFileInput: false,
18
+ progressall: function (e, data) {
19
+ var progress = parseInt(data.loaded / data.total * 100, 10);
20
+ progressBar.css('width', progress + '%');
21
+ },
22
+ start: function (e) {
23
+ submitButton.prop('disabled', true);
24
+
25
+ progressBar.
26
+ css('background', 'green').
27
+ css('display', 'block').
28
+ css('width', '0%').
29
+ text("Loading...");
30
+ },
31
+ done: function(e, data) {
32
+ submitButton.prop('disabled', false);
33
+ progressBar.text("Uploading done");
34
+
35
+ // extract key and generate URL from response
36
+ var key = $(data.jqXHR.responseXML).find("Key").text();
37
+ var url = 'https://' + form.data('host') + '/' + key;
38
+
39
+ // create hidden field
40
+ var input = $("<input />", { type:'hidden', name: fileInput.attr('name'), value: url });
41
+ form.append(input);
42
+ },
43
+ fail: function(e, data) {
44
+ submitButton.prop('disabled', false);
45
+
46
+ progressBar.
47
+ css("background", "red").
48
+ text("Failed");
49
+ }
50
+ });
51
+ });
52
+ });
pool/shard006/JavaScript/0041775_progress_bar.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var get = Ember.get, fmt = Ember.String.fmt;
2
+
3
+ Bootstrap.ProgressBar = Ember.View.extend({
4
+ classNames: ['progress'],
5
+ classNameBindings: ['isStriped:progress-striped', 'isAnimated:active'],
6
+ template: Ember.Handlebars.compile('<div class="bar" {{bindAttr style="view.style"}}></div>'),
7
+ isAnimated: false,
8
+ isStriped: false,
9
+ progress: 0,
10
+
11
+ style: Ember.computed(function() {
12
+ var progress = get(this, 'progress');
13
+
14
+ return fmt('width:%@%;', [progress]);
15
+ }).property('progress').cacheable()
16
+ });
pool/shard006/JavaScript/0041776_common.js ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * build by rwson @ 2015-01-10
4
+ *
5
+ * 完成微信端的一些自适应屏幕功能(css3中的缩放特性)
6
+ *
7
+ */
8
+
9
+ $(function () {
10
+
11
+ var phoneWidth = parseInt(window.screen.width),
12
+ phoneScale = phoneWidth / 640,
13
+ ua = navigator.userAgent;
14
+ if (/Android/.test(ua)) {
15
+ if (/Android (\d+\.\d+)/.test(ua)) {
16
+ var version = parseFloat(RegExp.$1);
17
+ $("head").append('<meta name="viewport" content="initial-scale=0.5,maximum-scale=0.5,minimum-scale=0.5, width=640, target-densitydpi=device-dpi">');
18
+ } else {
19
+ $("head").append('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
20
+ }
21
+ } else {
22
+ $("head").append('<meta name="viewport" content="initial-scale=0.5,maximum-scale=0.5,minimum-scale=0.5, user-scalable=no">');
23
+ }
24
+
25
+ var w = $(window).width();
26
+ var h = $(window).height();
27
+
28
+ var scale = w / 640;
29
+
30
+ var tw = Math.ceil(w / scale);
31
+ var th = Math.ceil(h / scale);
32
+
33
+ $(".zoomer").css({
34
+ "-webkit-transform-origin": "0 0",
35
+ "-moz-transform-origin": "0 0",
36
+ "-ms-transform-origin": "0 0",
37
+ "-o-transform-origin": "0 0",
38
+ "transform-origin": "0 0"
39
+ });
40
+ $(".zoomer").css({
41
+ "-webkit-transform": "scale(" + scale + "," + scale + ")",
42
+ "-moz-transform": "scale(" + scale + "," + scale + ")",
43
+ "-ms-transform": "scale(" + scale + "," + scale + ")",
44
+ "-o-transform": "scale(" + scale + "," + scale + ")",
45
+ "transform": "scale(" + scale + "," + scale + ")"
46
+ });
47
+
48
+ $("html").css({"width": w});
49
+ $("body").css({"width": w});
50
+ $(".zoomer").css({"width": tw});
51
+
52
+ if($("div.full-screen").length > 0){
53
+ $("html").css({"height": h});
54
+ $("body").css({"height": h});
55
+ $(".zoomer").css({"height": th});
56
+ $(".wrap").css({"height": th});
57
+ }
58
+ /*
59
+ * 在页面上制定了全屏时,再应用高度值
60
+ * */
61
+
62
+ var imgs = [
63
+ "img/common/loading.gif",
64
+ "img/common/pop_close.png",
65
+ "http://c.hiphotos.baidu.com/image/pic/item/a71ea8d3fd1f4134c5f15073271f95cad0c85efc.jpg",
66
+ "http://f.hiphotos.baidu.com/image/pic/item/aab219ebc4b74543a95f4ed0c41c178a82b9011464.jpg",
67
+ "http://c.hiphotos.baidu.com/image/pic/item/730e0cf3d7ca7bcbc0ac8422bc096b63f724a8ec.jpg",
68
+ "http://g.hiphotos.baidu.com/image/pic/item/9a504fc2d562853553a9290e93ef76c6a7ef6350.jpg"
69
+ ];
70
+
71
+ preloadImage(imgs, function () {
72
+ });
73
+
74
+ $("body").tap(function(){
75
+ alert("fuck");
76
+ });
77
+ });
pool/shard006/JavaScript/0041780_weather-process.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // # A Simple Process for Checking the Weather
2
+ //
3
+ var requirejs = require('requirejs')
4
+ define(['restify', 'restify-q', 'pvm-q', 'q'], function(restify, rq, pvm, Q) {
5
+
6
+ // Definition of a process starts by creating an empty ProcessDefinition.
7
+ var weather = new pvm.ProcessDefinition()
8
+
9
+ // The initial task uses the [OpenWeatherMap API](http://openweathermap.org/API)
10
+ // to get the temperature at a specified location on Earth. The query runs
11
+ // asynchronously with the help of [Restify](https://github.com/mcavage/node-restify)
12
+ // and [Q](https://github.com/kriskowal/q).
13
+ weather.task('start', function() {
14
+ console.log(
15
+ '[' + this.city + '] Fetching weather info from openweathermap.org...')
16
+
17
+ // We start of by setting up a client for querying the OpenWeatherMap API.
18
+ var client = restify.createJsonClient({
19
+ url: 'http://api.openweathermap.org/'
20
+ })
21
+
22
+ // We then make the request for the weather data at the specified city. We
23
+ // expect that the user defines this city when starting the process.
24
+ //
25
+ // Note that we return the promise of this 'calculation' as a return value
26
+ // for this task. We must do this for the PVM to be able to capture this
27
+ // promise and react to its completion as needed. If we don't do this then
28
+ // the PVM will immediately move on to the transition phase, even if the
29
+ // task itself was not yet completed.
30
+ return rq.get(client, '/data/2.5/weather?units=metric&q=' + this.city)
31
+ // When we get the answer we store the temperature in the process state,
32
+ // making it available for the transitioning logic.
33
+ .then(function(R) {
34
+ this.temperature = R.obj.main.temp
35
+ console.log(
36
+ '[' + this.city + '] Currently a temperature of ' + this.temperature
37
+ + ' degrees Celcius.')
38
+ }.bind(this))
39
+ // Whatever happens, we should always close the connection at the end.
40
+ // Otherwise the program may hang.
41
+ .fin(function() { client.close() })
42
+ })
43
+ // The transitioning itself is pretty basic. Depending on the reported
44
+ // temperature we transition to one of three different outcomes.
45
+ .transition(function() {
46
+ if (this.temperature < 0) return 'freezing'
47
+ else if (this.temperature > 25) return 'hot'
48
+ else return 'moderate'
49
+ })
50
+
51
+ // This is the outcome for when it's freezing.
52
+ weather.task('freezing', function() {
53
+ console.log('[' + this.city + '] Don\'t forget your scarf !')
54
+ })
55
+
56
+ // This is what to do when the weather is hot.
57
+ weather.task('hot', function() {
58
+ console.log('[' + this.city + '] Don\'t forget your sunblock !')
59
+ })
60
+
61
+ // Otherwise there's some generic good advice to follow.
62
+ weather.task('moderate', function() {
63
+ console.log('[' + this.city + '] Don\'t forget your pants !')
64
+ })
65
+
66
+ // Finally, we return the completed process definition as the result of this
67
+ // module.
68
+ return weather
69
+ })
pool/shard006/JavaScript/0041783_background_importer_item_view.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var cdb = require('cartodb.js');
2
+ var UploadConfig = require('../../new_common/upload_config');
3
+ var ErrorDetailsDialog = require('../../new_dashboard/dialogs/error_details_view');
4
+ var SuccessDetailsDialog = require('../../new_dashboard/dialogs/success_details_view');
5
+
6
+ /**
7
+ * Import item within background importer
8
+ *
9
+ */
10
+
11
+ module.exports = cdb.core.View.extend({
12
+
13
+ className: 'ImportItem',
14
+ tagName: 'li',
15
+
16
+ events: {
17
+ 'click .js-abort': '_removeItem',
18
+ 'click .js-show_error': '_showImportError',
19
+ 'click .js-show_stats': '_showImportStats',
20
+ 'click .js-close': '_removeItem'
21
+ },
22
+
23
+ initialize: function() {
24
+ this.router = this.options.router;
25
+ this.user = this.options.user;
26
+ this.template = cdb.templates.getTemplate('new_dashboard/views/background_importer/background_importer_item_view');
27
+ this._initBinds();
28
+ },
29
+
30
+ render: function() {
31
+ var upload = this.model.get('upload');
32
+ var imp = this.model.get('import');
33
+
34
+ var d = {
35
+ name: '',
36
+ state: this.model.get('state'),
37
+ progress: '',
38
+ service: '',
39
+ step: this.model.get('step'),
40
+ url: '',
41
+ failed: this.model.hasFailed(),
42
+ completed: this.model.hasCompleted(),
43
+ tables_created_count: imp.tables_created_count
44
+ };
45
+
46
+ // URL
47
+ if (d.state === "complete") {
48
+ var vis = this.model.importedVis();
49
+ if (vis) {
50
+ d.url = encodeURI(vis.viewUrl(this.user).edit());
51
+ }
52
+ }
53
+
54
+ // Name
55
+ if (upload.type) {
56
+ if (upload.type === "file") {
57
+ if (upload.value.length > 1) {
58
+ d.name = upload.value.length + ' files';
59
+ } else {
60
+ d.name = upload.value.name;
61
+ }
62
+ }
63
+ if (upload.type === "url" || upload.type === "remote") {
64
+ d.name = upload.value;
65
+ }
66
+ if (upload.type === "service") {
67
+ d.name = upload.value && upload.value.filename || '';
68
+ }
69
+ if (upload.service_name === "twitter_search") {
70
+ d.name = 'Twitter import';
71
+ }
72
+ } else {
73
+ d.name = imp.item_queue_id || 'import';
74
+ }
75
+
76
+ // Service
77
+ var serviceName = this.model.get('upload').service_name;
78
+ if (serviceName && serviceName !== 'twitter_search') {
79
+ d.service = serviceName;
80
+ }
81
+
82
+ // Progress
83
+ if (this.model.get('step') === 'upload') {
84
+ d.progress = this.model.get('upload').progress;
85
+ } else {
86
+ d.progress = (UploadConfig.uploadStates.indexOf(d.state)/UploadConfig.uploadStates.length) * 100;
87
+ }
88
+
89
+ this.$el.html(this.template(d));
90
+
91
+ return this;
92
+ },
93
+
94
+ _initBinds: function() {
95
+ this.model.bind('change:state', this._onStateChange, this);
96
+ this.model.bind('change', this.render, this);
97
+ this.model.bind('remove', this.clean, this);
98
+ },
99
+
100
+ _onStateChange: function() {
101
+ if (this.model.get('state') === "complete") {
102
+ this.trigger('completed', this);
103
+ }
104
+ },
105
+
106
+ _removeItem: function() {
107
+ this.trigger('remove', this.model, this);
108
+ this.model.pause();
109
+ this.clean();
110
+ },
111
+
112
+ _showImportStats: function() {
113
+ (new SuccessDetailsDialog({
114
+ clean_on_hide: true,
115
+ model: this.model
116
+ })).appendToBody();
117
+ },
118
+
119
+ _showImportError: function() {
120
+ (new ErrorDetailsDialog({
121
+ clean_on_hide: true,
122
+ model: this.model
123
+ })).appendToBody();
124
+ }
125
+
126
+ });
pool/shard006/JavaScript/0041790_controls.js ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { glMatrix, vec3 } from './dependencies/gl-matrix.js';
2
+ import Input from './input.js';
3
+ import Console from './console.js';
4
+ import Camera from './camera.js';
5
+ import Settings from './settings.js';
6
+ import State from './state.js';
7
+ import UI from './ui.js';
8
+ import Update from './update.js';
9
+ import Translations from './translations.js';
10
+ import Utils from './utils.js';
11
+ import Resources from './resources.js';
12
+ import Weapons from './weapons.js';
13
+
14
+ const music = Resources.get('sounds/music.sfx');
15
+
16
+ UI.register('MAIN_MENU', {
17
+ header: Translations.get('MAIN_MENU'),
18
+ controls: [
19
+ {
20
+ text: Translations.get('CONTINUE_GAME'),
21
+ callback: () => {
22
+ Utils.dispatchCustomEvent('changestate', {
23
+ state: 'GAME'
24
+ });
25
+ music.play();
26
+ }
27
+ },
28
+ {
29
+ text: Translations.get('VERSION_CHECK'),
30
+ callback: () => {
31
+ Update.force();
32
+ }
33
+ }
34
+ ]
35
+ });
36
+
37
+ document.addEventListener(
38
+ 'pointerlockchange',
39
+ () => {
40
+ if (document.pointerLockElement === null) {
41
+ if (State !== 'MENU') {
42
+ Utils.dispatchCustomEvent('changestate', {
43
+ state: 'MENU',
44
+ menu: 'MAIN_MENU'
45
+ });
46
+ music.pause();
47
+ }
48
+ }
49
+ },
50
+ false
51
+ );
52
+
53
+ document.addEventListener('pointerlockerror', () => {
54
+ // Workarround for Chrome where it would throw an error in some weird case.
55
+ Utils.dispatchCustomEvent('changestate', {
56
+ state: 'GAME'
57
+ });
58
+ });
59
+
60
+ window.addEventListener(
61
+ 'focus',
62
+ () => {
63
+ if (State !== 'MENU') {
64
+ Utils.dispatchCustomEvent('changestate', {
65
+ state: 'MENU',
66
+ menu: 'MAIN_MENU'
67
+ });
68
+ }
69
+ },
70
+ false
71
+ );
72
+
73
+ // console
74
+ Input.addKeyDownEvent(192, () => {
75
+ Console.toggle();
76
+ });
77
+ Input.addKeyDownEvent(13, () => {
78
+ Console.executeCmd();
79
+ });
80
+
81
+ // mouse buttons input
82
+ window.addEventListener('click', (e) => {
83
+ if (e.button > 0) return;
84
+ if ((e.target.tagName.toUpperCase() !== 'BODY') && !Utils.isMobile()) return;
85
+ if ((e.target.id !== 'look') && Utils.isMobile()) return;
86
+ Weapons.shootGrenade();
87
+ });
88
+
89
+ window.addEventListener('wheel', (e) => {
90
+ if (State !== 'GAME') return;
91
+ if (e.deltaY < 0) {
92
+ Weapons.selectNext();
93
+ } else if (e.deltaY > 0) {
94
+ Weapons.selectPrevious();
95
+ }
96
+ });
97
+
98
+ // mouse movement and keyboard input
99
+ const Controls = {
100
+ update(frametime) {
101
+ if (Console.visible() || State === 'MENU') return;
102
+ const ft = frametime / 1000;
103
+
104
+ // look
105
+ const mpos = Input.cursorMovement();
106
+ Camera.rotation[0] -= (mpos.x / 33.0) * Settings.lookSensitivity;
107
+ Camera.rotation[1] += (mpos.y / 33.0) * Settings.lookSensitivity;
108
+ if (Camera.rotation[1] > 89) {
109
+ Camera.rotation[1] = 89;
110
+ }
111
+ if (Camera.rotation[1] < -89) {
112
+ Camera.rotation[1] = -89;
113
+ }
114
+ if (Camera.rotation[0] < 0) {
115
+ Camera.rotation[0] = 360;
116
+ }
117
+ if (Camera.rotation[0] > 360) {
118
+ Camera.rotation[0] = 0;
119
+ }
120
+ Camera.direction[0] = 0;
121
+ Camera.direction[1] = 0;
122
+ Camera.direction[2] = 1;
123
+ vec3.rotateX(Camera.direction, Camera.direction, [0, 0, 0], glMatrix.toRadian(Camera.rotation[1]));
124
+ vec3.rotateY(Camera.direction, Camera.direction, [0, 0, 0], glMatrix.toRadian(Camera.rotation[0]));
125
+ vec3.normalize(Camera.direction, Camera.direction);
126
+
127
+ // movement
128
+ let move = 0;
129
+ let strafe = 0;
130
+
131
+ Weapons.setIsMoving(false);
132
+ if (Input.isDown(Settings.forward)) {
133
+ move += 1;
134
+ Weapons.setIsMoving(true);
135
+ }
136
+ if (Input.isDown(Settings.backwards)) {
137
+ move -= 1;
138
+ Weapons.setIsMoving(true);
139
+ }
140
+ if (Input.isDown(Settings.left)) {
141
+ strafe -= 1;
142
+ Weapons.setIsMoving(true);
143
+ }
144
+ if (Input.isDown(Settings.right)) {
145
+ strafe += 1;
146
+ Weapons.setIsMoving(true);
147
+ }
148
+
149
+ // calculate new position and view direction
150
+ const v = vec3.clone(Camera.direction);
151
+ v[1] = 0;
152
+ vec3.rotateY(v, v, [0, 0, 0], glMatrix.toRadian(-90));
153
+ vec3.normalize(v, v);
154
+ move *= ft * Settings.moveSpeed;
155
+ strafe *= ft * Settings.moveSpeed;
156
+ Camera.position[0] = Camera.position[0] + Camera.direction[0] * move + v[0] * strafe;
157
+ Camera.position[1] = Camera.position[1] + Camera.direction[1] * move + v[1] * strafe;
158
+ Camera.position[2] = Camera.position[2] + Camera.direction[2] * move + v[2] * strafe;
159
+ }
160
+ };
161
+
162
+ export { Controls as default };
pool/shard006/JavaScript/0041792_index.js ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import React, { Component } from 'react';
3
+ import { connect } from 'react-redux';
4
+ import { actions } from 'react-native-navigation-redux-helpers';
5
+ import { Dimensions, BackAndroid } from 'react-native'
6
+ import { Container, Header, Title, Content, Text, Button, Icon, Item, Input, Left,Thumbnail, Right, Body, Footer } from 'native-base';
7
+ import Classified from '../classified'
8
+ import ListZone from '../listZone'
9
+ import { openDrawer } from '../../actions/drawer';
10
+ import styles from './styles';
11
+ import { Grid, Row, Col } from 'react-native-easy-grid';
12
+ import { fetchAdvertisingZone, resetState, resetStateBack } from '../../actions/list';
13
+
14
+
15
+ const {
16
+ reset,
17
+ popRoute,
18
+ } = actions;
19
+
20
+
21
+ class BlankPage extends Component {
22
+
23
+ static propTypes = {
24
+ name: React.PropTypes.string,
25
+ index: React.PropTypes.number,
26
+ list: React.PropTypes.arrayOf(React.PropTypes.object),
27
+ openDrawer: React.PropTypes.func,
28
+ popRoute: React.PropTypes.func,
29
+ reset: React.PropTypes.func,
30
+ navigation: React.PropTypes.shape({
31
+ key: React.PropTypes.string,
32
+ }),
33
+ }
34
+ componentWillMount(){
35
+
36
+
37
+ this.props.fetchAdvertisingZone()
38
+
39
+ }
40
+
41
+ popRoute() {
42
+ this.props.popRoute(this.props.navigation.key);
43
+ this.props.resetState()
44
+
45
+ }
46
+ componentWillUnmount(){
47
+
48
+ this.props.resetStateBack()
49
+
50
+ }
51
+
52
+
53
+
54
+ render() {
55
+
56
+ const { props: { name, index, list } } = this;
57
+ const { width, height } = Dimensions.get('window')
58
+ return (
59
+
60
+ <Container style={styles.container}>
61
+ <Header searchBar style={{ backgroundColor: '#ffa726' }}>
62
+ <Left>
63
+ <Button transparent onPress={() => this.popRoute()}>
64
+ <Icon style={{color: 'dimgray'}} name="arrow-round-back" />
65
+ </Button>
66
+ </Left>
67
+ <Body>
68
+ <Title>{this.props.list[index].category_name}</Title>
69
+ </Body>
70
+
71
+ <Right>
72
+
73
+ <Button transparent onPress={this.props.openDrawer}>
74
+ <Icon style={{color: 'dimgray'}} name="md-more" />
75
+ </Button>
76
+ </Right>
77
+ </Header>
78
+ <Grid style={{ maxHeight: 62, flex: 1 }}>
79
+ <Row>
80
+ <Thumbnail style={styles.imagePub} square source={{ uri: this.props.advertising[randomIndex].image}} />
81
+ </Row>
82
+ </Grid>
83
+ <Content padder scrollEnabled={true} style={{ paddingLeft: 5 }}>
84
+ <ListZone />
85
+ </Content>
86
+ </Container>
87
+ );
88
+ }
89
+ }
90
+
91
+ function bindAction(dispatch) {
92
+ return {
93
+ openDrawer: () => dispatch(openDrawer()),
94
+ popRoute: key => dispatch(popRoute(key)),
95
+ reset: key => dispatch(reset([{ key: 'home' }], key, 0)),
96
+ fetchAdvertisingZone: index => dispatch(fetchAdvertisingZone(index)),
97
+ resetState: () => dispatch(resetState()),
98
+ resetStateBack: () => dispatch(resetStateBack()),
99
+
100
+ };
101
+ }
102
+
103
+ const mapStateToProps = state => ({
104
+ navigation: state.cardNavigation,
105
+ name: state.user.name,
106
+ index: state.list.selectedIndex,
107
+ list: state.list.list,
108
+ advertising: state.list.advertisingZone,
109
+ });
110
+
111
+
112
+ export default connect(mapStateToProps, bindAction)(BlankPage);
pool/shard006/JavaScript/0041793_master-track-script.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var CodeMirror = require('./lib/codemirror');
2
+ require('./simple.js');
3
+ var parsers = require('../../interpreter/parsers');
4
+
5
+ var parsers = [].concat(parsers.setter).concat(parsers.master);
6
+
7
+ var trackRegex = [];
8
+
9
+ trackRegex.push({regex: /$^/, token: 'annotation', push:'start'});
10
+ trackRegex.push({regex: /$^/, token: 'substitution', push:'start'});
11
+
12
+ var parserRegex = parsers.map(p => {
13
+ var parser = new p();
14
+ if (!parser.test || parser.dynamic) return null;
15
+ return {
16
+ regex: parser.test,
17
+ token: parser.type.toLowerCase(),// + parser.sub ? ' sub' : '',
18
+ push: 'start'
19
+ };
20
+ }).filter(p => p !== null);
21
+
22
+ trackRegex = trackRegex.concat(parserRegex);
23
+
24
+ trackRegex.push({regex: /\(|\)/, token: 'bracket',push:'start'});
25
+ trackRegex.push({regex: /\{|\}/, token: 'brace',push:'start'});
26
+ trackRegex.push({regex: /( ?)\*( ?)[\d]+/, token: 'loop',push:'start'});
27
+
28
+ CodeMirror.defineSimpleMode('master-track-script', {
29
+ start: trackRegex,
30
+ // The multi-line comment state.
31
+ comment: [
32
+ {regex: /.*?\*\//, token: "comment", next: "start"},
33
+ {regex: /.*/, token: "comment"}
34
+ ],
35
+ // The meta property contains global information about the mode. It
36
+ // can contain properties like lineComment, which are supported by
37
+ // all modes, and also directives like dontIndentStates, which are
38
+ // specific to simple modes.
39
+ meta: {
40
+ dontIndentStates: ["comment"],
41
+ lineComment: "rem"
42
+ }
43
+ });
pool/shard006/JavaScript/0041796_get-npm-exec-opts.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+
3
+ const log = require("npmlog");
4
+
5
+ module.exports = getExecOpts;
6
+
7
+ function getExecOpts(pkg, registry) {
8
+ // execa automatically extends process.env
9
+ const env = {};
10
+
11
+ if (registry) {
12
+ env.npm_config_registry = registry;
13
+ }
14
+
15
+ log.silly("getExecOpts", pkg.location, registry);
16
+ return {
17
+ cwd: pkg.location,
18
+ env,
19
+ pkg,
20
+ };
21
+ }
pool/shard006/JavaScript/0041797_wysiwyg.init.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ jQuery.support = jQuery.support || {}; // D6- only.
3
+
4
+ Nochommons.wysiwyg = Nochommons.wysiwyg || { 'instances': {} };
5
+
6
+ Nochommons.wysiwyg.editor = Nochommons.wysiwyg.editor || { 'init': {}, 'attach': {}, 'detach': {}, 'instance': {} };
7
+
8
+ Nochommons.wysiwyg.plugins = Nochommons.wysiwyg.plugins || {};
9
+
10
+ (function ($) {
11
+ // Determine support for queryCommandEnabled().
12
+ // An exception should be thrown for non-existing commands.
13
+ // Safari and Chrome (WebKit based) return -1 instead.
14
+ try {
15
+ document.queryCommandEnabled('__wysiwygTestCommand');
16
+ $.support.queryCommandEnabled = false;
17
+ }
18
+ catch (error) {
19
+ $.support.queryCommandEnabled = true;
20
+ }
21
+ })(jQuery);
pool/shard006/JavaScript/0041798_webpack.dev.conf.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict'
2
+
3
+ let utils = require('./utils');
4
+ let webpack = require('webpack');
5
+ let config = require('../config');
6
+ let merge = require('webpack-merge');
7
+ let baseWebpackConfig = require('./webpack.base.conf');
8
+ let HtmlWebpackPlugin = require('html-webpack-plugin');
9
+ let FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
10
+
11
+ // add hot-reload related code to entry chunks
12
+ Object.keys(baseWebpackConfig.entry).forEach(function (name) {
13
+ baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
14
+ })
15
+
16
+ module.exports = merge(baseWebpackConfig, {
17
+ module: {
18
+ rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
19
+ },
20
+ // cheap-module-eval-source-map is faster for development
21
+ devtool: '#cheap-module-eval-source-map',
22
+ plugins: [
23
+ new webpack.DefinePlugin({
24
+ 'process.env': config.dev.env
25
+ }),
26
+ // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
27
+ new webpack.HotModuleReplacementPlugin(),
28
+ new webpack.NoEmitOnErrorsPlugin(),
29
+ // https://github.com/ampedandwired/html-webpack-plugin
30
+ new HtmlWebpackPlugin({
31
+ filename: 'index.html',
32
+ template: 'index.html',
33
+ inject: true
34
+ }),
35
+ new FriendlyErrorsPlugin()
36
+ ]
37
+ });
pool/shard006/JavaScript/0041800_adsense.directive.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function () {
2
+
3
+ 'use strict';
4
+
5
+ var ngAdSense = angular.module('trialsReportApp');
6
+ ngAdSense.constant('SCRIPT_URL', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
7
+
8
+ ngAdSense.service('AdsenseTracker', [function () {
9
+ this.isLoaded = false;
10
+ }]);
11
+
12
+ ngAdSense.controller('AdsenseController', ["SCRIPT_URL", "AdsenseTracker", "$timeout", "$scope", function (SCRIPT_URL, AdsenseTracker, $timeout, $scope) {
13
+
14
+ if (!$scope.playerAd) {
15
+ var s = document.createElement('script');
16
+ s.src = SCRIPT_URL;
17
+ document.body.appendChild(s);
18
+ AdsenseTracker.isLoaded = true;
19
+ }
20
+ $timeout(function () {
21
+ try {
22
+ (window.adsbygoogle = window.adsbygoogle || []).push({});
23
+ } catch (ex) {
24
+ }
25
+ }, 750);
26
+ }]);
27
+
28
+ ngAdSense.directive('adsense', function () {
29
+ return {
30
+ restrict: 'E',
31
+ replace: true,
32
+ scope: {
33
+ adClient: '@',
34
+ adSlot: '@',
35
+ inlineStyle: '@',
36
+ playerAd: '@'
37
+ },
38
+ template: '<div class="ads"><ins class="adsbygoogle" data-ad-client="{{adClient}}" data-ad-slot="{{adSlot}}" style="{{inlineStyle}}"></ins></div>',
39
+ controller: 'AdsenseController'
40
+ };
41
+ });
42
+ }());
pool/shard006/JavaScript/0041801_index.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ var util = require('util');
3
+ var path = require('path');
4
+ var yeoman = require('yeoman-generator');
5
+
6
+
7
+ var WpwidgetGenerator = module.exports = function WpwidgetGenerator(args, options, config) {
8
+ yeoman.generators.Base.apply(this, arguments);
9
+
10
+ this.on('end', function () {
11
+ this.installDependencies({ skipInstall: options['skip-install'] });
12
+ });
13
+
14
+ this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
15
+ };
16
+
17
+ util.inherits(WpwidgetGenerator, yeoman.generators.Base);
18
+
19
+ WpwidgetGenerator.prototype.askFor = function askFor() {
20
+ var cb = this.async();
21
+
22
+ // have Yeoman greet the user.
23
+ console.log(this.yeoman);
24
+
25
+ var prompts = [{
26
+ name: 'widgetName',
27
+ message: 'What do you want to call your WP-Widget\n(use spaces if necesary, avoid using \'_\' or \'-\' characters, eg. My Widget) \n?'
28
+ }, {
29
+ name: 'domainPrefix',
30
+ message: 'What is your domain prefix (eg. myapp)\n?'
31
+ }, {
32
+ name: 'widgetDescription',
33
+ message: 'What is the description of your widget\n?'
34
+ }, {
35
+ type: 'list',
36
+ name: 'jsFramework',
37
+ message: 'Which JS js setup do you have\n?',
38
+ choices: [{
39
+ name: "plain js",
40
+ value: 'plain'
41
+ },{
42
+ name: "jQuery",
43
+ value: 'jquery'
44
+ },{
45
+ name: "AngularJS",
46
+ value: 'angularjs'
47
+ },{
48
+ name: "Module",
49
+ value: 'module'
50
+ },{
51
+ name: "let me handle it",
52
+ value: 'none'
53
+ }
54
+ ]
55
+ }];
56
+
57
+ this.prompt(prompts, function (props) {
58
+ this.widgetName = this._sanitize( props.widgetName );
59
+ this.domainPrefix = this._sanitize( props.domainPrefix );
60
+ this.widgetDescription = this._sanitize( props.widgetDescription );
61
+ this.jsFramework = props.jsFramework;
62
+ console.log("this.jsFramework", this.jsFramework);
63
+
64
+ cb();
65
+ }.bind(this));
66
+ };
67
+
68
+ WpwidgetGenerator.prototype.app = function app() {
69
+ this.dashedWidgetName = this.widgetName.replace( /\s/g, '-').toLowerCase();
70
+ this.underscoredWidgetName = this.widgetName.replace( /\s/g, '_');
71
+ this.TitleCaseWidgetName = this.widgetName.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
72
+ this.classWidgetName = this.TitleCaseWidgetName.replace( /\s/g, '_');
73
+
74
+
75
+ this.mkdir(this.dashedWidgetName);
76
+ this.mkdir(this.dashedWidgetName + '/css');
77
+ this.mkdir(this.dashedWidgetName + '/js');
78
+ this.mkdir(this.dashedWidgetName + '/lang');
79
+ this.mkdir(this.dashedWidgetName + '/views');
80
+
81
+ this.template('_plugin.php', this.dashedWidgetName + '/' + this.dashedWidgetName + '-widget.php');
82
+
83
+ this.template('css/' + '_admin.css', this.dashedWidgetName + '/css/admin.css');
84
+ this.template('css/' + '_widget.css', this.dashedWidgetName + '/css/widget.css');
85
+
86
+ this.template('views/' + '_admin.php', this.dashedWidgetName + '/views/admin.php');
87
+ this.template('views/' + '_widget.php', this.dashedWidgetName + '/views/widget.php');
88
+
89
+ this.template('js/' + '_admin.js', this.dashedWidgetName + '/js/admin.js');
90
+ this.template('js/' + '_widget.js', this.dashedWidgetName + '/js/widget.js');
91
+
92
+ this.copy('lang/_plugin.po', this.dashedWidgetName + '/lang/plugin.po');
93
+ this.copy('README.txt', this.dashedWidgetName + '/README.txt');
94
+
95
+ this.template('_package.json', 'package.json');
96
+ this.template('_bower.json', 'bower.json');
97
+ };
98
+
99
+ WpwidgetGenerator.prototype.projectfiles = function projectfiles() {
100
+ this.copy('editorconfig', '.editorconfig');
101
+ this.copy('jshintrc', '.jshintrc');
102
+ };
103
+
104
+
105
+ WpwidgetGenerator.prototype._sanitize = function sanitize(str) {
106
+ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
107
+ };
pool/shard006/JavaScript/0041802_difference.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global jsts, self */
2
+
3
+ /**
4
+ *
5
+ * Hand the script two geojson objects and return the geometry that is the difference of the two
6
+ */
7
+ importScripts('../js/libs/javascript.util.js', '../js/libs/jsts.js');
8
+
9
+ var wkts = null;
10
+ var buffers = [];
11
+ reader = new jsts.io.GeoJSONReader();
12
+ writer = new jsts.io.GeoJSONWriter();
13
+
14
+ onmessage = function (evt) {
15
+ var geometry1 = reader.read(evt.data.queue[0]).geometry;
16
+ var geometry2 = reader.read(evt.data.queue[1]).geometry;
17
+
18
+ //do they touch?
19
+ var result = geometry1.difference(geometry2);
20
+ var output = [];
21
+ //result.forEach(function (geom) {
22
+ // var f = {type: "Feature", properties: {}, geometry: writer.write(geom)};
23
+ // output.features.push(f);
24
+ // });
25
+ output = writer.write(result);
26
+ self.postMessage(JSON.stringify(output));
27
+ };
pool/shard006/JavaScript/0041805_HomeControllerSpec.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ describe('Controller: public/HomeController', function() {
4
+ var $rootScope, $scope;
5
+ var $controller, service;
6
+ var websiteDeferred, blogDeferred, authorDeferred;
7
+
8
+ var mockWebsite = {
9
+ $get: function(rel) {}
10
+ };
11
+
12
+ var mockBlogPost = {
13
+ title: 'Test Blog',
14
+ content: '<p>This is first paragraph.</p> Other parts...',
15
+ $get: function(rel) {}
16
+ };
17
+
18
+ var mockAuthor = {
19
+ displayName: 'author'
20
+ };
21
+
22
+ beforeEach(module('jiwhizWeb'));
23
+
24
+ beforeEach(inject(function(_$rootScope_, _$controller_, _$q_, _$timeout_, _WebsiteService_){
25
+ $rootScope = _$rootScope_;
26
+ $scope = $rootScope.$new();
27
+ $controller = _$controller_;
28
+ service = _WebsiteService_;
29
+
30
+ websiteDeferred = _$q_.defer();
31
+ websiteDeferred.resolve(mockWebsite);
32
+ spyOn(service, 'load').and.returnValue(websiteDeferred.promise);
33
+
34
+ blogDeferred = _$q_.defer();
35
+ spyOn(mockWebsite, '$get').and.returnValue(blogDeferred.promise);
36
+
37
+ authorDeferred = _$q_.defer();
38
+ spyOn(mockBlogPost, '$get').and.returnValue(authorDeferred.promise);
39
+
40
+ $controller('HomeController',
41
+ {
42
+ '$rootScope' : $rootScope,
43
+ '$scope': $scope,
44
+ '$timeout': _$timeout_,
45
+ 'WebsiteService': service
46
+ });
47
+ }));
48
+
49
+ it('should have correct UI setup, such as active home menu, show slider, hide title.', function() {
50
+ expect($rootScope.activeMenu.home == 'active');
51
+ expect($rootScope.showTitle == false);
52
+ });
53
+
54
+ it('should not have blog if latest blog returned is null.', function() {
55
+ blogDeferred.resolve(null);
56
+ $rootScope.$apply();
57
+ expect($scope.hasBlog).toBe(false);
58
+ expect($scope.blog).toBeUndefined();
59
+ });
60
+
61
+ it('should have blog if latest blog returned.', function() {
62
+ blogDeferred.resolve(mockBlogPost);
63
+ authorDeferred.resolve(mockAuthor);
64
+ $rootScope.$apply();
65
+ expect($scope.hasBlog).toBe(true);
66
+ expect($scope.blog).not.toBeNull();
67
+ expect($scope.blog.title).toEqual('Test Blog');
68
+ });
69
+
70
+
71
+
72
+ });
pool/shard006/JavaScript/0041806_pokemail.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import checkSyntax from './checks/syntax'
2
+ import checkDisposable from './checks/disposable'
3
+ import checkReachability from './checks/reachability'
4
+ import packageData from '../package.json'
5
+
6
+ /**
7
+ * Verifies the given email address against a set of predefined checks.
8
+ *
9
+ * @param {String} str - The email address to verify
10
+ * @param {Function} callback - An error-first callback
11
+ * @returns undefined
12
+ */
13
+ function verify(str, callback) {
14
+ if (!callback) {
15
+ throw new Error('Error-first callback is required')
16
+ }
17
+
18
+ const makeResult = props => (
19
+ Object.assign({
20
+ result: '',
21
+ reason: '',
22
+ disposable: false,
23
+ email: str,
24
+ success: true,
25
+ }, props)
26
+ )
27
+
28
+ const reject = err => callback(err, makeResult({ result: 'unknown', reason: err.message, success: false }))
29
+
30
+ if (!checkSyntax(str)) {
31
+ callback(null, makeResult({
32
+ result: 'undeliverable',
33
+ reason: 'invalid_email',
34
+ }))
35
+ return
36
+ }
37
+
38
+ // eslint-disable-next-line consistent-return
39
+ checkDisposable(str, (errDisposable, isDisposable) => {
40
+ if (errDisposable) {
41
+ reject(errDisposable)
42
+ return
43
+ }
44
+
45
+ if (isDisposable) {
46
+ callback(null, makeResult({
47
+ result: 'risky',
48
+ reason: 'low_quality',
49
+ disposable: true,
50
+ }))
51
+ return
52
+ }
53
+
54
+ checkReachability(str, (errHostname, reachable) => {
55
+ if (errHostname) {
56
+ reject(errHostname)
57
+ return
58
+ }
59
+
60
+ callback(null, makeResult({
61
+ result: reachable ? 'deliverable' : 'undeliverable',
62
+ reason: reachable ? 'low_deliverability' : 'invalid_domain',
63
+ disposable: false, // TODO
64
+ }))
65
+ })
66
+ })
67
+ }
68
+
69
+ // Use what Node currently supports
70
+ // See https://medium.com/@kentcdodds/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution-ad2d5ab93ce0
71
+ module.exports = { verify, version: packageData.version }
pool/shard006/JavaScript/0041809_sharedCalendarParser.js ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Version: GPL 3.0
3
+ *
4
+ * The contents of this file are subject to the General Public License
5
+ * 3.0 (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ * http://www.gnu.org/licenses/gpl.html
8
+ *
9
+ * Software distributed under the License is distributed on an "AS IS" basis,
10
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ * for the specific language governing rights and limitations under the
12
+ * License.
13
+ *
14
+ * -- Exchange 2007/2010 Calendar and Tasks Provider.
15
+ * -- For Thunderbird with the Lightning add-on.
16
+ *
17
+ * Borrowed from the enigMail project.
18
+ *
19
+ * Author: Michel Verbraak (info@1st-setup.nl)
20
+ * Website: http://www.1st-setup.nl/wordpress/?page_id=133
21
+ * email: exchangecalendar@extensions.1st-setup.nl
22
+ *
23
+ *
24
+ * ***** BEGIN LICENSE BLOCK *****/
25
+
26
+ var Cc = Components.classes;
27
+ var Ci = Components.interfaces;
28
+ var Cu = Components.utils;
29
+
30
+
31
+ Cu.import("resource://exchangecommon/ecFunctions.js");
32
+ Cu.import("chrome://exchangecommon/content/msgHdrUtils.js");
33
+ Cu.import("resource:///modules/gloda/utils.js");
34
+
35
+ if (!exchWebService) var exchWebService = {};
36
+
37
+ exchWebService.hdrView = {
38
+
39
+ theHeaders: null,
40
+
41
+ msgHdrViewLoad: function _msgHdrViewLoad(event) {
42
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: this.msgHdrViewLoad");
43
+
44
+ var listener = {
45
+ onBeforeShowHeaderPane: function _listener_onBeforeShowHeaderPane() {
46
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: _listener_onBeforeShowHeaderPane");
47
+ },
48
+
49
+ onStartHeaders: function _listener_onStartHeaders() {
50
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: _listener_onStartHeaders");
51
+
52
+ exchWebService.hdrView.statusBarHide();
53
+ },
54
+
55
+ onEndHeaders: function _listener_onEndHeaders() {
56
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: _listener_onEndHeaders");
57
+ exchWebService.hdrView.statusBarHide();
58
+
59
+ msgHdrGetHeaders(gFolderDisplay.selectedMessage, function (aHeaders) {
60
+
61
+ if ((exchWebService.check4Lightning) && (exchWebService.check4Lightning.lightningIsInstalled != 2)) {
62
+ return;
63
+ }
64
+
65
+ exchWebService.hdrView.theHeaders = null;
66
+
67
+ if ((aHeaders.has("x-sharing-remote-uid"))
68
+ && (aHeaders.has("x-sharing-local-type"))
69
+ && (aHeaders.has("x-sharing-remote-name"))) {
70
+ if (aHeaders.get("x-sharing-local-type") == "IPF.Appointment") {
71
+ exchWebService.commonFunctions.LOG("This message has a x-sharing-remote-uid header; its value is " + aHeaders.get("x-sharing-remote-uid"));
72
+ document.getElementById("exchWebServiceSharedCalendarLabel").value = GlodaUtils.deMime(aHeaders.get("x-sharing-remote-name"));
73
+ exchWebService.hdrView.theHeaders = aHeaders;
74
+ exchWebService.hdrView.statusBarShow();
75
+ }
76
+ }
77
+ else {
78
+ exchWebService.commonFunctions.LOG("NO x-sharing-remote-uid header");
79
+ }
80
+ });
81
+ },
82
+
83
+ };
84
+
85
+ gMessageListeners.push(listener);
86
+
87
+ // Next part is to hide the bar when the user changes to another folder and
88
+ // a new message is not selected. Otherwise it will stay visible.
89
+ listener.tbHideMessageHeaderPane = HideMessageHeaderPane;
90
+ HideMessageHeaderPane = function exchWebServiceHideMessageHeaderPane() {
91
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: exchWebServiceHideMessageHeaderPane");
92
+ try {
93
+ exchWebService.hdrView.statusBarHide();
94
+ }
95
+ catch (ex) {};
96
+ listener.tbHideMessageHeaderPane.apply(null, arguments);
97
+ };
98
+
99
+ },
100
+
101
+ hdrViewUnload: function _hdrViewUnload() {
102
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: this.hdrViewUnLoad");
103
+ this.statusBarHide();
104
+ },
105
+
106
+ statusBarHide: function _statusBarHide() {
107
+ var exchWebServiceSharedCalendarBox = document.getElementById("exchWebServiceSharedCalendarBox");
108
+ try {
109
+ exchWebServiceSharedCalendarBox.setAttribute("collapsed", "true")
110
+ //Enigmail.msg.setAttachmentReveal(null);
111
+ }
112
+ catch (ex) {}
113
+ },
114
+
115
+ statusBarShow: function _statusBarShow() {
116
+ var exchWebServiceSharedCalendarBox = document.getElementById("exchWebServiceSharedCalendarBox");
117
+ try {
118
+ exchWebServiceSharedCalendarBox.removeAttribute("collapsed");
119
+ }
120
+ catch (ex) {
121
+ exchWebService.commonFunctions.LOG("ERROR:" + ex);
122
+ }
123
+ },
124
+
125
+
126
+ doAddSharedCalendar: function _doAddSharedCalendar() {
127
+ exchWebService.commonFunctions.LOG("exchWebService.sharedCalendarParser.js: this.doAddSharedCalendar");
128
+ if (this.theHeaders) {
129
+ exchWebService.commonFunctions.LOG(" uid:" + this.theHeaders.get("x-sharing-remote-uid"));
130
+ exchWebService.commonFunctions.LOG(" name:" + GlodaUtils.deMime(this.theHeaders.get("x-sharing-remote-name")));
131
+
132
+ }
133
+ },
134
+ }
135
+
136
+ // Currently turned of because not yet ready for version 1.7.13
137
+ //addEventListener('messagepane-loaded', exchWebService.hdrView.msgHdrViewLoad, true);
138
+ //addEventListener('messagepane-unloaded', exchWebService.hdrView.hdrViewUnload, true);
pool/shard006/JavaScript/0041812_init.js ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Global initialization script */
2
+ var z = {};
3
+
4
+ $(document).ready(function(){
5
+ // Initialize install buttons.
6
+ $('.install').installButton();
7
+ $(window).trigger('buttons_loaded');
8
+
9
+ // Initialize any tabbed interfaces. See: tabs.js
10
+ if ($.fn.tabify) {
11
+ $('.tab-wrapper').tabify();
12
+ }
13
+
14
+ // Initialize email links
15
+ $('span.emaillink').each(function() {
16
+ $(this).find('.i').remove();
17
+ var em = $(this).text().split('').reverse().join('');
18
+ $(this).prev('a').attr('href', 'mailto:' + em).addClass('email');
19
+ });
20
+
21
+ // fake placeholders if we need to.
22
+ if (!('placeholder' in document.createElement('input'))) {
23
+ $('input[placeholder]').placeholder();
24
+ }
25
+
26
+ if (z.readonly) {
27
+ $('form[method=post]')
28
+ .before(gettext('This feature is temporarily disabled while we perform website maintenance. Please check back a little later.'))
29
+ .find('input, button, select').prop('disabled', true).addClass('disabled');
30
+ }
31
+ });
32
+
33
+ z.inlineSVG = (function() {
34
+ var e = document.createElement('div');
35
+ e.innerHTML = '<svg></svg>';
36
+ return !!(window.SVGSVGElement && e.firstChild instanceof window.SVGSVGElement);
37
+ })();
38
+ if (!z.inlineSVG) {
39
+ $("body").addClass("noInlineSVG");
40
+ }
41
+
42
+ /* prevent-default function wrapper */
43
+ function _pd(func) {
44
+ return function(e) {
45
+ e.preventDefault();
46
+ func.apply(this, arguments);
47
+ };
48
+ }
49
+
50
+
51
+ /* Fake the placeholder attribute since Firefox 3.6 doesn't support it. */
52
+ jQuery.fn.placeholder = function(new_value) {
53
+
54
+ if (new_value) {
55
+ this.attr('placeholder', new_value);
56
+ }
57
+
58
+ /* Bail early if we have built-in placeholder support. */
59
+ if ('placeholder' in document.createElement('input')) {
60
+ return this;
61
+ }
62
+
63
+ if (new_value && this.hasClass('placeholder')) {
64
+ this.val('').blur();
65
+ }
66
+
67
+ return this.focus(function() {
68
+ var $this = $(this),
69
+ text = $this.attr('placeholder');
70
+
71
+ if ($this.val() == text) {
72
+ $this.val('').removeClass('placeholder');
73
+ }
74
+ }).blur(function() {
75
+ var $this = $(this),
76
+ text = $this.attr('placeholder');
77
+
78
+ if ($this.val() === '') {
79
+ $this.val(text).addClass('placeholder');
80
+ }
81
+ }).each(function(){
82
+ /* Remove the placeholder text before submitting the form. */
83
+ var self = $(this);
84
+ self.closest('form').submit(function() {
85
+ if (self.hasClass('placeholder')) {
86
+ self.val('');
87
+ }
88
+ });
89
+ }).blur();
90
+ };
91
+
92
+
93
+ jQuery.fn.hasattr = function(name) {
94
+ return this.attr(name) !== undefined;
95
+ };
96
+
97
+
98
+ var escape_ = function(s){
99
+ if (s === undefined) {
100
+ return;
101
+ }
102
+ return s.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;')
103
+ .replace(/'/g, '&#39;').replace(/"/g, '&#34;');
104
+ };
105
+
106
+ //TODO(potch): kill underscore dead. until then, fake it on mobile.
107
+ if (!('_' in window)) _ = {};
108
+ /* is ``key`` in obj? */
109
+ _.haskey = function(obj, key) {
110
+ return typeof obj[key] !== "undefined";
111
+ };
112
+
113
+
114
+ /* Detect browser, version, and OS. */
115
+ $.extend(z, BrowserUtils());
116
+ $(document.body).addClass(z.platform).toggleClass('badbrowser', z.badBrowser);
117
+
118
+
119
+ /* Details for the current application. */
120
+ z.app = document.body.getAttribute('data-app');
121
+ z.appName = document.body.getAttribute('data-appname');
122
+ z.appMatchesUserAgent = z.browser[z.app];
123
+
124
+ z.anonymous = JSON.parse(document.body.getAttribute('data-anonymous'));
125
+
126
+ z.static_url = document.body.getAttribute('data-static-url');
127
+
128
+ z.readonly = JSON.parse(document.body.getAttribute('data-readonly'));
129
+
130
+ z.hasNightly = false;
131
+ if (z.browser.firefox) {
132
+ var nightlyVer = document.body.getAttribute('data-nightly-version');
133
+ if (nightlyVer) {
134
+ z.hasNightly = (VersionCompare.compareVersions(z.browserVersion, nightlyVer) > -1);
135
+ }
136
+ var betaVer = document.body.getAttribute('data-min-beta-version');
137
+ z.fxBeta = (VersionCompare.compareVersions(z.browserVersion, betaVer) > -1);
138
+ if (z.fxBeta) {
139
+ $(document.body).addClass('fxbeta');
140
+ }
141
+ } else {
142
+ z.fxBeta = false;
143
+ }
144
+
145
+ if (z.badBrowser) {
146
+ $(".get-fx-message").show();
147
+ }
148
+
149
+ z.apps = $(document.body).hasClass('apps');