Jump to content
Graham Quince

FrogCode version numbers

Recommended Posts

Here's a snippet I've just put together which you can drop into an HTML widget and get a list of all your installed FrogCode applications and widgets with their version number.  Might make keeping track of what you're got easier:

<style>
    .packageList {
        font-size: 11pt !important;
        width: calc(50% - 45px);
        float: left;
        margin: 5px;
        background: #FFFFFF;
        border: 1px solid #cccccc;
        padding: 10px;
        border-radius: 7px;
    }
    
    .packageIcon {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }
    .packageItem {
        width: 100%;
        margin-bottom: 5px;
    }
</style>

<div class="packageList">
    <table class="installedApps"></table>
</div>
<div class="packageList">
    <table class="installedWidgets"></table>
</div>


<script>
Frog.Model.api('packages.get', {
    enabled: true
}).done(function(response) {
    var apps = response.data.app;
    var widgets = response.data.widget;
    widgets.sort(sortFunction);
  
    for (var a = 0; a < apps.length; a++) {
        listPackage(apps[a].extended_data.appname,apps[a].extended_data.version,apps[a].extended_data.appicon,'installedApps');
    }
    for (var w = 0; w < widgets.length; w++) {
        listPackage(widgets[w].name,widgets[w].extended_data.version,widgets[w].extended_data.icon,'installedWidgets');
    }

}).fail(function(e) {
    console.log("FAILED");
});
  
function sortFunction(a, b) {
    if (a.name.toLowerCase() === b.name.toLowerCase()) {
        return 0;
    }
    else {
        return (a.name.toLowerCase() < b.name.toLowerCase()) ? -1 : 1;
    }
}
    
function listPackage(appName, version, icon, type) {   

    $('.'+type).append(
        '<tr class="packageItem">'+
            '<td><img class="packageIcon" src="'+icon+'"></td>'+
            '<td>'+appName+' </td>'+
            '<td>Version: <b>'+version+'</b>'+'</td>'+
        '</tr>'
    );

}
</script>

version numbers.PNG

Edited by Graham Quince
Tweaked the code to sort widgets alphabetically
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...