Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Css, Js for stargazers
  • Loading branch information
Talina06 committed Jul 4, 2014
1 parent ecd5428 commit 7acf940
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
56 changes: 55 additions & 1 deletion root/static/css/style.css
Expand Up @@ -140,6 +140,60 @@ button.favorite:hover, button.favorite.active, a.favorite.active, a.favorite:hov
text-decoration: none;
}


button.stargazer, a.stargazer {
padding: 1px 3px;
margin-left: 5px;
font-size: 0.9em;
background-color: #fff;
opacity: 0.5;
-webkit-border-radius: 3px 3px;
-moz-border-radius: 3px 3px;
border-radius: 3px 3px;
border: solid 1px #666;
color: #333;
text-decoration: none;
display: inline-block;
line-height: 1;
text-align: right;
min-width: 25px;
position: relative;
top: -1px;
}

/* Counter-act .breadcrumbs a */
.breadcrumbs a.stargazer, .breadcrumbs button.stargazer {
font-size: 0.85em;
font-weight: normal;
}

button.stargazer {
min-width: 35px;
cursor: pointer;
}

button.stargazer.highlight, a.stargazer.highlight {
background-color: #fca216;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ffc874), to(#fca216));
background: -moz-linear-gradient(#ffc874,#fca216);
color: #fff;
text-shadow: 0px 1px 1px #333;
border-color: #d39534;
opacity: 1;
}

button.stargazer:hover, button.stargazer.active, a.stargazer.active, a.stargazer:hover {
background-color: #36C;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#69F), to(#36C));
background: -moz-linear-gradient(#69F,#36C);
color: #fff;
text-shadow: 0px 1px 1px #333;
border-color: #36C;
opacity: 1;
text-decoration: none;
}


li button.dependencies-graph {
padding: 0;
border: 0;
Expand Down Expand Up @@ -343,4 +397,4 @@ div.qtip-github table th {
background: url('/static/images/profile/feed.png') no-repeat 10px 0px;
padding-right: 20px;
float: right;
}
}
35 changes: 35 additions & 0 deletions root/static/js/cpan.js
Expand Up @@ -329,3 +329,38 @@ function favDistribution(form) {
return false;
}

function starModule(form) {
form = $(form);
var data = form.serialize();
$.ajax({
type: 'POST',
url: form.attr('action'),
data: data,
success: function () {
var button = form.find('button');
button.toggleClass('active');
var counter = button.find('span');
var count = counter.text();
if (button.hasClass('active')) {
counter.text(count ? parseInt(count, 10) + 1 : 1);
form.append('<input type="hidden" name="remove" value="1">');
if (!count)
button.toggleClass('highlight');
} else {
counter.text(parseInt(count, 10) - 1);
form.find('input[name="remove"]').remove();
if (counter.text() === 0) {
counter.text("");
button.toggleClass('highlight');
}
}
},
error: function () {
if (confirm("You have to complete a Captcha in order to star the module.")) {
document.location.href = "/account/turing";
}
}
});
return false;
}

0 comments on commit 7acf940

Please sign in to comment.