Skip to content

Commit

Permalink
IA7 v1.6.200 - sortable collection
Browse files Browse the repository at this point in the history
  • Loading branch information
hplato committed Sep 20, 2017
1 parent f148086 commit e5eea1f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 9 deletions.
8 changes: 4 additions & 4 deletions code/common/weather_wunderground.pl
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@
weather_wunderground_addelem( $channel, 'HumidOutdoor', 'relative_humidity' );

#IsRaining
my $israining = 0;
$israining = 1 if ($wunderground_data{Conditions} =~ m/rain/i);
$wunderground_data{IsRaining} = 0;
$wunderground_data{IsRaining} = 1 if ($wunderground_data{Conditions} =~ m/rain/i);

#IsSnowing
my $issnowing = 0;
$issnowing = 1 if ($wunderground_data{Conditions} =~ m/snow/i);
$wunderground_data{IsSnowing} = 0;
$wunderground_data{IsSnowing} = 1 if ($wunderground_data{Conditions} =~ m/snow/i);

weather_wunderground_addelem( $channel, 'Clouds', 'weather' );

Expand Down
61 changes: 56 additions & 5 deletions web/ia7/include/javascript.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

var ia7_ver = "v1.6.150";
var ia7_ver = "v1.6.200";
var entity_store = {}; //global storage of entities
var json_store = {};
var updateSocket;
Expand Down Expand Up @@ -1249,6 +1249,7 @@ var loadCollection = function(collection_keys) {
var button_html = "<div style='vertical-align:middle'><button entity='"+item+"' ";
button_html += "class='btn btn-"+color+" btn-lg btn-block btn-list btn-popover "+ btn_direct +" btn-state-cmd navbutton-padding'>";
button_html += name+dbl_btn+"<span class='pull-right'>"+json_store.objects[item].state+"</span></button></div>";
button_html = "<div class='col-sm-4' colid='"+i+"'>" + button_html + "</div>";
entity_arr.push(button_html);
items += item+",";
}
Expand Down Expand Up @@ -1283,6 +1284,7 @@ var loadCollection = function(collection_keys) {
} else {
button_html = "<a link-type='collection' href='"+link+"' class='btn btn-default btn-lg btn-block btn-list "+hidden+" navbutton-padding' role='button'><i class='"+icon_set+" "+icon+" icon-larger fa-2x fa-fw'></i>"+name+"</a>";
}
button_html = "<div class='col-sm-4' colid='"+collection+"'>" + button_html + "</div>";
entity_arr.push(button_html);
}
}
Expand All @@ -1297,7 +1299,9 @@ var loadCollection = function(collection_keys) {
$('#list_content').append("<div id='buffer"+row+"' class='row top-buffer'>");
$('#buffer'+row).append("<div id='row" + row + "' class='col-sm-12 col-sm-offset-0 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2'>");
}
$('#row'+row).append("<div class='col-sm-4'>" + entity_arr[i] + "</div>");
// $('#row'+row).append("<div class='col-sm-4' colid='"+i+"'>" + entity_arr[i] + "</div>");
$('#row'+row).append(entity_arr[i]);

if (column == 3){
column = 0;
row++;
Expand Down Expand Up @@ -1520,7 +1524,9 @@ var get_stats = function(tagline) {
$('.mh-wi').click( function () {
var summary = "<strong>Summary:</strong>&nbsp;&nbsp;"+json.data.summary_long+"<br>";
summary += "<strong>Last Updated:</strong>&nbsp;&nbsp;"+json.data.weather_lastupdated;

if ($('.mh-wi-icon').hasClass("wi-na")) {
summary += "<br><strong>Clouds:</strong>&nbsp;&nbsp"+json.data.clouds;
}
$('#lastResponse').find('.modal-body').html(summary);
$('#lastResponse').modal({
show: true
Expand Down Expand Up @@ -1550,6 +1556,12 @@ var get_wi_icon = function (conditions,rain,snow,night) {
icon = "wi-cloudy";
if (rain) icon = "wi-rain";
if (snow) icon = "wi-snow";

} else if (conditions == "rain") {
icon += "rain";

} else if (conditions == "snow") {
icon += "snow";

} else if (conditions == "sky clear" || conditions == "" || conditions == "clear") {
if (night) {
Expand Down Expand Up @@ -1581,7 +1593,7 @@ var get_wi_icon = function (conditions,rain,snow,night) {
}
}

} else if (conditions.includes("few clouds") || conditions == "scattered clouds" || conditions == "broken clouds") {
} else if (conditions.includes("few clouds") || conditions == "scattered clouds" || conditions == "broken clouds" || conditions == "cloudy") {
if (rain) {
icon += "rain";
} else if (snow) {
Expand All @@ -1593,7 +1605,6 @@ var get_wi_icon = function (conditions,rain,snow,night) {
} else {
icon = "wi-na";
}

return icon;
}

Expand Down Expand Up @@ -3454,6 +3465,46 @@ $(document).ready(function() {
display_mode = $(this).find('input').attr('id');
developer = false;
}

if (developer == true) {
//turn on collections drag-n-dropping
$("#list_content").sortable({
tolerance: "pointer",
items: ".col-sm-4",
update: function( event, ui ) {
var URLHash = URLToHash();
//Get Sorted Array of Entities
var outputJSON = $( "#list_content" ).sortable( "toArray", { attribute: "colid" } );
//outputJSON = '["' + outputJSON.join('","') + '"]';
//URLHash.path = "/objects/" + entity + "/sort_order";
//delete URLHash.parents;
console.log("outputJSON="+JSON.stringify(outputJSON));
//URLHash={"_collection_key":"0,6"}
console.log("URLHash="+JSON.stringify(URLHash));
console.log("Key="+URLHash._collection_key.substr(URLHash._collection_key.lastIndexOf(',') + 1));

},
//to prevent long clicks from firing while dragging
start: function(event, ui) {
// $("#list_content").mayTriggerLongClicks().off();
},
stop: function(event, ui) {
// $("#list_content").mayTriggerLongClicks().on( 'longClick', function() {
// var entity = $(this).attr("entity");
// console.log("long_click="+JSON.stringify($(this)));
// });
}
});
//$('#list_content').disableSelection();
$("#list_content").mayTriggerLongClicks().on( 'longClick', function() {
var entity = $(this).attr("entity");
console.log("long_click="+JSON.stringify($(this)));
});
} else {
$("#list_content").sortable("destroy");
//$("#list_content").enableSelection();
$("#list_content").mayTriggerLongClicks().off();
}
document.cookie = "display_mode="+display_mode;
document.cookie = "developer="+developer;

Expand Down
18 changes: 18 additions & 0 deletions web/ia7/index.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,24 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Developer Modal -->
<div class="modal fade" id="devModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog dev-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel"><span class="object-title"></span>
<div class="btn-group btn-group-sm pull-right">
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i></button>
</div>
</h4>
</div>
<div class="modal-body">
<div id="devoptions">
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="dialog-confirm" title="Notification">
</div>
</body></html>

0 comments on commit e5eea1f

Please sign in to comment.