Skip to content

Commit

Permalink
собираем lor.js через google closure
Browse files Browse the repository at this point in the history
+ тест более новых конструкций js
  • Loading branch information
maxcom committed Jan 2, 2025
1 parent f0a4529 commit 4dd3103
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 26 deletions.
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@
<excludes>
<exclude>**/jquery-ui-*/**/*.js</exclude>
<exclude>**/highlight.min.js</exclude>
<exclude>**/lor.js</exclude>
</excludes>
<aggregations>
<aggregation>
Expand Down Expand Up @@ -702,6 +703,31 @@
</configuration>
</plugin>

<plugin>
<groupId>com.github.blutorange</groupId>
<artifactId>closure-compiler-maven-plugin</artifactId>
<version>2.31.0</version>
<executions>
<execution>
<id>default-minify</id>
<configuration>
<encoding>UTF-8</encoding>
<includes>
<include>lor.js</include>
</includes>
<skipMerge>true</skipMerge>
<logLevel>all</logLevel>
<closureLanguageOut>ECMASCRIPT_2016</closureLanguageOut>
<outputFilename>#{path}/#{basename}.#{extension}</outputFilename>
</configuration>
<goals>
<goal>minify</goal>
</goals>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Expand Down
49 changes: 23 additions & 26 deletions src/main/webapp/js/lor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2024 Linux.org.ru
* Copyright 1998-2025 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -66,39 +66,36 @@ function initStarPopovers() {

function init_interpage_adv(ads) {
$(function() {
var ad = ads[Math.floor(Math.random() * ads.length)];
const img = $('<img>');
const anchor = $('<a>');
const ad = ads[Math.floor(Math.random() * ads.length)];

if (ad.type==='img') {
var anchor = $('<a>');
anchor.attr('href', ad.href);
anchor.attr('target', '_blank');

var img = $('<img>');
img.attr('src', ad.src);
if ('width' in ad) {
img.attr('width', ad.width);
} else {
img.attr('width', 728);
}
if (ad.type === 'img') {
anchor.attr('href', ad.href);
anchor.attr('target', '_blank');

if ('height' in ad) {
img.attr('height', ad.height);
} else {
img.attr('height', 90);
}
img.attr('src', ad.src);
if ('width' in ad) {
img.attr('width', ad.width);
} else {
img.attr('width', 728);
}

anchor.append(img);
$('#interpage').append(anchor);
if ('height' in ad) {
img.attr('height', ad.height);
} else {
img.attr('height', 90);
}

anchor.append(img);
$('#interpage').append(anchor);
}

if (ad.type === 'rimg') {
var anchor = $('<a>');
anchor.attr('href', ad.href);
anchor.attr('target', '_blank');

var img = $('<img>');

var interpage = $('#interpage')
const interpage = $('#interpage');

if (interpage.width() > 1024) {
// img.attr('width', 728);
Expand All @@ -117,7 +114,7 @@ function init_interpage_adv(ads) {
}

anchor.append(img);
$('#interpage').append(anchor);
interpage.append(anchor);
}
});
}
Expand Down

0 comments on commit 4dd3103

Please sign in to comment.