Update fedmenu in staging.
This commit is contained in:
parent
99c6e4f840
commit
becc977830
1 changed files with 34 additions and 17 deletions
|
@ -32,17 +32,10 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
|
||||
$('body', c).append('<div id="fedmenu-wrapper"></div>');
|
||||
|
||||
$('body', c).append('<div id="fedmenu-main-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-main-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-main-content', c).append("<h1>Fedora Infrastructure Apps</h1>");
|
||||
|
||||
var imgurl;
|
||||
if (o.user !== null) {
|
||||
imgurl = libravatar.url(o.user);
|
||||
$('#fedmenu-user-button .img', c).css('background-image', 'url("' + imgurl + '")');
|
||||
$('body', c).append('<div id="fedmenu-user-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-user-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-user-content', c).append("<h1>View " + o.user + " in other apps</h1>");
|
||||
}
|
||||
if (o.package !== null) {
|
||||
/* This icon is not always going to exist, so we should put in an
|
||||
|
@ -50,9 +43,6 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
* isn't there. */
|
||||
imgurl = 'https://apps.fedoraproject.org/packages/images/icons/' + o.package + '.png';
|
||||
$('#fedmenu-package-button .img', c).css('background-image', 'url("' + imgurl + '")');
|
||||
$('body', c).append('<div id="fedmenu-package-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-package-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-package-content', c).append("<h1>View the " + o.package + " package elsewhere</h1>");
|
||||
}
|
||||
|
||||
// Define three functions used to generate the content of the menu panes
|
||||
|
@ -67,6 +57,12 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
"</a></li>";
|
||||
});
|
||||
html = html + "</ul></div>";
|
||||
|
||||
if ($('#fedmenu-main-content').length == 0) {
|
||||
$('body', c).append('<div id="fedmenu-main-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-main-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-main-content', c).append("<h1>Fedora Infrastructure Apps</h1>");
|
||||
}
|
||||
$("#fedmenu-main-content", c).append(html);
|
||||
};
|
||||
|
||||
|
@ -86,6 +82,11 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
if (found) {
|
||||
if ($('#fedmenu-user-content').length == 0) {
|
||||
$('body', c).append('<div id="fedmenu-user-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-user-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-user-content', c).append("<h1>View " + o.user + " in other apps</h1>");
|
||||
}
|
||||
html = html + "</ul></div>";
|
||||
$("#fedmenu-user-content", c).append(html);
|
||||
}
|
||||
|
@ -108,10 +109,22 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
});
|
||||
if (found) {
|
||||
html = html + "</ul></div>";
|
||||
if ($('#fedmenu-package-content').length == 0) {
|
||||
$('body', c).append('<div id="fedmenu-package-content" class="fedmenu-content"></div>');
|
||||
$('#fedmenu-package-content', c).append("<span class='fedmenu-exit'>❌</span>");
|
||||
$('#fedmenu-package-content', c).append("<h1>View the " + o.package + " package elsewhere</h1>");
|
||||
}
|
||||
$("#fedmenu-package-content", c).append(html);
|
||||
}
|
||||
};
|
||||
|
||||
// A handy lookup for those functions we just defined.
|
||||
var content_makers = {
|
||||
'main': make_main_content_html,
|
||||
'user': make_user_content_html,
|
||||
'package': make_package_content_html,
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: o.url,
|
||||
mimeType: o.mimeType,
|
||||
|
@ -122,11 +135,8 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
console.log(err);
|
||||
},
|
||||
success: function(script) {
|
||||
$.each(json.children, make_main_content_html);
|
||||
if (o.user !== null)
|
||||
$.each(json.children, make_user_content_html);
|
||||
if (o.package !== null)
|
||||
$.each(json.children, make_package_content_html);
|
||||
// Save this for later...
|
||||
master_data = json.children;
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -135,8 +145,15 @@ var fedmenu = function(options) { $(document).ready(function() {
|
|||
"#fedmenu-" + t + "-button," +
|
||||
"#fedmenu-" + t + "-content";
|
||||
};
|
||||
var activate = function(t) { $(selector(t), c).addClass('fedmenu-active'); };
|
||||
var deactivate = function(t) { $(selector(t), c).removeClass('fedmenu-active'); };
|
||||
|
||||
var activate = function(t) {
|
||||
$.each(master_data, content_makers[t]);
|
||||
$(selector(t), c).addClass('fedmenu-active');
|
||||
};
|
||||
var deactivate = function(t) {
|
||||
$(selector(t), c).removeClass('fedmenu-active');
|
||||
$('.fedmenu-content', c).remove(); // destroy content.
|
||||
};
|
||||
|
||||
var click_factory = function(t) { return function() {
|
||||
if ($(this).hasClass('fedmenu-active')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue