Skip to content

Commit

Permalink
js plugins, bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Faisal N committed Oct 12, 2023
1 parent f50767c commit df5e65f
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 10 deletions.
9 changes: 3 additions & 6 deletions frontend/partials/foot.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<script>
var domain = "<%- vars.domain %>";
var page = window.location.toString().split(`${domain}`)[1].split("?")[0];
</script>
<script src="<%- vars.domain %>/js/scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/js/lightbox-plus-jquery.min.js" integrity="sha512-U9dKDqsXAE11UA9kZ0XKFyZ2gQCj+3AwZdBMni7yXSvWqLFEj8C1s7wRmWl9iyij8d5zb4wm56j4z/JVEwS77g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<%- vars.domain %>/js/lightbox-plus-jquery.min.js"></script>
<script src="<%- vars.domain %>/js/jquery.fittext.js"></script>
<script src="<%- vars.domain %>/js/scripts.js"></script>
2 changes: 1 addition & 1 deletion frontend/partials/suggested.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% var currentSlug = (article || []).slug;
<% var article = article || poll || newspaper; var currentSlug = (article || []).slug;
function ifYesterday(date) {
var yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
Expand Down
28 changes: 26 additions & 2 deletions frontend/public/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
@media screen and (max-width: 1400px) {
header .main {
flex-direction: column !important;
padding: 24px 0 20px 0 !important;
flex-direction: row !important;
}

header .main.home {
padding: 50px 0 20px 0 !important;
}

header .main .search {
position: fixed !important;
top: 35px !important;
}
}

@media screen and (max-width: 1200px) {
header .main {
flex-direction: column !important;
}

header .main .search {
position: flex !important;
}

.hero {
display: flex !important;
flex-direction: column;
Expand Down Expand Up @@ -47,11 +65,16 @@
left: 0px !important;
padding: 10px 20px !important;
border-radius: 100px;
margin-bottom: 30px;
}

header .main {
flex-direction: column !important;
}

header .main.home {
margin-top: -26px;
}

header .main a img {
height: 50px !important;
Expand Down Expand Up @@ -248,7 +271,7 @@ header .main {
flex-direction: row;
align-items: center;
justify-content: space-between;
gap: 20px;
gap: 5px;
width: 75%;
padding: 50px 0 20px 0;
border-bottom: 1px solid lightgray;
Expand Down Expand Up @@ -311,6 +334,7 @@ header .main .search.active form {

header .main .search form input {
width: 15vw;
min-width: 100px;
border-radius: 24px;
border: 2px solid #D2D2D2;
background-color: var(--background);
Expand Down
43 changes: 43 additions & 0 deletions frontend/public/js/jquery.fittext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*global jQuery */
/*!
* FitText.js 1.2
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
*/

(function( $ ){

$.fn.fitText = function( kompressor, options ) {

// Setup options
var compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);

return this.each(function(){

// Store the object
var $this = $(this);

// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};

// Call once to set.
resizer();

// Call on resize. Opera debounces their resize by default.
$(window).on('resize.fittext orientationchange.fittext', resizer);

});

};

})( jQuery );
Loading

0 comments on commit df5e65f

Please sign in to comment.